From d55bca53a5b12ffce1aa9574754cdd6704d1d351 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Fri, 18 Jan 2013 15:07:47 -0500 Subject: [PATCH 1/6] Bug 344890 - [remote] Cannot start a new process on a remote target with extended-remote Change-Id: Iae6f29a8a549cc57577911bdc84cc95f6ba983df --- .../model/IDebugNewExecutableHandler.java | 22 + .../icons/obj16/new_exec.gif | Bin 0 -> 949 bytes .../plugin.properties | 6 + debug/org.eclipse.cdt.debug.ui/plugin.xml | 33 +- .../commands/DebugNewExecutableHandler.java | 23 ++ .../gdb/internal/ui/GdbAdapterFactory.java | 6 + .../GdbDebugNewExecutableCommand.java | 375 ++++++++++++++++++ .../gdb/internal/ui/commands/Messages.java | 48 +++ .../internal/ui/commands/Messages.properties | 12 + .../gdb/IGDBLaunchConfigurationConstants.java | 7 + .../cdt/dsf/gdb/launching/GdbLaunch.java | 6 +- .../gdb/service/DebugNewProcessSequence.java | 8 +- .../service/DebugNewProcessSequence_7_2.java | 73 +++- .../cdt/dsf/gdb/service/GDBProcesses_7_2.java | 11 +- .../StartOrRestartProcessSequence_7_0.java | 8 +- 15 files changed, 620 insertions(+), 18 deletions(-) create mode 100644 debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDebugNewExecutableHandler.java create mode 100755 debug/org.eclipse.cdt.debug.ui/icons/obj16/new_exec.gif create mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/DebugNewExecutableHandler.java create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.properties diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDebugNewExecutableHandler.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDebugNewExecutableHandler.java new file mode 100644 index 00000000000..ecde45f0427 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDebugNewExecutableHandler.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.core.model; + +import org.eclipse.debug.core.commands.IDebugCommandHandler; + +/** + * Command handler for the "Debug New Executable" command. + * + * @since 7.3 + */ +public interface IDebugNewExecutableHandler extends IDebugCommandHandler { +} diff --git a/debug/org.eclipse.cdt.debug.ui/icons/obj16/new_exec.gif b/debug/org.eclipse.cdt.debug.ui/icons/obj16/new_exec.gif new file mode 100755 index 0000000000000000000000000000000000000000..78ca91c6dab7edd4ab90789a10e3b9f7306eb2a8 GIT binary patch literal 949 zcmYk5F^C>S5QX2tY3^cTPAo*QxkO^I7Re3d6w&I?C>A2wGI(hol0vZ(NwXve3UUNv zicF;j1l=ZLnTVkEs{&hD3dtp%L=H@l=l)iiZW!2o^Sw83z5V7Zubx}O8ty*A{}lj% z1OylbD1kzhL=lQnff}epO;n*84QPQzv_un{(SaW5L{D^~8v_`DL5#!@hUeRGz=RVP zJR1Zez(58xXHgI(qA*HEQ4~i-)QHNc8C6jo4bdVRqh&Njb96+H=!~Ax72PoqBVsT{ z#!w805som!8CH1em}>_?A_+}dEMN&1vLuUG%nH_EC2O*Z)ofr3HnJs~*vt<0U?+RB zi`^XH2o7>2hd4}w4w`h*q9=k$JQ7S~LX$`qWQi=yl3A3+S&=oeGHYg4R%b)D$i{4$ zP1&3s*&{o%XLeYN%2* zRi$b*sD&EUQcY@BhkB?}J=LXd4QPZ0HBv(wmLZ2sIc3RS1Yx={kxX54IHOSD5-xN} z7rEFKuHj18bd{^!;1+IlOEy_jH%LJ>U@@^hghREIyk-n{H3!bMM(dUhDrX zFD=Bpyf}o#OWZT);y%U`eP T^3(og>(7%nKG<1W!fXElGQ-Y4 literal 0 HcmV?d00001 diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties index 34cbb7d2d35..2266d66e86e 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.properties +++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties @@ -242,3 +242,9 @@ OpenNewView.name = Open New View # Disassembly Ruler Column extension point extPoint.disassemblyRulerColumn=Disassembly Ruler Column + +# Debug New Executable Command +DebugNewExecutable.name=Debug New Executable +DebugNewExecutable.description=Debug a new executable +DebugNewExecutable.label=Debug New Executable... +DebugNewExecutable.tooltip=Debug a new executable diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index 0188aa81f49..d2b3fc1b6f1 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -2012,7 +2012,12 @@ id="org.eclipse.cdt.debug.ui.command.connect" name="%Connect.name"> - + + @@ -2079,6 +2084,10 @@ class="org.eclipse.cdt.debug.internal.ui.commands.ConnectCommandHandler" commandId="org.eclipse.cdt.debug.ui.command.connect"> + + @@ -2520,6 +2529,28 @@ + + + + + getCommandType() { + return IDebugNewExecutableHandler.class; + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java index a35c0913306..ac16701c062 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java @@ -19,6 +19,7 @@ import java.util.WeakHashMap; import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.IConnectHandler; +import org.eclipse.cdt.debug.core.model.IDebugNewExecutableHandler; import org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler; import org.eclipse.cdt.debug.core.model.IReverseResumeHandler; import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler; @@ -49,6 +50,7 @@ import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbDisconnectCommand; import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbRestartCommand; import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbSteppingModeTarget; import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbConnectCommand; +import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbDebugNewExecutableCommand; import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbResumeWithoutSignalCommand; import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseResumeCommand; import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseStepIntoCommand; @@ -114,6 +116,7 @@ public class GdbAdapterFactory final GdbResumeWithoutSignalCommand fResumeWithoutSignalCommand; final GdbRestartCommand fRestartCommand; final DsfTerminateCommand fTerminateCommand; + final GdbDebugNewExecutableCommand fDebugNewExecutableCommand; final GdbConnectCommand fConnectCommand; final GdbDisconnectCommand fDisconnectCommand; final IDebugModelProvider fDebugModelProvider; @@ -162,6 +165,7 @@ public class GdbAdapterFactory fResumeWithoutSignalCommand = new GdbResumeWithoutSignalCommand(session); fRestartCommand = new GdbRestartCommand(session, fLaunch); fTerminateCommand = new DsfTerminateCommand(session); + fDebugNewExecutableCommand = new GdbDebugNewExecutableCommand(session, fLaunch); fConnectCommand = new GdbConnectCommand(session); fDisconnectCommand = new GdbDisconnectCommand(session); fSuspendTrigger = new GdbSuspendTrigger(session, fLaunch); @@ -189,6 +193,7 @@ public class GdbAdapterFactory session.registerModelAdapter(IRestartHandler.class, fRestartCommand); session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand); session.registerModelAdapter(IConnectHandler.class, fConnectCommand); + session.registerModelAdapter(IDebugNewExecutableHandler.class, fDebugNewExecutableCommand); session.registerModelAdapter(IDisconnectHandler.class, fDisconnectCommand); session.registerModelAdapter(IModelSelectionPolicyFactory.class, fModelSelectionPolicyFactory); session.registerModelAdapter(IRefreshAllTarget.class, fRefreshAllTarget); @@ -249,6 +254,7 @@ public class GdbAdapterFactory session.unregisterModelAdapter(IRestartHandler.class); session.unregisterModelAdapter(ITerminateHandler.class); session.unregisterModelAdapter(IConnectHandler.class); + session.unregisterModelAdapter(IDebugNewExecutableHandler.class); session.unregisterModelAdapter(IDisconnectHandler.class); session.unregisterModelAdapter(IModelSelectionPolicyFactory.class); session.unregisterModelAdapter(IRefreshAllTarget.class); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java new file mode 100644 index 00000000000..b4a366cca9f --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java @@ -0,0 +1,375 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.dsf.gdb.internal.ui.commands; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.RejectedExecutionException; + +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.debug.core.model.IDebugNewExecutableHandler; +import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; +import org.eclipse.cdt.dsf.concurrent.DsfExecutor; +import org.eclipse.cdt.dsf.concurrent.DsfRunnable; +import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor; +import org.eclipse.cdt.dsf.concurrent.Query; +import org.eclipse.cdt.dsf.concurrent.RequestMonitor; +import org.eclipse.cdt.dsf.datamodel.IDMContext; +import org.eclipse.cdt.dsf.debug.service.IProcesses; +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; +import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; +import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch; +import org.eclipse.cdt.dsf.gdb.service.IGDBBackend; +import org.eclipse.cdt.dsf.gdb.service.SessionType; +import org.eclipse.cdt.dsf.service.DsfServicesTracker; +import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.IRequest; +import org.eclipse.debug.core.commands.AbstractDebugCommand; +import org.eclipse.debug.core.commands.IEnabledStateRequest; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.progress.UIJob; + +public class GdbDebugNewExecutableCommand extends AbstractDebugCommand implements IDebugNewExecutableHandler { + + private class PromptJob extends UIJob { + + private DataRequestMonitor fRequestMonitor; + private boolean fRemote = false; + + private PromptJob( boolean remote, DataRequestMonitor rm ) { + super( "New Executable Prompt Job" ); //$NON-NLS-1$ + fRemote = remote; + fRequestMonitor = rm; + } + + @Override + public IStatus runInUIThread( IProgressMonitor monitor ) { + int flags = ( fRemote ) ? NewExecutableDialog.REMOTE : 0; + NewExecutableDialog dialog = new NewExecutableDialog( GdbUIPlugin.getShell(), flags ); + final boolean canceled = dialog.open() == Window.CANCEL; + final PromptInfo info = dialog.getInfo(); + fExecutor.execute( new DsfRunnable() { + + @Override + public void run() { + if ( canceled ) + fRequestMonitor.cancel(); + else + fRequestMonitor.setData( info ); + fRequestMonitor.done(); + } + } ); + return Status.OK_STATUS; + } + } + + private class NewExecutableDialog extends TitleAreaDialog { + + private static final int REMOTE = 0x1; + + private int fFlags = 0; + private PromptInfo fInfo = null; + + private Text fHostBinaryText; + private Text fTargetBinaryText; + private Text fArgumentsText; + + private NewExecutableDialog( Shell parentShell, int flags ) { + super( parentShell ); + setShellStyle( getShellStyle() | SWT.RESIZE ); + fFlags = flags; + } + + @Override + protected Control createContents( Composite parent ) { + Control control = super.createContents( parent ); + validate(); + return control; + } + + @Override + protected Control createDialogArea( Composite parent ) { + boolean remote = (fFlags & REMOTE) > 0; + + getShell().setText( Messages.GdbDebugNewExecutableCommand_Debug_New_Executable ); + setTitle( Messages.GdbDebugNewExecutableCommand_Select_Binary ); + String message = ( remote ) ? + Messages.GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target : + Messages.GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments; + setMessage( message ); + + Composite control = (Composite)super.createDialogArea( parent ); + Composite comp = new Composite( control, SWT.NONE ); + GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true ); + GridLayout layout = new GridLayout( 3, false ); + comp.setLayout( layout ); + comp.setLayoutData( gd ); + + new Label( comp, SWT.None ).setText( remote ? Messages.GdbDebugNewExecutableCommand_Binary_on_host : Messages.GdbDebugNewExecutableCommand_Binary ); + fHostBinaryText = new Text( comp, SWT.BORDER ); + fHostBinaryText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) ); + fHostBinaryText.addModifyListener( new ModifyListener() { + + @Override + public void modifyText( ModifyEvent e ) { + validate(); + } + } ); + Button browseButton = new Button( comp, SWT.PUSH ); + browseButton.setText( Messages.GdbDebugNewExecutableCommand_Browse ); + browseButton.setFont( JFaceResources.getDialogFont() ); + setButtonLayoutData( browseButton ); + browseButton.addSelectionListener( new SelectionAdapter() { + + @Override + public void widgetSelected( SelectionEvent e ) { + FileDialog dialog = new FileDialog( getShell() ); + dialog.setFileName( fHostBinaryText.getText() ); + String result = dialog.open(); + if ( result != null ) { + fHostBinaryText.setText( result ); + } + } + } ); + + if ( remote ) { + new Label( comp, SWT.None ).setText( Messages.GdbDebugNewExecutableCommand_Binary_on_target ); + fTargetBinaryText = new Text( comp, SWT.BORDER ); + fTargetBinaryText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) ); + fTargetBinaryText.addModifyListener( new ModifyListener() { + + @Override + public void modifyText( ModifyEvent e ) { + validate(); + } + } ); + } + + new Label( comp, SWT.None ).setText( Messages.GdbDebugNewExecutableCommand_Arguments ); + fArgumentsText = new Text( comp, SWT.BORDER ); + fArgumentsText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) ); + + return control; + } + + @Override + protected void okPressed() { + String targetPath = ( fTargetBinaryText != null ) ? fTargetBinaryText.getText().trim() : null; + String args = fArgumentsText.getText().trim(); + fInfo = new PromptInfo( fHostBinaryText.getText().trim(), targetPath, args ); + super.okPressed(); + } + + private PromptInfo getInfo() { + return fInfo; + } + + private void validate() { + String message = null; + String hostBinary = fHostBinaryText.getText().trim(); + File file = new File( hostBinary ); + if ( !file.exists() ) + message = Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist; + else if ( file.isDirectory() ) + message = Messages.GdbDebugNewExecutableCommand_Invalid_binary; + if ( fTargetBinaryText != null ) { + if ( fTargetBinaryText.getText().trim().length() == 0 ) + message = Messages.GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified; + } + setErrorMessage( message ); + getButton( IDialogConstants.OK_ID ).setEnabled( message == null ); + } + } + + private class PromptInfo { + private String fHostPath; + private String fTargetPath; + private String fArguments; + + private PromptInfo( String hostPath, String targetPath, String args ) { + super(); + fHostPath = hostPath; + fTargetPath = targetPath; + fArguments = args; + } + + String getHostPath() { + return fHostPath; + } + + String getTargetPath() { + return fTargetPath; + } + + String getArguments() { + return fArguments; + } + } + + private final GdbLaunch fLaunch; + private final DsfExecutor fExecutor; + private final DsfServicesTracker fTracker; + + public GdbDebugNewExecutableCommand( DsfSession session, GdbLaunch launch ) { + super(); + fLaunch = launch; + fExecutor = session.getExecutor(); + fTracker = new DsfServicesTracker( GdbUIPlugin.getBundleContext(), session.getId() ); + } + + public boolean canDebugNewExecutable() { + + Query canDebugQuery = new Query() { + @Override + public void execute( DataRequestMonitor rm ) { + IProcesses procService = fTracker.getService( IProcesses.class ); + IGDBBackend backend = fTracker.getService( IGDBBackend.class ); + ICommandControlService commandControl = fTracker.getService( ICommandControlService.class ); + + if ( procService == null || commandControl == null || backend == null ) { + rm.setData( false ); + rm.done(); + return; + } + procService.isDebugNewProcessSupported( commandControl.getContext(), rm ); + } + }; + try { + fExecutor.execute( canDebugQuery ); + return canDebugQuery.get(); + } + catch( InterruptedException e ) { + } + catch( ExecutionException e ) { + } + catch( RejectedExecutionException e ) { + // Can be thrown if the session is shutdown + } + return false; + } + + public void debugNewExecutable( final RequestMonitor rm ) { + IGDBBackend backend = fTracker.getService( IGDBBackend.class ); + final IProcesses procService = fTracker.getService( IProcesses.class ); + final ICommandControlService commandControl = fTracker.getService( ICommandControlService.class ); + if ( backend == null || procService == null || commandControl == null ) { + rm.setStatus( new Status( IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service is not available" ) ); //$NON-NLS-1$ + rm.done(); + return; + } + + PromptJob job = new PromptJob( + backend.getSessionType() == SessionType.REMOTE, + new DataRequestMonitor( fExecutor, rm ){ + + @Override + protected void handleCancel() { + rm.cancel(); + rm.done(); + }; + + @Override + protected void handleSuccess() { + try { + @SuppressWarnings( "unchecked" ) + final Map attributes = + new HashMap( getLaunchConfiguration().getAttributes() ); + attributes.put( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_BINARY, getData().getTargetPath() ); + attributes.put( ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, getData().getArguments() ); + procService.debugNewProcess( + commandControl.getContext(), + getData().getHostPath(), + attributes, + new ImmediateDataRequestMonitor( rm ) ); + } + catch( CoreException e ) { + rm.setStatus( e.getStatus() ); + rm.done(); + } + }; + } ); + job.schedule(); + } + + @Override + protected void doExecute( Object[] targets, IProgressMonitor monitor, IRequest request ) throws CoreException { + Query query = new Query() { + + @Override + protected void execute( DataRequestMonitor rm ) { + debugNewExecutable( rm ); + } + }; + try { + fExecutor.execute( query ); + query.get(); + } + catch( InterruptedException e ) { + } + catch( ExecutionException e ) { + } + catch( CancellationException e ) { + // Nothing to do, just ignore the command since the user + // cancelled it. + } + catch( RejectedExecutionException e ) { + // Can be thrown if the session is shutdown + } + } + + @Override + protected boolean isExecutable( Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request ) throws CoreException { + return canDebugNewExecutable(); + } + + @Override + protected Object getTarget( Object element ) { + if ( element instanceof GdbLaunch || element instanceof IDMVMContext ) + return element; + return null; + } + + public void dispose() { + fTracker.dispose(); + } + + private ILaunchConfiguration getLaunchConfiguration() { + return fLaunch.getLaunchConfiguration(); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java new file mode 100644 index 00000000000..b5c9461dd53 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.dsf.gdb.internal.ui.commands; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + + public static String GdbDebugNewExecutableCommand_Arguments; + + public static String GdbDebugNewExecutableCommand_Binary; + + public static String GdbDebugNewExecutableCommand_Binary_file_does_not_exist; + + public static String GdbDebugNewExecutableCommand_Binary_on_host; + + public static String GdbDebugNewExecutableCommand_Binary_on_target; + + public static String GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified; + + public static String GdbDebugNewExecutableCommand_Browse; + + public static String GdbDebugNewExecutableCommand_Debug_New_Executable; + + public static String GdbDebugNewExecutableCommand_Invalid_binary; + + public static String GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target; + + public static String GdbDebugNewExecutableCommand_Select_Binary; + + public static String GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments; + static { + // initialize resource bundle + NLS.initializeMessages( Messages.class.getName(), Messages.class ); + } + + private Messages() { + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.properties new file mode 100644 index 00000000000..bc56895950e --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.properties @@ -0,0 +1,12 @@ +GdbDebugNewExecutableCommand_Arguments=Arguments: +GdbDebugNewExecutableCommand_Binary=Binary: +GdbDebugNewExecutableCommand_Binary_file_does_not_exist=Binary file does not exist +GdbDebugNewExecutableCommand_Binary_on_host=Binary on host: +GdbDebugNewExecutableCommand_Binary_on_target=Binary on target: +GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified=Binary on target must be specified +GdbDebugNewExecutableCommand_Browse=Browse... +GdbDebugNewExecutableCommand_Debug_New_Executable=Debug New Executable +GdbDebugNewExecutableCommand_Invalid_binary=Invalid binary +GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target=Select binaries on the host and the target and specify the arguments +GdbDebugNewExecutableCommand_Select_Binary=Select Binary +GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments=Select a binary and specify the arguments diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java index 0f1cf56d63b..74bdabda65e 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java @@ -114,6 +114,13 @@ public class IGDBLaunchConfigurationConstants { */ public static final String ATTR_DEBUGGER_TRACEPOINT_MODE = GdbPlugin.PLUGIN_ID + ".TRACEPOINT_MODE"; //$NON-NLS-1$ + /** + * Launch configuration attribute key. The value is a String specifying the path of the executable + * on the target. + * @since 4.2 + */ + public static final String ATTR_DEBUGGER_REMOTE_BINARY = GdbPlugin.PLUGIN_ID + ".REMOTE_BINARY"; //$NON-NLS-1$ + /** * Launch configuration attribute value. The key is ATTR_DEBUG_NAME. */ diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java index 87c79a79e94..efaa5bdb475 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java @@ -19,6 +19,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.RejectedExecutionException; import org.eclipse.cdt.debug.core.model.IConnectHandler; +import org.eclipse.cdt.debug.core.model.IDebugNewExecutableHandler; import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor; import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor; import org.eclipse.cdt.dsf.concurrent.DsfExecutor; @@ -295,7 +296,10 @@ public class GdbLaunch extends DsfLaunch if (adapter.equals(IConnectHandler.class)) return getSession().getModelAdapter(adapter); - // Must force adapters to be loaded. + if (adapter.equals(IDebugNewExecutableHandler.class)) + return getSession().getModelAdapter(adapter); + + // Must force adapters to be loaded. Platform.getAdapterManager().loadAdapter(this, adapter.getName()); return super.getAdapter(adapter); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java index ba0797d0f3b..acd2c10c2cc 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java @@ -200,9 +200,13 @@ public class DebugNewProcessSequence extends ReflectionSequence { @Execute public void stepSetArguments(RequestMonitor rm) { try { - String args = fBackend.getProgramArguments(); + String args = CDebugUtils.getAttribute( + fAttributes, + ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, + ""); //$NON-NLS-1$ - if (args != null) { + if (args.length() != 0) { + args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(args); String[] argArray = CommandLineUtil.argumentsToArray(args); fCommandControl.queueCommand( fCommandFactory.createMIGDBSetArgs(getContainerContext(), argArray), diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java index c7238712b59..0f6d5628df2 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java @@ -15,15 +15,19 @@ import java.util.Arrays; import java.util.List; import java.util.Map; +import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DsfExecutor; import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.datamodel.IDMContext; +import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -40,14 +44,37 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence { private IGDBControl fGdbControl; private IGDBProcesses fProcService; + private IGDBBackend fBackend; + private CommandFactory fCommandFactory; private String fSessionId; private final boolean fInitialProcess; + private final Map fAttributes; - public DebugNewProcessSequence_7_2(DsfExecutor executor, boolean isInitial, IDMContext dmc, String file, - Map attributes, DataRequestMonitor rm) { - super(executor, isInitial, dmc, file, attributes, rm); + public DebugNewProcessSequence_7_2( + DsfExecutor executor, + boolean isInitial, + IDMContext dmc, + String file, + Map attributes, + DataRequestMonitor rm) { + this(executor, isInitial, dmc, file, null, attributes, rm); + } + + /** + * @since 4.2 + */ + public DebugNewProcessSequence_7_2( + DsfExecutor executor, + boolean isInitial, + IDMContext dmc, + String fileOnHost, + String fileOnTarget, + Map attributes, + DataRequestMonitor rm) { + super(executor, isInitial, dmc, fileOnHost, attributes, rm); fSessionId = dmc.getSessionId(); fInitialProcess = isInitial; + fAttributes = attributes; } @Override @@ -60,13 +87,14 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence { // Now insert our steps right after the initialization of the base class. orderList.add(orderList.indexOf("stepInitializeBaseSequence") + 1, "stepInitializeSequence_7_2"); //$NON-NLS-1$ //$NON-NLS-2$ orderList.add(orderList.indexOf("stepInitializeSequence_7_2") + 1, "stepAddInferior"); //$NON-NLS-1$ //$NON-NLS-2$ + orderList.add(orderList.indexOf("stepSetExecutable") + 1, "stepSetRemoteExecutable"); //$NON-NLS-1$ //$NON-NLS-2$ return orderList.toArray(new String[orderList.size()]); } return null; } - + /** * Initialize the members of the DebugNewProcessSequence_7_2 class. * This step is mandatory for the rest of the sequence to complete. @@ -76,14 +104,17 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence { DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fSessionId); fGdbControl = tracker.getService(IGDBControl.class); fProcService = tracker.getService(IGDBProcesses.class); + fBackend = tracker.getService(IGDBBackend.class); tracker.dispose(); - if (fGdbControl == null || fProcService == null) { + if (fGdbControl == null || fProcService == null || fBackend == null) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot obtain service", null)); //$NON-NLS-1$ rm.done(); return; } + fCommandFactory = fGdbControl.getCommandFactory(); + rm.done(); } @@ -119,5 +150,37 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence { rm.done(); } }); + } + + /** + * Set remote executable. + * @since 4.2 + */ + @Execute + public void stepSetRemoteExecutable(final RequestMonitor rm) { + if (fBackend.getSessionType() == SessionType.REMOTE && fBackend.getIsAttachSession()) { + String remoteBinary = CDebugUtils.getAttribute( + fAttributes, + IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_BINARY, + ""); //$NON-NLS-1$ + if (remoteBinary.length() == 0) { + rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Binary on host is not specified")); //$NON-NLS-1$ + rm.done(); + return; + } + + fGdbControl.queueCommand( + fCommandFactory.createMIGDBSet( + getContainerContext(), + new String[] { + "remote", //$NON-NLS-1$ + "exec-file", //$NON-NLS-1$ + remoteBinary, + }), + new ImmediateDataRequestMonitor(rm)); + } + else { + rm.done(); } } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java index d9ab8bc5851..3b1a28f160f 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java @@ -469,10 +469,13 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 { return false; } - // We don't yet support starting a new process on a remote target - // Bug 344890 - if (type == SessionType.REMOTE && fBackend.getIsAttachSession()) { - return false; + // Multi-process does not work for all-stop right now + IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class); + if (runControl != null && runControl.getRunMode() == MIRunMode.ALL_STOP) { + // Only one process is allowed in all-stop (for now) + return getNumConnected() == 0; + // NOTE: when we support multi-process in all-stop mode, + // we will need to interrupt the target to when doing the attach. } return true; diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java index 6f8a2fd69fd..43d5866263a 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java @@ -296,11 +296,9 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence { */ @Execute public void stepCreateConsole(final RequestMonitor rm) { - if (fBackend.getSessionType() == SessionType.REMOTE && !fBackend.getIsAttachSession()) { - // Remote non-attach sessions don't support multi-process and therefore will not - // start new processes. Those sessions will only start the one process, which should - // not have a console, because it's output is handled by GDB server. Therefore, - // no need to create an inferior process and add it to the launch + if (fBackend.getSessionType() == SessionType.REMOTE) { + // The program output for a remote session is handled by gdbserver. Therefore, + // no need to create an inferior process and add it to the launch. rm.done(); return; } From 629232eae1147d14b734fb80debb84752f0ec9e3 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 21 Jan 2013 14:33:27 -0500 Subject: [PATCH 2/6] Revert "Bug 344890 - [remote] Cannot start a new process on a remote target with extended-remote" This reverts commit 6f37c7a91426eddcfa8afd7b7e4b41a5daa522be. --- .../model/IDebugNewExecutableHandler.java | 22 - .../icons/obj16/new_exec.gif | Bin 949 -> 0 bytes .../plugin.properties | 6 - debug/org.eclipse.cdt.debug.ui/plugin.xml | 33 +- .../commands/DebugNewExecutableHandler.java | 23 -- .../gdb/internal/ui/GdbAdapterFactory.java | 6 - .../GdbDebugNewExecutableCommand.java | 375 ------------------ .../gdb/internal/ui/commands/Messages.java | 48 --- .../internal/ui/commands/Messages.properties | 12 - .../gdb/IGDBLaunchConfigurationConstants.java | 7 - .../cdt/dsf/gdb/launching/GdbLaunch.java | 6 +- .../gdb/service/DebugNewProcessSequence.java | 8 +- .../service/DebugNewProcessSequence_7_2.java | 73 +--- .../cdt/dsf/gdb/service/GDBProcesses_7_2.java | 11 +- .../StartOrRestartProcessSequence_7_0.java | 8 +- 15 files changed, 18 insertions(+), 620 deletions(-) delete mode 100644 debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDebugNewExecutableHandler.java delete mode 100755 debug/org.eclipse.cdt.debug.ui/icons/obj16/new_exec.gif delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/DebugNewExecutableHandler.java delete mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java delete mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java delete mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.properties diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDebugNewExecutableHandler.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDebugNewExecutableHandler.java deleted file mode 100644 index ecde45f0427..00000000000 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDebugNewExecutableHandler.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mentor Graphics and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Mentor Graphics - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.core.model; - -import org.eclipse.debug.core.commands.IDebugCommandHandler; - -/** - * Command handler for the "Debug New Executable" command. - * - * @since 7.3 - */ -public interface IDebugNewExecutableHandler extends IDebugCommandHandler { -} diff --git a/debug/org.eclipse.cdt.debug.ui/icons/obj16/new_exec.gif b/debug/org.eclipse.cdt.debug.ui/icons/obj16/new_exec.gif deleted file mode 100755 index 78ca91c6dab7edd4ab90789a10e3b9f7306eb2a8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 949 zcmYk5F^C>S5QX2tY3^cTPAo*QxkO^I7Re3d6w&I?C>A2wGI(hol0vZ(NwXve3UUNv zicF;j1l=ZLnTVkEs{&hD3dtp%L=H@l=l)iiZW!2o^Sw83z5V7Zubx}O8ty*A{}lj% z1OylbD1kzhL=lQnff}epO;n*84QPQzv_un{(SaW5L{D^~8v_`DL5#!@hUeRGz=RVP zJR1Zez(58xXHgI(qA*HEQ4~i-)QHNc8C6jo4bdVRqh&Njb96+H=!~Ax72PoqBVsT{ z#!w805som!8CH1em}>_?A_+}dEMN&1vLuUG%nH_EC2O*Z)ofr3HnJs~*vt<0U?+RB zi`^XH2o7>2hd4}w4w`h*q9=k$JQ7S~LX$`qWQi=yl3A3+S&=oeGHYg4R%b)D$i{4$ zP1&3s*&{o%XLeYN%2* zRi$b*sD&EUQcY@BhkB?}J=LXd4QPZ0HBv(wmLZ2sIc3RS1Yx={kxX54IHOSD5-xN} z7rEFKuHj18bd{^!;1+IlOEy_jH%LJ>U@@^hghREIyk-n{H3!bMM(dUhDrX zFD=Bpyf}o#OWZT);y%U`eP T^3(og>(7%nKG<1W!fXElGQ-Y4 diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties index 2266d66e86e..34cbb7d2d35 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.properties +++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties @@ -242,9 +242,3 @@ OpenNewView.name = Open New View # Disassembly Ruler Column extension point extPoint.disassemblyRulerColumn=Disassembly Ruler Column - -# Debug New Executable Command -DebugNewExecutable.name=Debug New Executable -DebugNewExecutable.description=Debug a new executable -DebugNewExecutable.label=Debug New Executable... -DebugNewExecutable.tooltip=Debug a new executable diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index d2b3fc1b6f1..0188aa81f49 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -2012,12 +2012,7 @@ id="org.eclipse.cdt.debug.ui.command.connect" name="%Connect.name"> - - + @@ -2084,10 +2079,6 @@ class="org.eclipse.cdt.debug.internal.ui.commands.ConnectCommandHandler" commandId="org.eclipse.cdt.debug.ui.command.connect"> - - @@ -2529,28 +2520,6 @@ - - - - - getCommandType() { - return IDebugNewExecutableHandler.class; - } -} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java index ac16701c062..a35c0913306 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java @@ -19,7 +19,6 @@ import java.util.WeakHashMap; import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.IConnectHandler; -import org.eclipse.cdt.debug.core.model.IDebugNewExecutableHandler; import org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler; import org.eclipse.cdt.debug.core.model.IReverseResumeHandler; import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler; @@ -50,7 +49,6 @@ import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbDisconnectCommand; import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbRestartCommand; import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbSteppingModeTarget; import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbConnectCommand; -import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbDebugNewExecutableCommand; import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbResumeWithoutSignalCommand; import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseResumeCommand; import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseStepIntoCommand; @@ -116,7 +114,6 @@ public class GdbAdapterFactory final GdbResumeWithoutSignalCommand fResumeWithoutSignalCommand; final GdbRestartCommand fRestartCommand; final DsfTerminateCommand fTerminateCommand; - final GdbDebugNewExecutableCommand fDebugNewExecutableCommand; final GdbConnectCommand fConnectCommand; final GdbDisconnectCommand fDisconnectCommand; final IDebugModelProvider fDebugModelProvider; @@ -165,7 +162,6 @@ public class GdbAdapterFactory fResumeWithoutSignalCommand = new GdbResumeWithoutSignalCommand(session); fRestartCommand = new GdbRestartCommand(session, fLaunch); fTerminateCommand = new DsfTerminateCommand(session); - fDebugNewExecutableCommand = new GdbDebugNewExecutableCommand(session, fLaunch); fConnectCommand = new GdbConnectCommand(session); fDisconnectCommand = new GdbDisconnectCommand(session); fSuspendTrigger = new GdbSuspendTrigger(session, fLaunch); @@ -193,7 +189,6 @@ public class GdbAdapterFactory session.registerModelAdapter(IRestartHandler.class, fRestartCommand); session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand); session.registerModelAdapter(IConnectHandler.class, fConnectCommand); - session.registerModelAdapter(IDebugNewExecutableHandler.class, fDebugNewExecutableCommand); session.registerModelAdapter(IDisconnectHandler.class, fDisconnectCommand); session.registerModelAdapter(IModelSelectionPolicyFactory.class, fModelSelectionPolicyFactory); session.registerModelAdapter(IRefreshAllTarget.class, fRefreshAllTarget); @@ -254,7 +249,6 @@ public class GdbAdapterFactory session.unregisterModelAdapter(IRestartHandler.class); session.unregisterModelAdapter(ITerminateHandler.class); session.unregisterModelAdapter(IConnectHandler.class); - session.unregisterModelAdapter(IDebugNewExecutableHandler.class); session.unregisterModelAdapter(IDisconnectHandler.class); session.unregisterModelAdapter(IModelSelectionPolicyFactory.class); session.unregisterModelAdapter(IRefreshAllTarget.class); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java deleted file mode 100644 index b4a366cca9f..00000000000 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbDebugNewExecutableCommand.java +++ /dev/null @@ -1,375 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mentor Graphics and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Mentor Graphics - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.dsf.gdb.internal.ui.commands; - -import java.io.File; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.CancellationException; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.RejectedExecutionException; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.model.IDebugNewExecutableHandler; -import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; -import org.eclipse.cdt.dsf.concurrent.DsfExecutor; -import org.eclipse.cdt.dsf.concurrent.DsfRunnable; -import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor; -import org.eclipse.cdt.dsf.concurrent.Query; -import org.eclipse.cdt.dsf.concurrent.RequestMonitor; -import org.eclipse.cdt.dsf.datamodel.IDMContext; -import org.eclipse.cdt.dsf.debug.service.IProcesses; -import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; -import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; -import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; -import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch; -import org.eclipse.cdt.dsf.gdb.service.IGDBBackend; -import org.eclipse.cdt.dsf.gdb.service.SessionType; -import org.eclipse.cdt.dsf.service.DsfServicesTracker; -import org.eclipse.cdt.dsf.service.DsfSession; -import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.IRequest; -import org.eclipse.debug.core.commands.AbstractDebugCommand; -import org.eclipse.debug.core.commands.IEnabledStateRequest; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.progress.UIJob; - -public class GdbDebugNewExecutableCommand extends AbstractDebugCommand implements IDebugNewExecutableHandler { - - private class PromptJob extends UIJob { - - private DataRequestMonitor fRequestMonitor; - private boolean fRemote = false; - - private PromptJob( boolean remote, DataRequestMonitor rm ) { - super( "New Executable Prompt Job" ); //$NON-NLS-1$ - fRemote = remote; - fRequestMonitor = rm; - } - - @Override - public IStatus runInUIThread( IProgressMonitor monitor ) { - int flags = ( fRemote ) ? NewExecutableDialog.REMOTE : 0; - NewExecutableDialog dialog = new NewExecutableDialog( GdbUIPlugin.getShell(), flags ); - final boolean canceled = dialog.open() == Window.CANCEL; - final PromptInfo info = dialog.getInfo(); - fExecutor.execute( new DsfRunnable() { - - @Override - public void run() { - if ( canceled ) - fRequestMonitor.cancel(); - else - fRequestMonitor.setData( info ); - fRequestMonitor.done(); - } - } ); - return Status.OK_STATUS; - } - } - - private class NewExecutableDialog extends TitleAreaDialog { - - private static final int REMOTE = 0x1; - - private int fFlags = 0; - private PromptInfo fInfo = null; - - private Text fHostBinaryText; - private Text fTargetBinaryText; - private Text fArgumentsText; - - private NewExecutableDialog( Shell parentShell, int flags ) { - super( parentShell ); - setShellStyle( getShellStyle() | SWT.RESIZE ); - fFlags = flags; - } - - @Override - protected Control createContents( Composite parent ) { - Control control = super.createContents( parent ); - validate(); - return control; - } - - @Override - protected Control createDialogArea( Composite parent ) { - boolean remote = (fFlags & REMOTE) > 0; - - getShell().setText( Messages.GdbDebugNewExecutableCommand_Debug_New_Executable ); - setTitle( Messages.GdbDebugNewExecutableCommand_Select_Binary ); - String message = ( remote ) ? - Messages.GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target : - Messages.GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments; - setMessage( message ); - - Composite control = (Composite)super.createDialogArea( parent ); - Composite comp = new Composite( control, SWT.NONE ); - GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true ); - GridLayout layout = new GridLayout( 3, false ); - comp.setLayout( layout ); - comp.setLayoutData( gd ); - - new Label( comp, SWT.None ).setText( remote ? Messages.GdbDebugNewExecutableCommand_Binary_on_host : Messages.GdbDebugNewExecutableCommand_Binary ); - fHostBinaryText = new Text( comp, SWT.BORDER ); - fHostBinaryText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) ); - fHostBinaryText.addModifyListener( new ModifyListener() { - - @Override - public void modifyText( ModifyEvent e ) { - validate(); - } - } ); - Button browseButton = new Button( comp, SWT.PUSH ); - browseButton.setText( Messages.GdbDebugNewExecutableCommand_Browse ); - browseButton.setFont( JFaceResources.getDialogFont() ); - setButtonLayoutData( browseButton ); - browseButton.addSelectionListener( new SelectionAdapter() { - - @Override - public void widgetSelected( SelectionEvent e ) { - FileDialog dialog = new FileDialog( getShell() ); - dialog.setFileName( fHostBinaryText.getText() ); - String result = dialog.open(); - if ( result != null ) { - fHostBinaryText.setText( result ); - } - } - } ); - - if ( remote ) { - new Label( comp, SWT.None ).setText( Messages.GdbDebugNewExecutableCommand_Binary_on_target ); - fTargetBinaryText = new Text( comp, SWT.BORDER ); - fTargetBinaryText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) ); - fTargetBinaryText.addModifyListener( new ModifyListener() { - - @Override - public void modifyText( ModifyEvent e ) { - validate(); - } - } ); - } - - new Label( comp, SWT.None ).setText( Messages.GdbDebugNewExecutableCommand_Arguments ); - fArgumentsText = new Text( comp, SWT.BORDER ); - fArgumentsText.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) ); - - return control; - } - - @Override - protected void okPressed() { - String targetPath = ( fTargetBinaryText != null ) ? fTargetBinaryText.getText().trim() : null; - String args = fArgumentsText.getText().trim(); - fInfo = new PromptInfo( fHostBinaryText.getText().trim(), targetPath, args ); - super.okPressed(); - } - - private PromptInfo getInfo() { - return fInfo; - } - - private void validate() { - String message = null; - String hostBinary = fHostBinaryText.getText().trim(); - File file = new File( hostBinary ); - if ( !file.exists() ) - message = Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist; - else if ( file.isDirectory() ) - message = Messages.GdbDebugNewExecutableCommand_Invalid_binary; - if ( fTargetBinaryText != null ) { - if ( fTargetBinaryText.getText().trim().length() == 0 ) - message = Messages.GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified; - } - setErrorMessage( message ); - getButton( IDialogConstants.OK_ID ).setEnabled( message == null ); - } - } - - private class PromptInfo { - private String fHostPath; - private String fTargetPath; - private String fArguments; - - private PromptInfo( String hostPath, String targetPath, String args ) { - super(); - fHostPath = hostPath; - fTargetPath = targetPath; - fArguments = args; - } - - String getHostPath() { - return fHostPath; - } - - String getTargetPath() { - return fTargetPath; - } - - String getArguments() { - return fArguments; - } - } - - private final GdbLaunch fLaunch; - private final DsfExecutor fExecutor; - private final DsfServicesTracker fTracker; - - public GdbDebugNewExecutableCommand( DsfSession session, GdbLaunch launch ) { - super(); - fLaunch = launch; - fExecutor = session.getExecutor(); - fTracker = new DsfServicesTracker( GdbUIPlugin.getBundleContext(), session.getId() ); - } - - public boolean canDebugNewExecutable() { - - Query canDebugQuery = new Query() { - @Override - public void execute( DataRequestMonitor rm ) { - IProcesses procService = fTracker.getService( IProcesses.class ); - IGDBBackend backend = fTracker.getService( IGDBBackend.class ); - ICommandControlService commandControl = fTracker.getService( ICommandControlService.class ); - - if ( procService == null || commandControl == null || backend == null ) { - rm.setData( false ); - rm.done(); - return; - } - procService.isDebugNewProcessSupported( commandControl.getContext(), rm ); - } - }; - try { - fExecutor.execute( canDebugQuery ); - return canDebugQuery.get(); - } - catch( InterruptedException e ) { - } - catch( ExecutionException e ) { - } - catch( RejectedExecutionException e ) { - // Can be thrown if the session is shutdown - } - return false; - } - - public void debugNewExecutable( final RequestMonitor rm ) { - IGDBBackend backend = fTracker.getService( IGDBBackend.class ); - final IProcesses procService = fTracker.getService( IProcesses.class ); - final ICommandControlService commandControl = fTracker.getService( ICommandControlService.class ); - if ( backend == null || procService == null || commandControl == null ) { - rm.setStatus( new Status( IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service is not available" ) ); //$NON-NLS-1$ - rm.done(); - return; - } - - PromptJob job = new PromptJob( - backend.getSessionType() == SessionType.REMOTE, - new DataRequestMonitor( fExecutor, rm ){ - - @Override - protected void handleCancel() { - rm.cancel(); - rm.done(); - }; - - @Override - protected void handleSuccess() { - try { - @SuppressWarnings( "unchecked" ) - final Map attributes = - new HashMap( getLaunchConfiguration().getAttributes() ); - attributes.put( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_BINARY, getData().getTargetPath() ); - attributes.put( ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, getData().getArguments() ); - procService.debugNewProcess( - commandControl.getContext(), - getData().getHostPath(), - attributes, - new ImmediateDataRequestMonitor( rm ) ); - } - catch( CoreException e ) { - rm.setStatus( e.getStatus() ); - rm.done(); - } - }; - } ); - job.schedule(); - } - - @Override - protected void doExecute( Object[] targets, IProgressMonitor monitor, IRequest request ) throws CoreException { - Query query = new Query() { - - @Override - protected void execute( DataRequestMonitor rm ) { - debugNewExecutable( rm ); - } - }; - try { - fExecutor.execute( query ); - query.get(); - } - catch( InterruptedException e ) { - } - catch( ExecutionException e ) { - } - catch( CancellationException e ) { - // Nothing to do, just ignore the command since the user - // cancelled it. - } - catch( RejectedExecutionException e ) { - // Can be thrown if the session is shutdown - } - } - - @Override - protected boolean isExecutable( Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request ) throws CoreException { - return canDebugNewExecutable(); - } - - @Override - protected Object getTarget( Object element ) { - if ( element instanceof GdbLaunch || element instanceof IDMVMContext ) - return element; - return null; - } - - public void dispose() { - fTracker.dispose(); - } - - private ILaunchConfiguration getLaunchConfiguration() { - return fLaunch.getLaunchConfiguration(); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java deleted file mode 100644 index b5c9461dd53..00000000000 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mentor Graphics and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Mentor Graphics - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.dsf.gdb.internal.ui.commands; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - - public static String GdbDebugNewExecutableCommand_Arguments; - - public static String GdbDebugNewExecutableCommand_Binary; - - public static String GdbDebugNewExecutableCommand_Binary_file_does_not_exist; - - public static String GdbDebugNewExecutableCommand_Binary_on_host; - - public static String GdbDebugNewExecutableCommand_Binary_on_target; - - public static String GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified; - - public static String GdbDebugNewExecutableCommand_Browse; - - public static String GdbDebugNewExecutableCommand_Debug_New_Executable; - - public static String GdbDebugNewExecutableCommand_Invalid_binary; - - public static String GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target; - - public static String GdbDebugNewExecutableCommand_Select_Binary; - - public static String GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments; - static { - // initialize resource bundle - NLS.initializeMessages( Messages.class.getName(), Messages.class ); - } - - private Messages() { - } -} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.properties deleted file mode 100644 index bc56895950e..00000000000 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/Messages.properties +++ /dev/null @@ -1,12 +0,0 @@ -GdbDebugNewExecutableCommand_Arguments=Arguments: -GdbDebugNewExecutableCommand_Binary=Binary: -GdbDebugNewExecutableCommand_Binary_file_does_not_exist=Binary file does not exist -GdbDebugNewExecutableCommand_Binary_on_host=Binary on host: -GdbDebugNewExecutableCommand_Binary_on_target=Binary on target: -GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified=Binary on target must be specified -GdbDebugNewExecutableCommand_Browse=Browse... -GdbDebugNewExecutableCommand_Debug_New_Executable=Debug New Executable -GdbDebugNewExecutableCommand_Invalid_binary=Invalid binary -GdbDebugNewExecutableCommand_Select_binaries_on_host_and_target=Select binaries on the host and the target and specify the arguments -GdbDebugNewExecutableCommand_Select_Binary=Select Binary -GdbDebugNewExecutableCommand_Select_binary_and_specify_arguments=Select a binary and specify the arguments diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java index 74bdabda65e..0f1cf56d63b 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java @@ -114,13 +114,6 @@ public class IGDBLaunchConfigurationConstants { */ public static final String ATTR_DEBUGGER_TRACEPOINT_MODE = GdbPlugin.PLUGIN_ID + ".TRACEPOINT_MODE"; //$NON-NLS-1$ - /** - * Launch configuration attribute key. The value is a String specifying the path of the executable - * on the target. - * @since 4.2 - */ - public static final String ATTR_DEBUGGER_REMOTE_BINARY = GdbPlugin.PLUGIN_ID + ".REMOTE_BINARY"; //$NON-NLS-1$ - /** * Launch configuration attribute value. The key is ATTR_DEBUG_NAME. */ diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java index efaa5bdb475..87c79a79e94 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java @@ -19,7 +19,6 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.RejectedExecutionException; import org.eclipse.cdt.debug.core.model.IConnectHandler; -import org.eclipse.cdt.debug.core.model.IDebugNewExecutableHandler; import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor; import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor; import org.eclipse.cdt.dsf.concurrent.DsfExecutor; @@ -296,10 +295,7 @@ public class GdbLaunch extends DsfLaunch if (adapter.equals(IConnectHandler.class)) return getSession().getModelAdapter(adapter); - if (adapter.equals(IDebugNewExecutableHandler.class)) - return getSession().getModelAdapter(adapter); - - // Must force adapters to be loaded. + // Must force adapters to be loaded. Platform.getAdapterManager().loadAdapter(this, adapter.getName()); return super.getAdapter(adapter); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java index acd2c10c2cc..ba0797d0f3b 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java @@ -200,13 +200,9 @@ public class DebugNewProcessSequence extends ReflectionSequence { @Execute public void stepSetArguments(RequestMonitor rm) { try { - String args = CDebugUtils.getAttribute( - fAttributes, - ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, - ""); //$NON-NLS-1$ + String args = fBackend.getProgramArguments(); - if (args.length() != 0) { - args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(args); + if (args != null) { String[] argArray = CommandLineUtil.argumentsToArray(args); fCommandControl.queueCommand( fCommandFactory.createMIGDBSetArgs(getContainerContext(), argArray), diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java index 0f6d5628df2..c7238712b59 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence_7_2.java @@ -15,19 +15,15 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DsfExecutor; import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.datamodel.IDMContext; -import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl; -import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo; -import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -44,37 +40,14 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence { private IGDBControl fGdbControl; private IGDBProcesses fProcService; - private IGDBBackend fBackend; - private CommandFactory fCommandFactory; private String fSessionId; private final boolean fInitialProcess; - private final Map fAttributes; - public DebugNewProcessSequence_7_2( - DsfExecutor executor, - boolean isInitial, - IDMContext dmc, - String file, - Map attributes, - DataRequestMonitor rm) { - this(executor, isInitial, dmc, file, null, attributes, rm); - } - - /** - * @since 4.2 - */ - public DebugNewProcessSequence_7_2( - DsfExecutor executor, - boolean isInitial, - IDMContext dmc, - String fileOnHost, - String fileOnTarget, - Map attributes, - DataRequestMonitor rm) { - super(executor, isInitial, dmc, fileOnHost, attributes, rm); + public DebugNewProcessSequence_7_2(DsfExecutor executor, boolean isInitial, IDMContext dmc, String file, + Map attributes, DataRequestMonitor rm) { + super(executor, isInitial, dmc, file, attributes, rm); fSessionId = dmc.getSessionId(); fInitialProcess = isInitial; - fAttributes = attributes; } @Override @@ -87,14 +60,13 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence { // Now insert our steps right after the initialization of the base class. orderList.add(orderList.indexOf("stepInitializeBaseSequence") + 1, "stepInitializeSequence_7_2"); //$NON-NLS-1$ //$NON-NLS-2$ orderList.add(orderList.indexOf("stepInitializeSequence_7_2") + 1, "stepAddInferior"); //$NON-NLS-1$ //$NON-NLS-2$ - orderList.add(orderList.indexOf("stepSetExecutable") + 1, "stepSetRemoteExecutable"); //$NON-NLS-1$ //$NON-NLS-2$ return orderList.toArray(new String[orderList.size()]); } return null; } - + /** * Initialize the members of the DebugNewProcessSequence_7_2 class. * This step is mandatory for the rest of the sequence to complete. @@ -104,17 +76,14 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence { DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fSessionId); fGdbControl = tracker.getService(IGDBControl.class); fProcService = tracker.getService(IGDBProcesses.class); - fBackend = tracker.getService(IGDBBackend.class); tracker.dispose(); - if (fGdbControl == null || fProcService == null || fBackend == null) { + if (fGdbControl == null || fProcService == null) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot obtain service", null)); //$NON-NLS-1$ rm.done(); return; } - fCommandFactory = fGdbControl.getCommandFactory(); - rm.done(); } @@ -150,37 +119,5 @@ public class DebugNewProcessSequence_7_2 extends DebugNewProcessSequence { rm.done(); } }); - } - - /** - * Set remote executable. - * @since 4.2 - */ - @Execute - public void stepSetRemoteExecutable(final RequestMonitor rm) { - if (fBackend.getSessionType() == SessionType.REMOTE && fBackend.getIsAttachSession()) { - String remoteBinary = CDebugUtils.getAttribute( - fAttributes, - IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_BINARY, - ""); //$NON-NLS-1$ - if (remoteBinary.length() == 0) { - rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Binary on host is not specified")); //$NON-NLS-1$ - rm.done(); - return; - } - - fGdbControl.queueCommand( - fCommandFactory.createMIGDBSet( - getContainerContext(), - new String[] { - "remote", //$NON-NLS-1$ - "exec-file", //$NON-NLS-1$ - remoteBinary, - }), - new ImmediateDataRequestMonitor(rm)); - } - else { - rm.done(); } } -} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java index 3b1a28f160f..d9ab8bc5851 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java @@ -469,13 +469,10 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 { return false; } - // Multi-process does not work for all-stop right now - IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class); - if (runControl != null && runControl.getRunMode() == MIRunMode.ALL_STOP) { - // Only one process is allowed in all-stop (for now) - return getNumConnected() == 0; - // NOTE: when we support multi-process in all-stop mode, - // we will need to interrupt the target to when doing the attach. + // We don't yet support starting a new process on a remote target + // Bug 344890 + if (type == SessionType.REMOTE && fBackend.getIsAttachSession()) { + return false; } return true; diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java index 43d5866263a..6f8a2fd69fd 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java @@ -296,9 +296,11 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence { */ @Execute public void stepCreateConsole(final RequestMonitor rm) { - if (fBackend.getSessionType() == SessionType.REMOTE) { - // The program output for a remote session is handled by gdbserver. Therefore, - // no need to create an inferior process and add it to the launch. + if (fBackend.getSessionType() == SessionType.REMOTE && !fBackend.getIsAttachSession()) { + // Remote non-attach sessions don't support multi-process and therefore will not + // start new processes. Those sessions will only start the one process, which should + // not have a console, because it's output is handled by GDB server. Therefore, + // no need to create an inferior process and add it to the launch rm.done(); return; } From 975d6f48e23665ed9c15188f481839e80086a1f6 Mon Sep 17 00:00:00 2001 From: Randy Rohrbach Date: Mon, 21 Jan 2013 17:20:49 -0500 Subject: [PATCH 3/6] Bug 398329 : MemoryBrowser - switching between debuggees does not update the provider for browser operations like Import and Export Bug 398332 : The validation logic and feedback for all of the Importers/Exporters is very bad Added more error checking. See comments in the bugzillas for the details. --- .../memory/transport/PlainTextExporter.java | 25 ++++++++++------ .../memory/transport/PlainTextImporter.java | 23 +++++++++----- .../memory/transport/RAWBinaryExporter.java | 23 +++++++++----- .../memory/transport/RAWBinaryImporter.java | 23 +++++++++----- .../ui/memory/transport/SRecordExporter.java | 13 ++++---- .../ui/memory/transport/SRecordImporter.java | 30 +++++++++++-------- 6 files changed, 89 insertions(+), 48 deletions(-) diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java index ffeb18f5788..d6e5e1d9452 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java @@ -69,13 +69,17 @@ public class PlainTextExporter implements IMemoryExporter { @Override public void dispose() { - fProperties.put(TRANSFER_FILE, fFileText.getText()); - fProperties.put(TRANSFER_START, fStartText.getText()); - fProperties.put(TRANSFER_END, fEndText.getText()); + fProperties.put(TRANSFER_FILE, fFileText.getText().trim()); + fProperties.put(TRANSFER_START, fStartText.getText().trim()); + fProperties.put(TRANSFER_END, fEndText.getText().trim()); - fStartAddress = getStartAddress(); - fEndAddress = getEndAddress(); - fOutputFile = getFile(); + try + { + fStartAddress = getStartAddress(); + fEndAddress = getEndAddress(); + fOutputFile = getFile(); + } + catch(Exception e) {} super.dispose(); } @@ -203,7 +207,7 @@ public class PlainTextExporter implements IMemoryExporter { dialog.setText(Messages.getString("PlainTextExporter.ChooseFile")); //$NON-NLS-1$ dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$NON-NLS-1$ - dialog.setFileName(fFileText.getText()); + dialog.setFileName(fFileText.getText().trim()); dialog.open(); String filename = dialog.getFileName(); @@ -419,7 +423,7 @@ public class PlainTextExporter implements IMemoryExporter { public File getFile() { - return new File(fFileText.getText()); + return new File(fFileText.getText().trim()); } private void validate() @@ -436,6 +440,9 @@ public class PlainTextExporter implements IMemoryExporter { if(length.compareTo(BigInteger.ZERO) <= 0) isValid = false; + if ( fFileText.getText().trim().length() == 0 ) + isValid = false; + File file = getFile(); if ( file != null ) { File parentFile = file.getParentFile(); @@ -457,7 +464,7 @@ public class PlainTextExporter implements IMemoryExporter { fParentDialog.setValid(isValid); } - + public String getId() { return "PlainTextExporter"; //$NON-NLS-1$ diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java index acb587d00c2..c06fcfeb58e 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java @@ -76,13 +76,17 @@ public class PlainTextImporter implements IMemoryImporter { @Override public void dispose() { - fProperties.put(TRANSFER_FILE, fFileText.getText()); - fProperties.put(TRANSFER_START, fStartText.getText()); + fProperties.put(TRANSFER_FILE, fFileText.getText().trim()); + fProperties.put(TRANSFER_START, fStartText.getText().trim()); fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection()); - fStartAddress = getStartAddress(); - fInputFile = getFile(); - fScrollToStart = getScrollToStart(); + try + { + fStartAddress = getStartAddress(); + fInputFile = getFile(); + fScrollToStart = getScrollToStart(); + } + catch(Exception e) {} super.dispose(); } @@ -157,7 +161,7 @@ public class PlainTextImporter implements IMemoryImporter { dialog.setText(Messages.getString("PlainTextImporter.ChooseFile")); //$NON-NLS-1$ dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$NON-NLS-1$ - dialog.setFileName(fFileText.getText()); + dialog.setFileName(fFileText.getText().trim()); dialog.open(); String filename = dialog.getFileName(); @@ -226,6 +230,11 @@ public class PlainTextImporter implements IMemoryImporter { try { getStartAddress(); + + + if ( fFileText.getText().trim().length() == 0 ) + isValid = false; + if(!getFile().exists()) { isValid = false; } @@ -256,7 +265,7 @@ public class PlainTextImporter implements IMemoryImporter { public File getFile() { - return new File(fFileText.getText()); + return new File(fFileText.getText().trim()); } public String getId() diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java index 1f4190cafbd..801071fde49 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java @@ -69,13 +69,17 @@ public class RAWBinaryExporter implements IMemoryExporter @Override public void dispose() { - fProperties.put(TRANSFER_FILE, fFileText.getText()); - fProperties.put(TRANSFER_START, fStartText.getText()); - fProperties.put(TRANSFER_END, fEndText.getText()); + fProperties.put(TRANSFER_FILE, fFileText.getText().trim()); + fProperties.put(TRANSFER_START, fStartText.getText().trim()); + fProperties.put(TRANSFER_END, fEndText.getText().trim()); - fStartAddress = getStartAddress(); - fEndAddress = getEndAddress(); - fOutputFile = getFile(); + try + { + fStartAddress = getStartAddress(); + fEndAddress = getEndAddress(); + fOutputFile = getFile(); + } + catch(Exception e) {} super.dispose(); } @@ -204,7 +208,7 @@ public class RAWBinaryExporter implements IMemoryExporter dialog.setText(Messages.getString("RAWBinaryExporter.ChooseFile")); //$NON-NLS-1$ dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$NON-NLS-1$ - dialog.setFileName(fFileText.getText()); + dialog.setFileName(fFileText.getText().trim()); dialog.open(); String filename = dialog.getFileName(); @@ -421,7 +425,7 @@ public class RAWBinaryExporter implements IMemoryExporter public File getFile() { - return new File(fFileText.getText()); + return new File(fFileText.getText().trim()); } private void validate() @@ -438,6 +442,9 @@ public class RAWBinaryExporter implements IMemoryExporter if(length.compareTo(BigInteger.ZERO) <= 0) isValid = false; + if ( fFileText.getText().trim().length() == 0 ) + isValid = false; + File file = getFile(); if ( file != null ) { File parentFile = file.getParentFile(); diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java index 8d1ccb8c1b6..e1e2b7e7268 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java @@ -71,13 +71,17 @@ public class RAWBinaryImporter implements IMemoryImporter { @Override public void dispose() { - fProperties.put(TRANSFER_FILE, fFileText.getText()); - fProperties.put(TRANSFER_START, fStartText.getText()); + fProperties.put(TRANSFER_FILE, fFileText.getText().trim()); + fProperties.put(TRANSFER_START, fStartText.getText().trim()); fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection()); - fStartAddress = getStartAddress(); - fInputFile = getFile(); - fScrollToStart = getScrollToStart(); + try + { + fStartAddress = getStartAddress(); + fInputFile = getFile(); + fScrollToStart = getScrollToStart(); + } + catch(Exception e) {} super.dispose(); } @@ -137,7 +141,7 @@ public class RAWBinaryImporter implements IMemoryImporter { dialog.setText(Messages.getString("RAWBinaryImporter.ChooseFile")); //$NON-NLS-1$ dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$NON-NLS-1$ - dialog.setFileName(fFileText.getText()); + dialog.setFileName(fFileText.getText().trim()); dialog.open(); String filename = dialog.getFileName(); @@ -206,6 +210,11 @@ public class RAWBinaryImporter implements IMemoryImporter { try { getStartAddress(); + + + if ( fFileText.getText().trim().length() == 0 ) + isValid = false; + if(!getFile().exists()) { isValid = false; } @@ -236,7 +245,7 @@ public class RAWBinaryImporter implements IMemoryImporter { public File getFile() { - return new File(fFileText.getText()); + return new File(fFileText.getText().trim()); } public String getId() diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java index 9484110a842..870d0d20ba3 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java @@ -68,9 +68,9 @@ public class SRecordExporter implements IMemoryExporter { public void dispose() { - fProperties.put(TRANSFER_FILE, fFileText.getText()); - fProperties.put(TRANSFER_START, fStartText.getText()); - fProperties.put(TRANSFER_END, fEndText.getText()); + fProperties.put(TRANSFER_FILE, fFileText.getText().trim()); + fProperties.put(TRANSFER_START, fStartText.getText().trim()); + fProperties.put(TRANSFER_END, fEndText.getText().trim()); try { @@ -227,7 +227,7 @@ public class SRecordExporter implements IMemoryExporter dialog.setText(Messages.getString("SRecordExporter.ChooseFile")); //$NON-NLS-1$ dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$NON-NLS-1$ - dialog.setFileName(fFileText.getText()); + dialog.setFileName(fFileText.getText().trim()); dialog.open(); String filename = dialog.getFileName(); @@ -455,7 +455,7 @@ public class SRecordExporter implements IMemoryExporter public File getFile() { - return new File(fFileText.getText()); + return new File(fFileText.getText().trim()); } private void validate() @@ -472,6 +472,9 @@ public class SRecordExporter implements IMemoryExporter if(length.compareTo(BigInteger.ZERO) <= 0) isValid = false; + if ( fFileText.getText().trim().length() == 0 ) + isValid = false; + File file = getFile(); if ( file != null ) { File parentFile = file.getParentFile(); diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java index 56368d7b15c..3795cc6c9df 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java @@ -77,14 +77,20 @@ public class SRecordImporter implements IMemoryImporter { { public void dispose() { - fProperties.put(TRANSFER_FILE, fFileText.getText()); - fProperties.put(TRANSFER_START, fStartText.getText()); + fProperties.put(TRANSFER_FILE, fFileText.getText().trim()); + fProperties.put(TRANSFER_START, fStartText.getText().trim()); fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection()); fProperties.put(TRANSFER_CUSTOM_START_ADDRESS, fComboRestoreToThisAddress.getSelection()); - fStartAddress = getStartAddress(); - fInputFile = getFile(); - fScrollToStart = getScrollToStart(); + try + { + if(fProperties.getBoolean(TRANSFER_CUSTOM_START_ADDRESS)) { + fStartAddress = getStartAddress(); + } + fInputFile = getFile(); + fScrollToStart = getScrollToStart(); + } + catch(Exception e) {} super.dispose(); } @@ -187,7 +193,7 @@ public class SRecordImporter implements IMemoryImporter { dialog.setText(Messages.getString("SRecordImporter.ChooseFile")); //$NON-NLS-1$ dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$NON-NLS-1$ - dialog.setFileName(fFileText.getText()); + dialog.setFileName(fFileText.getText().trim()); dialog.open(); String filename = dialog.getFileName(); @@ -289,11 +295,11 @@ public class SRecordImporter implements IMemoryImporter { getStartAddress(); } - boolean restoreToAddressFromFile = fComboRestoreToFileAddress.getSelection(); - if ( restoreToAddressFromFile ) { - if(!getFile().exists()) { - isValid = false; - } + if ( fFileText.getText().trim().length() == 0 ) + isValid = false; + + if(!getFile().exists()) { + isValid = false; } } catch(Exception e) @@ -327,7 +333,7 @@ public class SRecordImporter implements IMemoryImporter { public File getFile() { - return new File(fFileText.getText()); + return new File(fFileText.getText().trim()); } public String getId() From 911f69b92e2e505cad33d6d730abb95a308d298f Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Mon, 21 Jan 2013 14:58:13 -0500 Subject: [PATCH 4/6] bug 398681: Cosmetics - Renamed a few of tests --- .../xlc/tests/AllXlcErrorParserTests.java | 22 +++++++++---------- .../{TestMissingArg.java => TestError_1.java} | 4 ++-- ...l.java => TestInformationalMessage_1.java} | 4 ++-- ...yntaxError.java => TestSevereError_1.java} | 4 ++-- ...ndeclIdent.java => TestSevereError_2.java} | 4 ++-- ...atingPoint.java => TestSevereError_3.java} | 4 ++-- ...estFuncArg.java => TestSevereError_4.java} | 4 ++-- ...stOperModi.java => TestSevereError_5.java} | 4 ++-- ...ror.java => TestUnrecoverableError_1.java} | 4 ++-- ...estNoFuncProto.java => TestWarning_1.java} | 4 ++-- 10 files changed, 29 insertions(+), 29 deletions(-) rename xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/{TestMissingArg.java => TestError_1.java} (94%) rename xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/{TestConditional.java => TestInformationalMessage_1.java} (92%) rename xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/{TestSyntaxError.java => TestSevereError_1.java} (93%) rename xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/{TestUndeclIdent.java => TestSevereError_2.java} (93%) rename xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/{TestFloatingPoint.java => TestSevereError_3.java} (93%) rename xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/{TestFuncArg.java => TestSevereError_4.java} (94%) rename xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/{TestOperModi.java => TestSevereError_5.java} (93%) rename xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/{TestUnrecoverableError.java => TestUnrecoverableError_1.java} (92%) rename xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/{TestNoFuncProto.java => TestWarning_1.java} (93%) diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java index f8973e86fb7..2b01874b439 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java @@ -19,19 +19,19 @@ public class AllXlcErrorParserTests { } public static Test suite() { - TestSuite suite = new TestSuite( - "Testsuite for xlc compiler error parser"); + TestSuite suite = new TestSuite("Testsuite for xlc compiler error parser"); //$JUnit-BEGIN$ - suite.addTestSuite(TestUndeclIdent.class); - suite.addTestSuite(TestMissingArg.class); - suite.addTestSuite(TestFloatingPoint.class); - suite.addTestSuite(TestFuncArg.class); - suite.addTestSuite(TestOperModi.class); - suite.addTestSuite(TestConditional.class); - suite.addTestSuite(TestSyntaxError.class); - suite.addTestSuite(TestNoFuncProto.class); + suite.addTestSuite(TestInformationalMessage_1.class); + suite.addTestSuite(TestWarning_1.class); + suite.addTestSuite(TestError_1.class); + suite.addTestSuite(TestSevereError_1.class); + suite.addTestSuite(TestSevereError_2.class); + suite.addTestSuite(TestSevereError_3.class); + suite.addTestSuite(TestSevereError_4.class); + suite.addTestSuite(TestSevereError_5.class); + suite.addTestSuite(TestUnrecoverableError_1.class); + suite.addTestSuite(TestCompatibility.class); - suite.addTestSuite(TestUnrecoverableError.class); suite.addTestSuite(TestRedefinition.class); suite.addTestSuite(TestRedeclaration.class); suite.addTestSuite(TestLinkerUndefinedSymbol.class); diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMissingArg.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestError_1.java similarity index 94% rename from xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMissingArg.java rename to xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestError_1.java index 6038d0b312d..c43dd1743cb 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMissingArg.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestError_1.java @@ -16,7 +16,7 @@ import junit.framework.TestCase; import org.eclipse.cdt.core.IMarkerGenerator; -public class TestMissingArg extends TestCase { +public class TestError_1 extends TestCase { String err_msg; /** * This function tests parseLine function of the @@ -33,7 +33,7 @@ public class TestMissingArg extends TestCase { assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity(0)); assertEquals("Missing argument(s).",aix.getMessage(0)); } - public TestMissingArg( String name) + public TestError_1( String name) { super(name); err_msg = "\"temp8.c\", line 9.17: 1506-098 (E) " diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestConditional.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestInformationalMessage_1.java similarity index 92% rename from xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestConditional.java rename to xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestInformationalMessage_1.java index e75f305d4fe..4751d1a7f30 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestConditional.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestInformationalMessage_1.java @@ -16,7 +16,7 @@ import junit.framework.TestCase; import org.eclipse.cdt.core.IMarkerGenerator; -public class TestConditional extends TestCase { +public class TestInformationalMessage_1 extends TestCase { String err_msg; /** * This function tests parseLine function of the @@ -32,7 +32,7 @@ public class TestConditional extends TestCase { assertEquals(IMarkerGenerator.SEVERITY_INFO, aix.getSeverity(0)); assertEquals("The then branch of conditional is an empty statement.",aix.getMessage(0)); } - public TestConditional( String name) + public TestInformationalMessage_1( String name) { super(name); err_msg = "\"temp8.c\", line 12.9: 1506-478 (I) " + diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSyntaxError.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_1.java similarity index 93% rename from xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSyntaxError.java rename to xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_1.java index 280ee47820d..22d8cec3a3f 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSyntaxError.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_1.java @@ -14,7 +14,7 @@ import junit.framework.TestCase; import org.eclipse.cdt.core.IMarkerGenerator; -public class TestSyntaxError extends TestCase { +public class TestSevereError_1 extends TestCase { String err_msg; /** * This function tests parseLine function of the @@ -31,7 +31,7 @@ public class TestSyntaxError extends TestCase { assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity(0)); assertEquals("Syntax error: possible missing ')'?",aix.getMessage(0)); } - public TestSyntaxError( String name) + public TestSevereError_1( String name) { super(name); err_msg = "\"temp1.c\", line 5.1: 1506-276 (S) " diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUndeclIdent.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_2.java similarity index 93% rename from xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUndeclIdent.java rename to xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_2.java index 0fc1b80145b..6f6f3b7e040 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUndeclIdent.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_2.java @@ -15,7 +15,7 @@ import junit.framework.TestCase; import org.eclipse.cdt.core.IMarkerGenerator; -public class TestUndeclIdent extends TestCase { +public class TestSevereError_2 extends TestCase { String err_msg; /** * This function tests parseLine function of the @@ -32,7 +32,7 @@ public class TestUndeclIdent extends TestCase { assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity(0)); assertEquals("Undeclared identifier y.",aix.getMessage(0)); } - public TestUndeclIdent( String name) + public TestSevereError_2( String name) { super(name); err_msg = "\"temp5.c\", line 5.9: 1506-045 (S) " + diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFloatingPoint.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_3.java similarity index 93% rename from xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFloatingPoint.java rename to xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_3.java index a48256b88dd..6aebad7b05b 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFloatingPoint.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_3.java @@ -16,7 +16,7 @@ import junit.framework.TestCase; import org.eclipse.cdt.core.IMarkerGenerator; -public class TestFloatingPoint extends TestCase { +public class TestSevereError_3 extends TestCase { String err_msg; /** * This function tests parseLine function of the @@ -34,7 +34,7 @@ public class TestFloatingPoint extends TestCase { assertEquals("Floating point constant 10.23.3 is not valid", aix.getMessage(0)); } - public TestFloatingPoint( String name) + public TestSevereError_3( String name) { super(name); err_msg = "\"temp9.c\", line 11.18: 1506-189 (S) " + diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFuncArg.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_4.java similarity index 94% rename from xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFuncArg.java rename to xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_4.java index 9a4ee2c56f0..eac63f5e2bf 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFuncArg.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_4.java @@ -15,7 +15,7 @@ import junit.framework.TestCase; import org.eclipse.cdt.core.IMarkerGenerator; -public class TestFuncArg extends TestCase { +public class TestSevereError_4 extends TestCase { String err_msg; /** * This function tests parseLine function of the @@ -34,7 +34,7 @@ public class TestFuncArg extends TestCase { "\"int\" and \"char*\" is not allowed.", aix.getMessage(0)); } - public TestFuncArg( String name) + public TestSevereError_4( String name) { super(name); err_msg = "\"temp9.c\", line 12.18: 1506-280 (S) " + diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestOperModi.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_5.java similarity index 93% rename from xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestOperModi.java rename to xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_5.java index fa1f6997896..471ae87a030 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestOperModi.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSevereError_5.java @@ -15,7 +15,7 @@ import junit.framework.TestCase; import org.eclipse.cdt.core.IMarkerGenerator; -public class TestOperModi extends TestCase { +public class TestSevereError_5 extends TestCase { String err_msg; /** * This function tests parseLine function of the @@ -32,7 +32,7 @@ public class TestOperModi extends TestCase { assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity(0)); assertEquals("Operand must be a modifiable lvalue.",aix.getMessage(0)); } - public TestOperModi( String name) + public TestSevereError_5( String name) { super(name); err_msg = "\"temp9.c\", line 13.9: 1506-025 (S) " + diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError_1.java similarity index 92% rename from xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java rename to xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError_1.java index ee9962c0e7f..19c731ded82 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError_1.java @@ -14,7 +14,7 @@ import junit.framework.TestCase; import org.eclipse.cdt.core.IMarkerGenerator; -public class TestUnrecoverableError extends TestCase { +public class TestUnrecoverableError_1 extends TestCase { String err_msg; /** * This function tests parseLine function of the @@ -31,7 +31,7 @@ public class TestUnrecoverableError extends TestCase { assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity(0)); assertEquals("INTERNAL COMPILER ERROR",aix.getMessage(0)); } - public TestUnrecoverableError( String name) + public TestUnrecoverableError_1( String name) { super(name); err_msg = "\"temp1.c\", line 5.1: 1506-001 (U) " diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestNoFuncProto.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestWarning_1.java similarity index 93% rename from xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestNoFuncProto.java rename to xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestWarning_1.java index f212db3e16a..606f601b25f 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestNoFuncProto.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestWarning_1.java @@ -14,7 +14,7 @@ import junit.framework.TestCase; import org.eclipse.cdt.core.IMarkerGenerator; -public class TestNoFuncProto extends TestCase { +public class TestWarning_1 extends TestCase { String err_msg; /** * This function tests parseLine function of the @@ -30,7 +30,7 @@ public class TestNoFuncProto extends TestCase { assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity(0)); assertEquals("No function prototype given for \"printf\".",aix.getMessage(0)); } - public TestNoFuncProto( String name) + public TestWarning_1( String name) { super(name); err_msg = "\"temp1.c\", line 5.9: 1506-304 (W) " From 90353a19c1da841b6fbedeab49b03382e5d935db Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Mon, 21 Jan 2013 15:18:25 -0500 Subject: [PATCH 5/6] bug 398681: CDT does not understand some of xlC diagnostic messages --- .../xlc/tests/AllXlcErrorParserTests.java | 8 ++++ .../tests/TestCommandOptionNotRecognized.java | 39 ++++++++++++++++++ .../xlc/tests/TestInformationalMessage_2.java | 39 ++++++++++++++++++ .../xlc/tests/TestInformationalMessage_3.java | 38 ++++++++++++++++++ .../TestLinkerCommandOptionNotRecognized.java | 40 +++++++++++++++++++ .../xlc/tests/TestUnrecoverableError_2.java | 39 ++++++++++++++++++ .../xlc/tests/TestUnrecoverableError_3.java | 39 ++++++++++++++++++ .../plugin.properties | 9 +++++ .../plugin.xml | 4 ++ 9 files changed, 255 insertions(+) create mode 100644 xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestCommandOptionNotRecognized.java create mode 100644 xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestInformationalMessage_2.java create mode 100644 xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestInformationalMessage_3.java create mode 100644 xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerCommandOptionNotRecognized.java create mode 100644 xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError_2.java create mode 100644 xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError_3.java diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java index 2b01874b439..4b82f75b2e7 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java @@ -22,6 +22,8 @@ public class AllXlcErrorParserTests { TestSuite suite = new TestSuite("Testsuite for xlc compiler error parser"); //$JUnit-BEGIN$ suite.addTestSuite(TestInformationalMessage_1.class); + suite.addTestSuite(TestInformationalMessage_2.class); + suite.addTestSuite(TestInformationalMessage_3.class); suite.addTestSuite(TestWarning_1.class); suite.addTestSuite(TestError_1.class); suite.addTestSuite(TestSevereError_1.class); @@ -30,15 +32,21 @@ public class AllXlcErrorParserTests { suite.addTestSuite(TestSevereError_4.class); suite.addTestSuite(TestSevereError_5.class); suite.addTestSuite(TestUnrecoverableError_1.class); + suite.addTestSuite(TestUnrecoverableError_2.class); + suite.addTestSuite(TestUnrecoverableError_3.class); suite.addTestSuite(TestCompatibility.class); suite.addTestSuite(TestRedefinition.class); suite.addTestSuite(TestRedeclaration.class); + suite.addTestSuite(TestCommandOptionNotRecognized.class); + + suite.addTestSuite(TestLinkerCommandOptionNotRecognized.class); suite.addTestSuite(TestLinkerUndefinedSymbol.class); suite.addTestSuite(TestLinkerDuplicateSymbol.class); suite.addTestSuite(TestLinkerSevereError.class); suite.addTestSuite(TestLinkerErrorWhileReading.class); suite.addTestSuite(TestLinkerInfo.class); + //$JUnit-END$ return suite; } diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestCommandOptionNotRecognized.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestCommandOptionNotRecognized.java new file mode 100644 index 00000000000..6a69a3930ae --- /dev/null +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestCommandOptionNotRecognized.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2013, 2013 Andrew Gvozdev and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andrew Gvozdev - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.errorparsers.xlc.tests; + +import junit.framework.TestCase; + +import org.eclipse.cdt.core.IMarkerGenerator; + +public class TestCommandOptionNotRecognized extends TestCase { + String err_msg; + /** + * This function tests parseLine function of the + * XlcErrorParser class. A warning message generated by + * xlc compiler about command options is given as + * input for testing. + */ + public void testparseLine() + { + XlcErrorParserTester aix = new XlcErrorParserTester(); + aix.parseLine(err_msg); + assertEquals("", aix.getFileName(0)); + assertEquals(0, aix.getLineNumber(0)); + assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity(0)); + assertEquals("command option 9 is not recognized - passed to ld",aix.getMessage(0)); + } + public TestCommandOptionNotRecognized(String name) + { + super(name); + err_msg = "/usr/vacpp/bin/xlc: 1501-216 command option 9 is not recognized - passed to ld"; + } +} diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestInformationalMessage_2.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestInformationalMessage_2.java new file mode 100644 index 00000000000..f2096b2794a --- /dev/null +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestInformationalMessage_2.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2013, 2013 Andrew Gvozdev and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andrew Gvozdev - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.errorparsers.xlc.tests; + +import junit.framework.TestCase; + +import org.eclipse.cdt.core.IMarkerGenerator; + +public class TestInformationalMessage_2 extends TestCase { + String err_msg; + /** + * This function tests parseLine function of the + * XlcErrorParser class. A variant of informational message generated by + * xlc compiler with no file or line is given as + * input for testing. + */ + public void testparseLine() + { + XlcErrorParserTester aix = new XlcErrorParserTester(); + aix.parseLine(err_msg); + assertEquals("", aix.getFileName(0)); + assertEquals(0, aix.getLineNumber(0)); + assertEquals(IMarkerGenerator.SEVERITY_INFO, aix.getSeverity(0)); + assertEquals("clazz::fun(): Additional optimization may be attained by recompiling and specifying MAXMEM option with a value greater than 8192.",aix.getMessage(0)); + } + public TestInformationalMessage_2( String name) + { + super(name); + err_msg = " 1500-030: (I) INFORMATION: clazz::fun(): Additional optimization may be attained by recompiling and specifying MAXMEM option with a value greater than 8192."; + } +} diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestInformationalMessage_3.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestInformationalMessage_3.java new file mode 100644 index 00000000000..c68072051e5 --- /dev/null +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestInformationalMessage_3.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2013, 2013 Andrew Gvozdev and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andrew Gvozdev - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.errorparsers.xlc.tests; + +import junit.framework.TestCase; + +import org.eclipse.cdt.core.IMarkerGenerator; + +public class TestInformationalMessage_3 extends TestCase { + String err_msg; + /** + * This function tests parseLine function of the + * XlcErrorParser class. A variant of informational message generated by + * xlc compiler is given as input for testing. + */ + public void testparseLine() + { + XlcErrorParserTester aix = new XlcErrorParserTester(); + aix.parseLine(err_msg); + assertEquals("", aix.getFileName(0)); + assertEquals(0, aix.getLineNumber(0)); + assertEquals(IMarkerGenerator.SEVERITY_INFO, aix.getSeverity(0)); + assertEquals("Global variable \"__td __td__Q2_3std13runtime_error\" is not used.",aix.getMessage(0)); + } + public TestInformationalMessage_3( String name) + { + super(name); + err_msg = "1540-5336 (I) Global variable \"__td __td__Q2_3std13runtime_error\" is not used."; + } +} diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerCommandOptionNotRecognized.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerCommandOptionNotRecognized.java new file mode 100644 index 00000000000..ce83c6d716f --- /dev/null +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerCommandOptionNotRecognized.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2006, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.errorparsers.xlc.tests; + +import junit.framework.TestCase; + +import org.eclipse.cdt.core.IMarkerGenerator; + +public class TestLinkerCommandOptionNotRecognized extends TestCase { + String err_msg; + /** + * This function tests parseLine function of the + * XlcErrorParser class. A warning message generated by + * xlc linker about command options is given as + * input for testing. + */ + public void testparseLine() + { + XlcErrorParserTester aix = new XlcErrorParserTester(); + aix.parseLine(err_msg); + assertEquals("", aix.getFileName(0)); + assertEquals(0, aix.getLineNumber(0)); + assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity(0)); + assertEquals("The -9 flag is not recognized.",aix.getMessage(0)); + } + public TestLinkerCommandOptionNotRecognized(String name) + { + super(name); + err_msg = "ld: 0706-012 The -9 flag is not recognized."; + } +} diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError_2.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError_2.java new file mode 100644 index 00000000000..78521af2ab8 --- /dev/null +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError_2.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2013, 2013 Andrew Gvozdev and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andrew Gvozdev - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.errorparsers.xlc.tests; + +import junit.framework.TestCase; + +import org.eclipse.cdt.core.IMarkerGenerator; + +public class TestUnrecoverableError_2 extends TestCase { + String err_msg; + /** + * This function tests parseLine function of the + * XlcErrorParser class. A variant of error message generated by + * xlc compiler with unrecoverable severity (U) is given as + * input for testing. + */ + public void testparseLine() + { + XlcErrorParserTester aix = new XlcErrorParserTester(); + aix.parseLine(err_msg); + assertEquals("", aix.getFileName(0)); + assertEquals(0, aix.getLineNumber(0)); + assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity(0)); + assertEquals("An error occurred during code generation. The code generation return code was 1.",aix.getMessage(0)); + } + public TestUnrecoverableError_2( String name) + { + super(name); + err_msg = "1586-346 (U) An error occurred during code generation. The code generation return code was 1."; + } +} diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError_3.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError_3.java new file mode 100644 index 00000000000..a26d941a2ec --- /dev/null +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError_3.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2013, 2013 Andrew Gvozdev and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andrew Gvozdev - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.errorparsers.xlc.tests; + +import junit.framework.TestCase; + +import org.eclipse.cdt.core.IMarkerGenerator; + +public class TestUnrecoverableError_3 extends TestCase { + String err_msg; + /** + * This function tests parseLine function of the + * XlcErrorParser class. A variant of error message generated by + * xlc compiler with unrecoverable severity (U) is given as + * input for testing. + */ + public void testparseLine() + { + XlcErrorParserTester aix = new XlcErrorParserTester(); + aix.parseLine(err_msg); + assertEquals("", aix.getFileName(0)); + assertEquals(0, aix.getLineNumber(0)); + assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity(0)); + assertEquals("INTERNAL COMPILER ERROR while compiling ----. Compilation ended. Contact your Service Representative and provide the following information: Internal abort. For more information visit: http://www.ibm.com/support/docview.wss?uid=swg21110810",aix.getMessage(0)); + } + public TestUnrecoverableError_3( String name) + { + super(name); + err_msg = " 1500-004: (U) INTERNAL COMPILER ERROR while compiling ----. Compilation ended. Contact your Service Representative and provide the following information: Internal abort. For more information visit: http://www.ibm.com/support/docview.wss?uid=swg21110810"; + } +} diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties index 405a9e7419a..cef2c77ad87 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties +++ b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties @@ -35,10 +35,19 @@ CDTXLCErrorParser.pattern.redeclaration.crossreference=Redeclaration of $4 diffe CDTXLCErrorParser.pattern.error="?([^"]*)"?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\([USE]\\)\\s*(.*) CDTXLCErrorParser.pattern.warning="?([^"]*)"?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(W\\)\\s*(.*) CDTXLCErrorParser.pattern.info="?([^"]*)"?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(I\\)\\s*(.*) +# 1586-346 (U) An error occurred during code generation. The code generation return code was 1. +CDTXLCErrorParser.pattern.error2=\\s*([0-9]*-[0-9]*:?)? \\([USE]\\)\\s*(.*) +# /usr/vacpp/bin/xlc: 1501-216 command option 9 is not recognized - passed to ld +CDTXLCErrorParser.pattern.warning2=/[/\\w]+: [0-9]+-[0-9]+\\s*(.*) +# 1500-030: (I) INFORMATION: clazz::fun(): Additional optimization may be attained by recompiling and specifying MAXMEM option with a value greater than 8192. +# 1540-5336 (I) Global variable "__td __td__Q2_3std13runtime_error" is not used. +CDTXLCErrorParser.pattern.info2=\\s*([0-9]*-[0-9]*:?)? \\(I\\)( INFORMATION:)?\\s*(.*) # ld: 0711-224 WARNING: Duplicate symbol: symboldupe # WARNING, ERROR, SEVERE ERROR etc. CDTXLCErrorParser.pattern.ld.error=ld: ([0-9]+-[0-9]+).*ERROR:\\s*(.*) CDTXLCErrorParser.pattern.ld.warning=ld: ([0-9]+-[0-9]+)\\s*WARNING:\\s*(.*) +# ld: 0706-012 The -9 flag is not recognized. +CDTXLCErrorParser.pattern.ld.warning2=ld: 0706-012\\s*(.*) # ld: 0711-987 Error occurred while reading file CDTXLCErrorParser.pattern.ld.error2=ld: ([0-9]+-[0-9]+)\\s*(Error .*) # ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml index 7fde01587b6..dff6bff116d 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml +++ b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml @@ -11,11 +11,15 @@ + + + + From 46cd8b19faf5aed8f49a027265dbe602867d79f7 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Mon, 21 Jan 2013 17:40:11 -0500 Subject: [PATCH 6/6] bug 378834: allow profiles other than "production" use ${gdbPathOption} property --- dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml index 9b9554e9b4e..5d8009d88db 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml @@ -24,18 +24,13 @@ --> - - - production - - -Dcdt.tests.dsf.gdb.path=/opt/public/download-staging.priv/tools/cdt/gdb - - - + + -Dcdt.tests.dsf.gdb.path=/opt/public/download-staging.priv/tools/cdt/gdb + - + maven-antrun-plugin