Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 184318 Details for
Bug 237306
[multicore][multi-process] Support for Multi-Process debugging
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Prototype patch to create a new process
zpatch.multiProcess7.txt (text/plain), 49.62 KB, created by
Marc Khouzam
on 2010-12-01 21:23:45 EST
(
hide
)
Description:
Prototype patch to create a new process
Filename:
MIME Type:
Creator:
Marc Khouzam
Created:
2010-12-01 21:23:45 EST
Size:
49.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.debug.core >Index: src/org/eclipse/cdt/debug/core/CDebugUtils.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java,v >retrieving revision 1.32 >diff -u -r1.32 CDebugUtils.java >--- src/org/eclipse/cdt/debug/core/CDebugUtils.java 15 Jul 2010 14:35:43 -0000 1.32 >+++ src/org/eclipse/cdt/debug/core/CDebugUtils.java 2 Dec 2010 02:13:17 -0000 >@@ -20,6 +20,7 @@ > import java.util.Arrays; > import java.util.Iterator; > import java.util.List; >+import java.util.Map; > > import javax.xml.transform.OutputKeys; > import javax.xml.transform.Transformer; >@@ -688,4 +689,26 @@ > private static void throwCoreException(String msg, Exception innerException, int code) throws CoreException { > throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), code, msg, innerException)); > } >+ >+ /** >+ * Generic method to fetch an attribute from a Map that has keys of type String. The defaultValue >+ * parameter will be returned if the map does not contain the key, or if the matching value is not >+ * of the correct type. >+ * >+ * @param <V> The type of the value we are looking for. Specified by the type of defaultValue. >+ * @param attributes The map with keys of type String, and values of any type. Can not be null. >+ * @param key They key for which we want the value. >+ * @param defaultValue The default value to return if the key is not found in the map, or if the value found >+ * is not of the same type as defaultValue. Can not be null. >+ * @return The value, if found and of the same type as defaultValue. Else, returns defaultValue. >+ * @since 7.1 >+ */ >+ @SuppressWarnings("unchecked") >+ public static <V> V getAttribute(Map<String, ?> attributes, String key, V defaultValue) { >+ Object value = attributes.get(key); >+ if (defaultValue.getClass().isInstance(value)) { >+ return (V)value; >+ } >+ return defaultValue; >+ } > } >#P org.eclipse.cdt.dsf.gdb >Index: src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java,v >retrieving revision 1.17 >diff -u -r1.17 FinalLaunchSequence.java >--- src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java 5 Nov 2010 01:28:48 -0000 1.17 >+++ src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java 2 Dec 2010 02:13:17 -0000 >@@ -26,6 +26,7 @@ > import org.eclipse.cdt.dsf.datamodel.DataModelInitializedEvent; > import org.eclipse.cdt.dsf.datamodel.IDMContext; > import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext; >+import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext; > import org.eclipse.cdt.dsf.debug.service.ISourceLookup.ISourceLookupDMContext; > import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; > import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; >@@ -37,6 +38,7 @@ > import org.eclipse.cdt.dsf.gdb.service.SessionType; > import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl; > import org.eclipse.cdt.dsf.mi.service.CSourceLookup; >+import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; > import org.eclipse.cdt.dsf.mi.service.IMIProcesses; > import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager; > import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; >@@ -64,7 +66,8 @@ > private CommandFactory fCommandFactory; > > private DsfServicesTracker fTracker; >- >+ private IMIContainerDMContext fInitialContainerCtx; >+ > public FinalLaunchSequence(DsfExecutor executor, GdbLaunch launch, SessionType sessionType, boolean attach, IProgressMonitor pm) { > super(executor, pm, LaunchMessages.getString("FinalLaunchSequence.0"), LaunchMessages.getString("FinalLaunchSequence.1")); //$NON-NLS-1$ //$NON-NLS-2$ > fLaunch = launch; >@@ -131,6 +134,12 @@ > return; > } > >+ // We can cheat a little. Since we know GDB starts off focused on the one >+ // groupId it automatically created, we can simply create a container with the 'null' >+ // groupId, which will get ignored and will use the process currently in focus. >+ IProcessDMContext procCtx = fProcService.createProcessContext(fCommandControl.getContext(), null); >+ fInitialContainerCtx = fProcService.createContainerContext(procCtx, null); >+ > requestMonitor.done(); > } > >@@ -285,7 +294,7 @@ > final IPath execPath = fGDBBackend.getProgramPath(); > if (!noFileCommand && execPath != null && !execPath.isEmpty()) { > fCommandControl.queueCommand( >- fCommandFactory.createMIFileExecAndSymbols(fCommandControl.getContext(), >+ fCommandFactory.createMIFileExecAndSymbols(fInitialContainerCtx, > execPath.toPortableString()), > new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor)); > } else { >Index: src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java,v >retrieving revision 1.28 >diff -u -r1.28 GDBProcesses_7_0.java >--- src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java 22 Nov 2010 15:45:12 -0000 1.28 >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java 2 Dec 2010 02:13:18 -0000 >@@ -689,7 +689,8 @@ > rm.done(); > } > >- private boolean doIsDebuggerAttachSupported() { >+ /** @since 4.0 */ >+ protected boolean doIsDebuggerAttachSupported() { > IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class); > if (backend != null) { > return backend.getIsAttachSession(); >@@ -728,7 +729,8 @@ > } > } > >- private boolean doCanDetachDebuggerFromProcess() { >+ /** @since 4.0 */ >+ protected boolean doCanDetachDebuggerFromProcess() { > IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class); > if (backend != null) { > return backend.getIsAttachSession() && fCommandControl.isConnected(); >Index: src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java >diff -N src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,529 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Ericsson 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: >+ * Ericsson - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.dsf.gdb.service; >+ >+import java.util.Map; >+import java.util.Properties; >+ >+import org.eclipse.cdt.debug.core.CDebugUtils; >+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; >+import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; >+import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor; >+import org.eclipse.cdt.dsf.concurrent.ReflectionSequence; >+import org.eclipse.cdt.dsf.concurrent.RequestMonitor; >+import org.eclipse.cdt.dsf.concurrent.Sequence; >+import org.eclipse.cdt.dsf.datamodel.DMContexts; >+import org.eclipse.cdt.dsf.datamodel.IDMContext; >+import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext; >+import org.eclipse.cdt.dsf.debug.service.command.ICommand; >+import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; >+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.IMICommandControl; >+import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; >+import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext; >+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.MIBreakInsertInfo; >+import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakpoint; >+import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; >+import org.eclipse.cdt.dsf.service.DsfSession; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+ >+/** >+ * @since 4.0 >+ */ >+public class GDBProcesses_7_2 extends GDBProcesses_7_1 { >+ >+ private CommandFactory fCommandFactory; >+ private IGDBControl fCommandControl; >+ private IGDBBackend fBackend; >+ >+ public GDBProcesses_7_2(DsfSession session) { >+ super(session); >+ } >+ >+ @Override >+ public void initialize(final RequestMonitor requestMonitor) { >+ super.initialize(new RequestMonitor(getExecutor(), requestMonitor) { >+ @Override >+ protected void handleSuccess() { >+ doInitialize(requestMonitor); >+ } >+ }); >+ } >+ >+ /** >+ * This method initializes this service after our superclass's initialize() >+ * method succeeds. >+ * >+ * @param requestMonitor >+ * The call-back object to notify when this service's >+ * initialization is done. >+ */ >+ private void doInitialize(RequestMonitor requestMonitor) { >+ fCommandControl = getServicesTracker().getService(IGDBControl.class); >+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); >+ fBackend = getServicesTracker().getService(IGDBBackend.class); >+ >+ requestMonitor.done(); >+ } >+ >+ @Override >+ public void shutdown(RequestMonitor requestMonitor) { >+ super.shutdown(requestMonitor); >+ } >+ >+ @Override >+ protected boolean doIsDebuggerAttachSupported() { >+ return true; >+ } >+ >+ @Override >+ protected boolean doCanDetachDebuggerFromProcess() { >+ return true; >+ } >+ >+ protected class DebugNewProcessSequence extends ReflectionSequence { >+ >+ private String fBinaryName; >+ private Map<String, Object> fAttributes; >+ private IMIContainerDMContext fContainerCtx; >+ // Store the dataRM so that we can fill it with the container context that we will be creating >+ private DataRequestMonitor<IDMContext> fDataRequestMonitor; >+ >+ public DebugNewProcessSequence(IDMContext dmc, String file, Map<String, Object> attributes, final DataRequestMonitor<IDMContext> rm) { >+ super(GDBProcesses_7_2.this.getExecutor(), rm); >+ fBinaryName = file; >+ fAttributes = attributes; >+ fDataRequestMonitor = rm; >+ } >+ >+ @Override >+ protected String[] getExecutionOrder(String group) { >+ if (GROUP_TOP_LEVEL.equals(group)) { >+ return new String[] { >+ "stepAddInferior", //$NON-NLS-1$ >+ "stepSetEnvironmentVariables", //$NON-NLS-1$ >+ "stepSetExecutable", //$NON-NLS-1$ >+ "stepSetArguments", //$NON-NLS-1$ >+ "stepStartExecution", //$NON-NLS-1$ >+ }; >+ } >+ return null; >+ } >+ >+ /** >+ * Start executing the program. >+ */ >+ @Execute >+ public void stepAddInferior(final RequestMonitor rm) { >+ fCommandControl.queueCommand( >+ fCommandFactory.createMIAddInferior(fCommandControl.getContext()), >+ new DataRequestMonitor<MIAddInferiorInfo>(ImmediateExecutor.getInstance(), rm) { >+ @Override >+ protected void handleSuccess() { >+ final String groupId = getData().getGroupId(); >+ if (groupId == null || groupId.trim().length() == 0) { >+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid gdb group id.", null)); //$NON-NLS-1$ >+ rm.done(); >+ return; >+ } >+ >+ IProcessDMContext procCtx = createProcessContext(fCommandControl.getContext(), null); >+ fContainerCtx = createContainerContext(procCtx, groupId); >+ rm.done(); >+ } >+ }); >+ } >+ >+ /** >+ * Specify environment variables if needed >+ */ >+ @Execute >+ public void stepSetEnvironmentVariables(RequestMonitor rm) { >+ boolean clear = false; >+ Properties properties = new Properties(); >+ try { >+ // here we need to pass the proper container context >+ clear = fBackend.getClearEnvironment(); >+ properties = fBackend.getEnvironmentVariables(); >+ } catch (CoreException e) { >+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get environment information", e)); //$NON-NLS-1$ >+ rm.done(); >+ return; >+ } >+ >+ if (clear == true || properties.size() > 0) { >+ // here we need to pass the proper container context >+ fCommandControl.setEnvironment(properties, clear, rm); >+ } else { >+ rm.done(); >+ } >+ } >+ >+ /** >+ * Specify the executable file to be debugged and read the symbol table. >+ */ >+ @Execute >+ public void stepSetExecutable(RequestMonitor rm) { >+ boolean noFileCommand = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP, >+ IGDBLaunchConfigurationConstants.DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP_DEFAULT); >+ >+ if (!noFileCommand && fBinaryName != null && fBinaryName.length() > 0) { >+ fCommandControl.queueCommand( >+ fCommandFactory.createMIFileExecAndSymbols(fContainerCtx, fBinaryName), >+ new DataRequestMonitor<MIInfo>(getExecutor(), rm)); >+ } else { >+ rm.done(); >+ } >+ } >+ >+ /** >+ * Specify the arguments to the executable file. >+ */ >+ @Execute >+ public void stepSetArguments(RequestMonitor rm) { >+ try { >+ String args = fBackend.getProgramArguments(); >+ >+ if (args != null) { >+ fCommandControl.queueCommand( >+ // here we need to pass the proper container context >+ fCommandFactory.createMIGDBSetArgs(fCommandControl.getContext(), args), >+ new DataRequestMonitor<MIInfo>(getExecutor(), rm)); >+ } else { >+ rm.done(); >+ } >+ } catch (CoreException e) { >+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get inferior arguments", e)); //$NON-NLS-1$ >+ rm.done(); >+ } >+ } >+ >+ /** >+ * Start executing the program. >+ */ >+ @Execute >+ public void stepStartExecution(final RequestMonitor rm) { >+ startOrRestart(fContainerCtx, fAttributes, false, new DataRequestMonitor<IMIContainerDMContext>(ImmediateExecutor.getInstance(), rm) { >+ @Override >+ protected void handleSuccess() { >+ // Set the container that we created >+ fDataRequestMonitor.setData(getData()); >+ >+ // Don't call fDataRequestMonitor.done(), the sequence will >+ // automatically do that when we call rm.done(); >+ rm.done(); >+ } >+ }); >+ } >+ } >+ >+ @Override >+ public void debugNewProcess(IDMContext dmc, String file, >+ Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) { >+ Sequence debugNewProcess = new DebugNewProcessSequence(dmc, file, attributes, rm); >+ ImmediateExecutor.getInstance().execute(debugNewProcess); >+ } >+ >+ @Override >+ public void attachDebuggerToProcess(final IProcessDMContext procCtx, final DataRequestMonitor<IDMContext> rm) { >+ if (procCtx instanceof IMIProcessDMContext) { >+ if (!doIsDebuggerAttachSupported()) { >+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Attach not supported.", null)); //$NON-NLS-1$ >+ rm.done(); >+ return; >+ } >+ >+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(procCtx, ICommandControlDMContext.class); >+ fCommandControl.queueCommand( >+ fCommandFactory.createMIAddInferior(controlDmc), >+ new DataRequestMonitor<MIAddInferiorInfo>(getExecutor(), rm) { >+ @Override >+ protected void handleSuccess() { >+ final String groupId = getData().getGroupId(); >+ if (groupId == null || groupId.trim().length() == 0) { >+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid gdb group id.", null)); //$NON-NLS-1$ >+ rm.done(); >+ return; >+ } >+ >+ final IMIContainerDMContext containerDmc = createContainerContext(procCtx, groupId); >+ fCommandControl.queueCommand( >+ fCommandFactory.createMITargetAttach(containerDmc, ((IMIProcessDMContext)procCtx).getProcId()), >+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) { >+ @Override >+ protected void handleSuccess() { >+ rm.setData(containerDmc); >+ rm.done(); >+ } >+ }); >+ } >+ }); >+ } else { >+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$ >+ rm.done(); >+ } >+ } >+ >+ @Override >+ public void detachDebuggerFromProcess(IDMContext dmc, final RequestMonitor rm) { >+ >+ final IMIContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class); >+ >+ if (containerDmc != null) { >+ if (!doCanDetachDebuggerFromProcess()) { >+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Detach not supported.", null)); //$NON-NLS-1$ >+ rm.done(); >+ return; >+ } >+ >+ fCommandControl.queueCommand( >+ fCommandFactory.createMITargetDetach(containerDmc), >+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) { >+ @Override >+ protected void handleSuccess() { >+ fCommandControl.queueCommand( >+ fCommandFactory.createMIRemoveInferior(fCommandControl.getContext(), containerDmc.getGroupId()), >+ new DataRequestMonitor<MIInfo>(getExecutor(), rm)); >+ } >+ }); >+ } else { >+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid context.", null)); //$NON-NLS-1$ >+ rm.done(); >+ } >+ } >+ >+ protected class StartOrRestartProcessSequence extends ReflectionSequence { >+ >+ // This variable will be used to store the original container context, >+ // but once the new process is start (restarted), it will contain the new >+ // container context. This new container context has for parent the process >+ // context, which holds the new pid. >+ private IMIContainerDMContext fContainerDmc; >+ >+ private MIBreakpoint fUserBreakpoint = null; >+ private boolean fUserBreakpointIsOnMain = false; >+ private boolean fReverseEnabled; >+ private boolean fRestart; >+ private Map<String, Object> fAttributes; >+ // Store the dataRM so that we can fill it with the container context that we will be creating >+ private DataRequestMonitor<IMIContainerDMContext> fDataRequestMonitor; >+ >+ public StartOrRestartProcessSequence(IMIContainerDMContext containerDmc, Map<String, Object> attributes, >+ boolean restart, DataRequestMonitor<IMIContainerDMContext> rm) { >+ super(GDBProcesses_7_2.this.getExecutor(), rm); >+ fContainerDmc = containerDmc; >+ fAttributes = attributes; >+ fRestart = restart; >+ fDataRequestMonitor = rm; >+ fReverseEnabled = CDebugUtils.getAttribute(attributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, >+ IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT); >+ } >+ >+ @Override >+ protected String[] getExecutionOrder(String group) { >+ if (GROUP_TOP_LEVEL.equals(group)) { >+ return new String[] { >+ "stepInsertStopOnMainBreakpoint", //$NON-NLS-1$ >+ "stepSetBreakpointForReverse", //$NON-NLS-1$ >+ "stepRunProgram", //$NON-NLS-1$ >+ "stepSetReverseOff", //$NON-NLS-1$ >+ "stepEnableReverse", //$NON-NLS-1$ >+ "stepContinue", //$NON-NLS-1$ >+ }; >+ } >+ return null; >+ } >+ >+ /** >+ * If the user requested a 'stopOnMain', let's set the temporary breakpoint >+ * where the user specified. >+ */ >+ @Execute >+ public void stepInsertStopOnMainBreakpoint(final RequestMonitor rm) { >+ boolean userRequestedStop = CDebugUtils.getAttribute(fAttributes, >+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, >+ false); >+ >+ if (userRequestedStop) { >+ String userStopSymbol = CDebugUtils.getAttribute(fAttributes, >+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, >+ ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); >+ >+ fCommandControl.queueCommand( >+ fCommandFactory.createMIBreakInsert((IBreakpointsTargetDMContext)fCommandControl.getContext(), >+ true, false, null, 0, userStopSymbol, 0), >+ new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) { >+ @Override >+ public void handleSuccess() { >+ if (getData() != null) { >+ MIBreakpoint[] breakpoints = getData().getMIBreakpoints(); >+ if (breakpoints.length > 0) { >+ fUserBreakpoint = breakpoints[0]; >+ } >+ } >+ rm.done(); >+ } >+ }); >+ } else { >+ rm.done(); >+ } >+ } >+ >+ /* >+ * If reverse debugging, set a breakpoint on main to be able to enable reverse >+ * as early as possible. >+ * If the user has requested a stop at the same point, we could skip this breakpoint >+ * however, we have to first set it to find out! So, we just leave it. >+ */ >+ @Execute >+ public void stepSetBreakpointForReverse(final RequestMonitor rm) { >+ if (fReverseEnabled) { >+ fCommandControl.queueCommand( >+ fCommandFactory.createMIBreakInsert((IBreakpointsTargetDMContext)fCommandControl.getContext(), >+ true, false, null, 0, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT, 0), >+ new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) { >+ @Override >+ public void handleSuccess() { >+ if (getData() != null) { >+ MIBreakpoint[] breakpoints = getData().getMIBreakpoints(); >+ if (breakpoints.length > 0 && fUserBreakpoint != null) { >+ fUserBreakpointIsOnMain = breakpoints[0].getAddress().equals(fUserBreakpoint.getAddress()); >+ } >+ } >+ rm.done(); >+ } >+ }); >+ } else { >+ rm.done(); >+ } >+ } >+ /* >+ * Now, run the program. Use either -exec-run or -exec-continue depending >+ * on whether we have remote session or not. >+ */ >+ @Execute >+ public void stepRunProgram(final RequestMonitor rm) { >+ ICommand<MIInfo> command; >+ if (useContinueCommand(fAttributes, fRestart)) { >+ command = fCommandFactory.createMIExecContinue(fContainerDmc); >+ } else { >+ command = fCommandFactory.createMIExecRun(fContainerDmc); >+ } >+ fCommandControl.queueCommand(command, new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm) { >+ @Override >+ protected void handleSuccess() { >+ // Now that the process is started, the pid has been allocated >+ // so we need to fetch the proper container context >+ // We replace our current context which does not have the pid, with one that has the pid. >+ fContainerDmc = createContainerContextFromGroupId(fCommandControl.getContext(), fContainerDmc.getGroupId()); >+ fDataRequestMonitor.setData(fContainerDmc); >+ rm.done(); >+ } >+ }); >+ >+ } >+ /* >+ * In case of a restart, reverse debugging should be marked as off here because >+ * GDB will have turned it off. We may turn it back on after. >+ */ >+ @Execute >+ public void stepSetReverseOff(RequestMonitor rm) { >+ // Although it only makes sense for a restart, it doesn't hurt >+ // do to it all the time. >+ GDBRunControl_7_0 reverseService = getServicesTracker().getService(GDBRunControl_7_0.class); >+ if (reverseService != null) { >+ reverseService.setReverseModeEnabled(false); >+ } >+ rm.done(); >+ } >+ /* >+ * Since we have started the program, we can turn on reverse debugging if needed >+ */ >+ @Execute >+ public void stepEnableReverse(RequestMonitor rm) { >+ if (fReverseEnabled) { >+ IReverseRunControl reverseService = getServicesTracker().getService(IReverseRunControl.class); >+ if (reverseService != null) { >+ reverseService.enableReverseMode(fCommandControl.getContext(), true, rm); >+ return; >+ } >+ } >+ rm.done(); >+ } >+ /* >+ * Finally, if we are enabling reverse, and the userSymbolStop is not on main, >+ * we should do a continue because we are currently stopped on main but that >+ * is not what the user requested >+ */ >+ @Execute >+ public void stepContinue(RequestMonitor rm) { >+ if (fReverseEnabled && !fUserBreakpointIsOnMain) { >+ fCommandControl.queueCommand(fCommandFactory.createMIExecContinue(fContainerDmc), >+ new DataRequestMonitor<MIInfo>(getExecutor(), rm)); >+ } else { >+ rm.done(); >+ } >+ } >+ }; >+ >+ /** >+ * Insert breakpoint at entry if set, and start or restart the program. >+ * Note that restart does not apply to remote or attach sessions. >+ * >+ * If we want to enable Reverse debugging from the start of the program we do the following: >+ * attachSession => enable reverse >+ * else => set temp bp on main, run, enable reverse, continue if bp on main was not requested by user >+ */ >+ protected void startOrRestart(IMIContainerDMContext containerDmc, Map<String, Object> attributes, boolean restart, DataRequestMonitor<IMIContainerDMContext> rm) { >+ final boolean reverseEnabled = CDebugUtils.getAttribute(attributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, >+ IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT); >+ >+ if (fBackend.getIsAttachSession()) { >+ // Restart does not apply to attach sessions. >+ // >+ // When attaching to a running process, we do not need to set a breakpoint or >+ // start the program; it is left up to the user. >+ // We only need to turn on Reverse Debugging if requested. >+ if (reverseEnabled) { >+ IReverseRunControl reverseService = getServicesTracker().getService(IReverseRunControl.class); >+ if (reverseService != null) { >+ reverseService.enableReverseMode(fCommandControl.getContext(), true, rm); >+ return; >+ } >+ } >+ //TODO khouzam must set rm.setdata() >+ rm.done(); >+ return; >+ } >+ >+ // When it is not an attach session, it gets a little more complicated >+ // so let's use a sequence. >+ ImmediateExecutor.getInstance().execute(new StartOrRestartProcessSequence(containerDmc, attributes, restart, rm)); >+ } >+ >+ /** >+ * This method indicates if we should use the -exec-continue method >+ * instead of the -exec-run method. >+ * This can be overridden to allow for customization. >+ */ >+ protected boolean useContinueCommand(Map<String, Object> attributes, boolean restart) { >+ // When doing remote debugging, we use -exec-continue instead of -exec-run >+ // Restart does not apply to remote sessions >+ return fBackend.getSessionType() == SessionType.REMOTE; >+ } >+} >+ >Index: src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java,v >retrieving revision 1.14 >diff -u -r1.14 GdbDebugServicesFactory.java >--- src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java 27 Sep 2010 01:13:38 -0000 1.14 >+++ src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java 2 Dec 2010 02:13:18 -0000 >@@ -27,6 +27,7 @@ > import org.eclipse.cdt.dsf.gdb.service.command.CommandFactory_6_8; > import org.eclipse.cdt.dsf.gdb.service.command.GDBControl; > import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_0; >+import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_2; > import org.eclipse.cdt.dsf.mi.service.CSourceLookup; > import org.eclipse.cdt.dsf.mi.service.IMIBackend; > import org.eclipse.cdt.dsf.mi.service.MIBreakpoints; >@@ -100,6 +101,9 @@ > } > > protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) { >+ if (GDB_7_2_VERSION.compareTo(fVersion) <= 0) { >+ return new GDBControl_7_2(session, config, new CommandFactory_6_8()); >+ } > if (GDB_7_0_VERSION.compareTo(fVersion) <= 0) { > return new GDBControl_7_0(session, config, new CommandFactory_6_8()); > } >@@ -139,6 +143,9 @@ > > @Override > protected IProcesses createProcessesService(DsfSession session) { >+ if (GDB_7_2_VERSION.compareTo(fVersion) <= 0) { >+ return new GDBProcesses_7_2(session); >+ } > if (GDB_7_1_VERSION.compareTo(fVersion) <= 0) { > return new GDBProcesses_7_1(session); > } >Index: src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_2.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_2.java >diff -N src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 2006, 2010 Wind River Systems 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: >+ * Wind River Systems - initial API and implementation >+ * Ericsson - Modified for additional features in DSF Reference implementation >+ * Ericsson - New version for 7_0 >+ * Vladimir Prus (CodeSourcery) - Support for -data-read-memory-bytes (bug 322658) >+ * Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) >+ *******************************************************************************/ >+package org.eclipse.cdt.dsf.gdb.service.command; >+ >+import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; >+import org.eclipse.cdt.dsf.service.DsfSession; >+import org.eclipse.debug.core.ILaunchConfiguration; >+ >+/** >+ * GDB Debugger control implementation. This implementation extends the >+ * base MI control implementation to provide the GDB-specific debugger >+ * features. This includes:<br> >+ * - CLI console support,<br> >+ * - inferior process status tracking.<br> >+ * @since 4.0 >+ */ >+public class GDBControl_7_2 extends GDBControl_7_0 implements IGDBControl { >+ /** >+ * @since 3.0 >+ */ >+ public GDBControl_7_2(DsfSession session, ILaunchConfiguration config, CommandFactory factory) { >+ super(session, config, factory); >+ setUseThreadGroupOptions(true); >+ } >+} >Index: src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java,v >retrieving revision 1.15 >diff -u -r1.15 AbstractMIControl.java >--- src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java 22 Nov 2010 14:29:48 -0000 1.15 >+++ src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java 2 Dec 2010 02:13:19 -0000 >@@ -40,6 +40,7 @@ > import org.eclipse.cdt.dsf.debug.service.command.IEventListener; > import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; > import org.eclipse.cdt.dsf.mi.service.IMICommandControl; >+import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; > import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; > import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; > import org.eclipse.cdt.dsf.mi.service.command.commands.RawCommand; >@@ -86,6 +87,9 @@ > private int fCurrentStackLevel = -1; > private String fCurrentThreadId = null; > >+ // boolean for --thread-group option which helps to handle multiple inferior behaviour. >+ // Since GDB.7.1 >+ private boolean fUseThreadGroupOption; > > private final BlockingQueue<CommandHandle> fTxCommands = new LinkedBlockingQueue<CommandHandle>(); > private final Map<Integer, CommandHandle> fRxCommands = Collections.synchronizedMap(new HashMap<Integer, CommandHandle>()); >@@ -124,17 +128,31 @@ > private CommandFactory fCommandFactory; > > public AbstractMIControl(DsfSession session) { >- super(session); >- fUseThreadAndFrameOptions = false; >- fCommandFactory = new CommandFactory(); >+ this(session, false, false, new CommandFactory()); > } > > /** > * @since 3.0 > */ > public AbstractMIControl(DsfSession session, boolean useThreadAndFrameOptions, CommandFactory factory) { >+ this(session, false, useThreadAndFrameOptions, factory); >+ } >+ >+ /** >+ * @since 4.0 >+ */ >+ public AbstractMIControl(DsfSession session, boolean useThreadGroupOption, boolean useThreadAndFrameOptions, CommandFactory factory) { > super(session); >+ >+ // If we use the --thread-group option, we should automatically use the --thread option >+ assert useThreadGroupOption ? useThreadAndFrameOptions : true; >+ >+ fUseThreadGroupOption = useThreadGroupOption; > fUseThreadAndFrameOptions = useThreadAndFrameOptions; >+ if (fUseThreadGroupOption) { >+ // If we use --thread-group option, we should automatically use the --thread option >+ fUseThreadAndFrameOptions = true; >+ } > fCommandFactory = factory; > } > >@@ -163,7 +181,15 @@ > protected void setUseThreadAndFrameOptions(boolean shouldUse) { > fUseThreadAndFrameOptions = shouldUse; > } >- >+ /** >+ * @since 4.0 >+ */ >+ protected void setUseThreadGroupOptions(boolean shouldUse) { >+ fUseThreadGroupOption = shouldUse; >+ if (shouldUse) { >+ fUseThreadAndFrameOptions = true; >+ } >+ } > /** > * @since 3.0 > */ >@@ -510,6 +536,13 @@ > return null; > } > >+ public String getGroupId() { >+ IMIContainerDMContext containerCtx = DMContexts.getAncestorOfType(fCommand.getContext(), IMIContainerDMContext.class); >+ if(containerCtx != null) >+ return containerCtx.getGroupId(); >+ return null; >+ } >+ > @Override > public String toString() { > return Integer.toString(fTokenId) + fCommand; >@@ -567,13 +600,16 @@ > */ > > final String str; >- // Not all commands support the --thread/--frame options (e.g., CLI commands) >- if (fUseThreadAndFrameOptions && commandHandle.getCommand().supportsThreadAndFrameOptions()) { >- str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(commandHandle.getThreadId(), >- commandHandle.getStackFrameId()); >- } else if (commandHandle.getCommand() instanceof RawCommand) { >+ if (commandHandle.getCommand() instanceof RawCommand) { > // RawCommands CANNOT have a token id: GDB would read it as part of the RawCommand! > str = commandHandle.getCommand().constructCommand(); >+ } else if (fUseThreadGroupOption) { >+ str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(commandHandle.getGroupId(), >+ commandHandle.getThreadId(), >+ commandHandle.getStackFrameId()); >+ } else if (fUseThreadAndFrameOptions) { >+ str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(commandHandle.getThreadId(), >+ commandHandle.getStackFrameId()); > } else { > str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(); > } >Index: src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java,v >retrieving revision 1.18 >diff -u -r1.18 CommandFactory.java >--- src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java 30 Nov 2010 14:42:49 -0000 1.18 >+++ src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java 2 Dec 2010 02:13:19 -0000 >@@ -28,6 +28,7 @@ > import org.eclipse.cdt.dsf.debug.service.command.ICommand; > import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; > import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceTargetDMContext; >+import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; > import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; > import org.eclipse.cdt.dsf.mi.service.command.commands.CLIAttach; > import org.eclipse.cdt.dsf.mi.service.command.commands.CLICatch; >@@ -525,11 +526,17 @@ > return new MIExecUntil(dmc, loc); > } > >- public ICommand<MIInfo> createMIFileExecAndSymbols(ICommandControlDMContext dmc, String file) { >+ /** >+ * @since 4.0 >+ */ >+ public ICommand<MIInfo> createMIFileExecAndSymbols(IMIContainerDMContext dmc, String file) { > return new MIFileExecAndSymbols(dmc, file); > } > >- public ICommand<MIInfo> createMIFileExecAndSymbols(ICommandControlDMContext dmc) { >+ /** >+ * @since 4.0 >+ */ >+ public ICommand<MIInfo> createMIFileExecAndSymbols(IMIContainerDMContext dmc) { > return new MIFileExecAndSymbols(dmc); > } > >@@ -686,10 +693,24 @@ > return new MITargetAttach(ctx, groupId); > } > >+ /** >+ * @since 4.0 >+ */ >+ public ICommand<MIInfo> createMITargetAttach(IMIContainerDMContext ctx, String groupId) { >+ return new MITargetAttach(ctx, groupId); >+ } >+ > public ICommand<MIInfo> createMITargetDetach(ICommandControlDMContext ctx, String groupId) { > return new MITargetDetach(ctx, groupId); > } > >+ /** >+ * @since 4.0 >+ */ >+ public ICommand<MIInfo> createMITargetDetach(IMIContainerDMContext ctx) { >+ return new MITargetDetach(ctx); >+ } >+ > public ICommand<MIInfo> createMITargetSelect(IDMContext ctx, String[] params) { > return new MITargetSelect(ctx, params); > } >Index: src/org/eclipse/cdt/dsf/mi/service/command/commands/MICommand.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MICommand.java,v >retrieving revision 1.2 >diff -u -r1.2 MICommand.java >--- src/org/eclipse/cdt/dsf/mi/service/command/commands/MICommand.java 4 Mar 2010 14:00:01 -0000 1.2 >+++ src/org/eclipse/cdt/dsf/mi/service/command/commands/MICommand.java 2 Dec 2010 02:13:19 -0000 >@@ -141,16 +141,26 @@ > * @since 1.1 > */ > public String constructCommand(String threadId, int frameId) { >+ return constructCommand(null, threadId, frameId); >+ } >+ >+ /** >+ * GDB 7.2 thread-group needed to support multiple behaviour. >+ * @since 4.0 >+ */ >+ public String constructCommand(String groupId, String threadId, int frameId) { > StringBuffer command = new StringBuffer(getOperation()); > > // Add the --thread option >- if (threadId != null) { >+ if (supportsThreadAndFrameOptions() && threadId != null) { > command.append(" --thread " + threadId); //$NON-NLS-1$ > > // Add the --frame option, but only if we are using the --thread option > if (frameId >= 0) { > command.append(" --frame " + frameId); //$NON-NLS-1$ > } >+ } else if (supportsThreadGroupOption() && groupId != null) { >+ command.append(" --thread-group " + groupId); //$NON-NLS-1$ > } > > String opt = optionsToString(); >@@ -164,7 +174,6 @@ > command.append('\n'); > return command.toString(); > } >- > // /* > // * Checks to see if the current command can be coalesced with the > // * supplied command. >@@ -241,6 +250,11 @@ > * @since 1.1 > */ > public boolean supportsThreadAndFrameOptions() { return true; } >+ >+ /** >+ * @since 4.0 >+ */ >+ public boolean supportsThreadGroupOption() { return false; } > > /** > * Compare commands based on the MI command string that they generate, >Index: src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecAndSymbols.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecAndSymbols.java,v >retrieving revision 1.4 >diff -u -r1.4 MIFileExecAndSymbols.java >--- src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecAndSymbols.java 12 Aug 2010 19:55:15 -0000 1.4 >+++ src/org/eclipse/cdt/dsf/mi/service/command/commands/MIFileExecAndSymbols.java 2 Dec 2010 02:13:19 -0000 >@@ -11,7 +11,7 @@ > > package org.eclipse.cdt.dsf.mi.service.command.commands; > >-import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; >+import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; > import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; > > /** >@@ -26,16 +26,23 @@ > public class MIFileExecAndSymbols extends MICommand<MIInfo> > { > /** >- * @since 1.1 >+ * @since 4.0 > */ >- public MIFileExecAndSymbols(ICommandControlDMContext dmc, String file) { >+ public MIFileExecAndSymbols(IMIContainerDMContext dmc, String file) { > super(dmc, "-file-exec-and-symbols", null, new String[] {file}); //$NON-NLS-1$ > } > > /** >- * @since 1.1 >+ * @since 4.0 > */ >- public MIFileExecAndSymbols(ICommandControlDMContext dmc) { >+ public MIFileExecAndSymbols(IMIContainerDMContext dmc) { > super(dmc, "-file-exec-and-symbols"); //$NON-NLS-1$ > } >+ >+ @Override >+ public boolean supportsThreadGroupOption() { >+ return true; >+ } >+ >+ > } >Index: src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetAttach.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetAttach.java,v >retrieving revision 1.2 >diff -u -r1.2 MITargetAttach.java >--- src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetAttach.java 3 Jun 2010 00:09:35 -0000 1.2 >+++ src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetAttach.java 2 Dec 2010 02:13:19 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008, 2009 Ericsson and others. >+ * Copyright (c) 2008, 2010 Ericsson 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 >@@ -11,6 +11,7 @@ > package org.eclipse.cdt.dsf.mi.service.command.commands; > > import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; >+import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; > import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; > > /** >@@ -25,4 +26,21 @@ > public MITargetAttach(ICommandControlDMContext ctx, String groupId) { > super(ctx, "-target-attach", new String[] {groupId}); //$NON-NLS-1$ > } >+ >+ /** >+ * @since 4.0 >+ */ >+ /* >+ public MITargetAttach(IMIContainerDMContext ctx, String pid) { >+ super(ctx, "-target-attach", new String[] {"--thread-group", ctx.getGroupId()}, new String[] {pid}); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ */ >+ public MITargetAttach(IMIContainerDMContext ctx, String pid) { >+ super(ctx, "-target-attach", new String[] {pid}); //$NON-NLS-1$ >+ } >+ >+ @Override >+ public boolean supportsThreadGroupOption() { >+ return true; >+ } > } >Index: src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDetach.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDetach.java,v >retrieving revision 1.2 >diff -u -r1.2 MITargetDetach.java >--- src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDetach.java 3 Jun 2010 00:09:35 -0000 1.2 >+++ src/org/eclipse/cdt/dsf/mi/service/command/commands/MITargetDetach.java 2 Dec 2010 02:13:19 -0000 >@@ -11,6 +11,7 @@ > package org.eclipse.cdt.dsf.mi.service.command.commands; > > import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; >+import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; > import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; > > /** >@@ -25,4 +26,11 @@ > public MITargetDetach(ICommandControlDMContext ctx, String groupId) { > super(ctx, "-target-detach", new String[] {groupId}); //$NON-NLS-1$ > } >+ >+ /** >+ * @since 4.0 >+ */ >+ public MITargetDetach(IMIContainerDMContext ctx) { >+ super(ctx, "-target-detach", new String[] {"--thread-group", ctx.getGroupId()}); //$NON-NLS-1$ //$NON-NLS-2$ >+ } > } >#P org.eclipse.cdt.dsf.gdb.ui >Index: src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java,v >retrieving revision 1.16 >diff -u -r1.16 GdbAdapterFactory.java >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java 30 Nov 2010 15:19:26 -0000 1.16 >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java 2 Dec 2010 02:13:20 -0000 >@@ -159,7 +159,7 @@ > fResumeWithoutSignalCommand = new GdbResumeWithoutSignalCommand(session); > fRestartCommand = new GdbRestartCommand(session, fLaunch); > fTerminateCommand = new DsfTerminateCommand(session); >- fConnectCommand = new GdbConnectCommand(session); >+ fConnectCommand = new GdbConnectCommand(session, fLaunch); > fDisconnectCommand = new GdbDisconnectCommand(session); > fSuspendTrigger = new GdbSuspendTrigger(session, fLaunch); > fModelSelectionPolicyFactory = new DefaultDsfModelSelectionPolicyFactory(); >Index: src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java,v >retrieving revision 1.4 >diff -u -r1.4 GdbConnectCommand.java >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java 30 Jul 2010 17:45:37 -0000 1.4 >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java 2 Dec 2010 02:13:20 -0000 >@@ -11,7 +11,9 @@ > package org.eclipse.cdt.dsf.gdb.internal.ui.actions; > > import java.util.ArrayList; >+import java.util.HashMap; > import java.util.List; >+import java.util.Map; > import java.util.concurrent.ExecutionException; > import java.util.concurrent.RejectedExecutionException; > >@@ -42,15 +44,23 @@ > import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.IStatusHandler; >+import org.eclipse.debug.core.Launch; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.FileDialog; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.ui.PlatformUI; > > public class GdbConnectCommand implements IConnect { > > private final DsfExecutor fExecutor; > private final DsfServicesTracker fTracker; >+ private final Launch fLaunch; > >- public GdbConnectCommand(DsfSession session) { >+ public GdbConnectCommand(DsfSession session, Launch launch) { > fExecutor = session.getExecutor(); > fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId()); >+ fLaunch = launch; > } > > public void dispose() { >@@ -115,6 +125,12 @@ > } > > try { >+ // Add an entry to create a new process >+ IProcessExtendedInfo[] newArray = new IProcessExtendedInfo[fProcessList.length + 1]; >+ System.arraycopy(fProcessList, 0, newArray, 1, fProcessList.length); >+ newArray[0] = new ProcessInfo(-1, "! <Create new process> !"); >+ fProcessList = newArray; >+ > Object result = prompter.handleStatus(processPromptStatus, fProcessList); > if (result instanceof Integer) { > fRequestMonitor.setData((Integer)result); >@@ -172,9 +188,38 @@ > // New cycle, look for service again > final IMIProcesses procService = fTracker.getService(IMIProcesses.class); > if (procService != null) { >+ if (getData() == -1) { >+ // We want to create a new process instead >+ Map<String, Object> attributes = new HashMap<String, Object>(); >+ try { >+ attributes = fLaunch.getLaunchConfiguration().getAttributes(); >+ } catch (CoreException e) { >+ } >+ final String[] binaryPath = new String[1]; >+ >+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { >+ public void run() { >+ Shell shell = Display.getDefault().getActiveShell(); >+ if (shell == null) { >+ return; >+ } >+ >+ FileDialog fd = new FileDialog(shell, SWT.SAVE); >+ binaryPath[0] = fd.open(); >+ } >+ }); >+ procService.debugNewProcess(controlCtx, >+ binaryPath[0], >+ attributes, >+ new DataRequestMonitor<IDMContext>(fExecutor, rm)); >+ return; >+ } >+ > IProcessDMContext procDmc = procService.createProcessContext(controlCtx, > Integer.toString(getData())); > procService.attachDebuggerToProcess(procDmc, new DataRequestMonitor<IDMContext>(fExecutor, rm)); >+ } else { >+ rm.done(); > } > } > }).schedule();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
marc.khouzam
:
iplog-
Actions:
View
|
Diff
Attachments on
bug 237306
:
166478
|
167440
|
168092
|
168093
|
168510
|
176501
|
178929
|
179595
|
179596
|
179913
|
182593
|
184318
|
185285
|
185617
|
185691
|
186266
|
187326
|
187357
|
190931
|
190997