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 190997 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]
Prompt for a binary when doing remote attach
zpatch.attachBinary3.txt (text/plain), 13.88 KB, created by
Marc Khouzam
on 2011-03-11 11:34:44 EST
(
hide
)
Description:
Prompt for a binary when doing remote attach
Filename:
MIME Type:
Creator:
Marc Khouzam
Created:
2011-03-11 11:34:44 EST
Size:
13.88 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.dsf.gdb >Index: src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java,v >retrieving revision 1.20 >diff -u -r1.20 GDBProcesses.java >--- src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java 10 Mar 2011 11:13:19 -0000 1.20 >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java 11 Mar 2011 16:29:30 -0000 >@@ -57,7 +57,6 @@ > import org.eclipse.cdt.dsf.service.DsfSession; > import org.eclipse.cdt.utils.pty.PTY; > import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.Status; >@@ -224,11 +223,14 @@ > } > > @Override >- public void attachDebuggerToProcess(final IProcessDMContext procCtx, final DataRequestMonitor<IDMContext> rm) { >- // For remote attach, we must set the binary first >- // For a local attach, GDB can figure out the binary automatically, >- // so we don't specify it. >- >+ public void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm) { >+ attachDebuggerToProcess(procCtx, null, rm); >+ } >+ >+ /** >+ * @since 4.0 >+ */ >+ public void attachDebuggerToProcess(final IProcessDMContext procCtx, String binaryPath, final DataRequestMonitor<IDMContext> rm) { > final IMIContainerDMContext containerDmc = createContainerContext(procCtx, MIProcesses.UNIQUE_GROUP_ID); > > DataRequestMonitor<MIInfo> attachRm = new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm) { >@@ -253,14 +255,11 @@ > } > }; > >- if (fBackend.getSessionType() == SessionType.REMOTE) { >- final IPath execPath = fBackend.getProgramPath(); >- if (execPath != null && !execPath.isEmpty()) { >- fGdb.queueCommand( >- fCommandFactory.createMIFileExecAndSymbols(containerDmc, execPath.toPortableString()), >- attachRm); >- return; >- } >+ if (binaryPath != null) { >+ fGdb.queueCommand( >+ fCommandFactory.createMIFileExecAndSymbols(containerDmc, binaryPath), >+ attachRm); >+ return; > } > > // If we get here, let's do the attach by completing the requestMonitor >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.41 >diff -u -r1.41 GDBProcesses_7_0.java >--- src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java 10 Mar 2011 01:51:17 -0000 1.41 >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java 11 Mar 2011 16:29:30 -0000 >@@ -79,7 +79,6 @@ > import org.eclipse.cdt.dsf.service.DsfServiceEventHandler; > import org.eclipse.cdt.dsf.service.DsfSession; > import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.Status; >@@ -754,7 +753,14 @@ > rm.done(); > } > >- public void attachDebuggerToProcess(final IProcessDMContext procCtx, final DataRequestMonitor<IDMContext> dataRm) { >+ public void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm) { >+ attachDebuggerToProcess(procCtx, null, rm); >+ } >+ >+ /** >+ * @since 4.0 >+ */ >+ public void attachDebuggerToProcess(final IProcessDMContext procCtx, final String binaryPath, final DataRequestMonitor<IDMContext> dataRm) { > if (procCtx instanceof IMIProcessDMContext) { > if (!doIsDebuggerAttachSupported()) { > dataRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Attach not supported.", null)); //$NON-NLS-1$ >@@ -784,14 +790,11 @@ > // There is no groupId until we attach, so we can use the default groupId > fContainerDmc = createContainerContext(procCtx, MIProcesses.UNIQUE_GROUP_ID); > >- if (fBackend.getSessionType() == SessionType.REMOTE) { >- final IPath execPath = fBackend.getProgramPath(); >- if (execPath != null && !execPath.isEmpty()) { >- fCommandControl.queueCommand( >- fCommandFactory.createMIFileExecAndSymbols(fContainerDmc, execPath.toPortableString()), >- new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm)); >- return; >- } >+ if (binaryPath != null) { >+ fCommandControl.queueCommand( >+ fCommandFactory.createMIFileExecAndSymbols(fContainerDmc, binaryPath), >+ new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm)); >+ return; > } > > rm.done(); >Index: src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java,v >retrieving revision 1.5 >diff -u -r1.5 GDBProcesses_7_2.java >--- src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java 16 Feb 2011 11:39:41 -0000 1.5 >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java 11 Mar 2011 16:29:30 -0000 >@@ -33,7 +33,6 @@ > 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.IPath; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; > import org.eclipse.debug.core.ILaunch; >@@ -100,7 +99,15 @@ > } > > @Override >- public void attachDebuggerToProcess(final IProcessDMContext procCtx, final DataRequestMonitor<IDMContext> dataRm) { >+ public void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm) { >+ attachDebuggerToProcess(procCtx, null, rm); >+ } >+ >+ /** >+ * @since 4.0 >+ */ >+ @Override >+ public void attachDebuggerToProcess(final IProcessDMContext procCtx, final String binaryPath, final DataRequestMonitor<IDMContext> dataRm) { > if (procCtx instanceof IMIProcessDMContext) { > if (!doIsDebuggerAttachSupported()) { > dataRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Attach not supported.", null)); //$NON-NLS-1$ >@@ -143,20 +150,14 @@ > }); > } > }, >- // For remote attach, we must set the binary first >- // For a local attach, GDB can figure out the binary automatically, >- // so we don't specify it. > new Step() { > @Override > public void execute(RequestMonitor rm) { >- if (fBackend.getSessionType() == SessionType.REMOTE) { >- final IPath execPath = fBackend.getProgramPath(); >- if (execPath != null && !execPath.isEmpty()) { >- fCommandControl.queueCommand( >- fCommandFactory.createMIFileExecAndSymbols(fContainerDmc, execPath.toPortableString()), >- new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm)); >- return; >- } >+ if (binaryPath != null) { >+ fCommandControl.queueCommand( >+ fCommandFactory.createMIFileExecAndSymbols(fContainerDmc, binaryPath), >+ new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm)); >+ return; > } > > rm.done(); >Index: src/org/eclipse/cdt/dsf/gdb/service/IGDBProcesses.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/IGDBProcesses.java,v >retrieving revision 1.7 >diff -u -r1.7 IGDBProcesses.java >--- src/org/eclipse/cdt/dsf/gdb/service/IGDBProcesses.java 25 Feb 2011 02:20:32 -0000 1.7 >+++ src/org/eclipse/cdt/dsf/gdb/service/IGDBProcesses.java 11 Mar 2011 16:29:30 -0000 >@@ -14,6 +14,7 @@ > import java.util.Map; > > import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; >+import org.eclipse.cdt.dsf.datamodel.IDMContext; > import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; > import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; > import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; >@@ -90,5 +91,17 @@ > * @since 4.0 > */ > void start(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm); >+ >+ /** >+ * Attaches debugger to the given process. >+ * When attaching to a process, a debugging context can now be used to characterize the process. >+ * This method can optionally choose to return this IDMContext inside the DataRequestMonitor. >+ * This can be useful for backends that do not have the ability to obtain the different >+ * debugging IDMContexts through {@link #getProcessesBeingDebugged(IDMContext, DataRequestMonitor) >+ * >+ * @param file Binary to use for the process. >+ * @since 4.0 >+ */ >+ void attachDebuggerToProcess(IProcessDMContext procCtx, String file, DataRequestMonitor<IDMContext> rm); > > } >#P org.eclipse.cdt.dsf.gdb.ui >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.5 >diff -u -r1.5 GdbConnectCommand.java >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java 10 Mar 2011 21:28:59 -0000 1.5 >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java 11 Mar 2011 16:29:30 -0000 >@@ -34,8 +34,10 @@ > import org.eclipse.cdt.dsf.gdb.internal.ui.launching.ProcessPrompter.PrompterInfo; > import org.eclipse.cdt.dsf.gdb.launching.IProcessExtendedInfo; > import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages; >+import org.eclipse.cdt.dsf.gdb.service.IGDBBackend; >+import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses; > import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData; >-import org.eclipse.cdt.dsf.mi.service.IMIProcesses; >+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.core.runtime.CoreException; >@@ -45,6 +47,11 @@ > import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.IStatusHandler; >+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 { > >@@ -181,7 +188,7 @@ > @Override > protected void handleSuccess() { > // New cycle, look for service again >- final IMIProcesses procService = fTracker.getService(IMIProcesses.class); >+ final IGDBProcesses procService = fTracker.getService(IGDBProcesses.class); > if (procService != null) { > Object data = getData(); > if (data instanceof String) { >@@ -192,9 +199,27 @@ > // khouzam, maybe we should at least pass stopOnMain? > new HashMap<String, Object>(), new DataRequestMonitor<IDMContext>(fExecutor, rm)); > } else if (data instanceof Integer) { >+ final String[] binaryPath = new String[1]; >+ binaryPath[0] = null; >+ final IGDBBackend backend = fTracker.getService(IGDBBackend.class); >+ if (backend != null && backend.getSessionType() == SessionType.REMOTE) { >+ // For remote attach, we must set the binary first >+ // For a local attach, GDB can figure out the binary automatically, >+ // so we don't specify it. >+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { >+ public void run() { >+ Shell shell = Display.getCurrent().getActiveShell(); >+ if (shell != null) { >+ FileDialog fd = new FileDialog(shell, SWT.NONE); >+ binaryPath[0] = fd.open(); >+ } >+ } >+ }); >+ } >+ > IProcessDMContext procDmc = procService.createProcessContext(controlCtx, > Integer.toString((Integer)getData())); >- procService.attachDebuggerToProcess(procDmc, new DataRequestMonitor<IDMContext>(fExecutor, rm)); >+ procService.attachDebuggerToProcess(procDmc, binaryPath[0], new DataRequestMonitor<IDMContext>(fExecutor, rm)); > } else { > rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Invalid return type for process prompter", null)); //$NON-NLS-1$ > rm.done(); >Index: src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompterDialog.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompterDialog.java,v >retrieving revision 1.1 >diff -u -r1.1 ProcessPrompterDialog.java >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompterDialog.java 10 Mar 2011 21:28:58 -0000 1.1 >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompterDialog.java 11 Mar 2011 16:29:30 -0000 >@@ -30,7 +30,7 @@ > @Override > protected void buttonPressed(int buttonId) { > if (buttonId == NEW_BUTTON_ID) { >- FileDialog fd = new FileDialog(getShell(), SWT.SAVE); >+ FileDialog fd = new FileDialog(getShell(), SWT.NONE); > fBinaryPath = fd.open(); > > setReturnCode(OK);
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