From dbc896916465b55371cebf17747875fd411c53dc Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Wed, 29 Jun 2011 11:49:37 -0400 Subject: [PATCH] Bug 350365: Remote attach session should use specified binary --- .../ui/actions/GdbConnectCommand.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java index c7ce9d8e65b..4b15eca37a0 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java @@ -71,6 +71,8 @@ public class GdbConnectCommand implements IConnect { // with the same name without having to be prompted each time for a path. // This map is associated to the current debug session only, therefore the user can // reset it by using a new debug session. + // This map is only needed for remote sessions, since we don't need to specify + // the binary location for a local attach session. private Map fProcessNameToBinaryMap = new HashMap(); public GdbConnectCommand(DsfSession session) { @@ -187,6 +189,23 @@ public class GdbConnectCommand implements IConnect { @Override public IStatus runInUIThread(IProgressMonitor monitor) { + + // If this is the very first attach of a remote session, check if the user + // specified the binary in the launch. If so, let's add it to our map to + // avoid having to prompt the user for that binary. + // This would be particularly annoying since we didn't use to have + // to do that before we supported multi-process. + // Bug 350365 + if (fProcessNameToBinaryMap.isEmpty()) { + IGDBBackend backend = fTracker.getService(IGDBBackend.class); + if (backend != null) { + IPath binaryPath = backend.getProgramPath(); + if (binaryPath != null && !binaryPath.isEmpty()) { + fProcessNameToBinaryMap.put(binaryPath.lastSegment(), binaryPath.toOSString()); + } + } + } + // Have we already see the binary for a process with this name? String binaryPath = fProcessNameToBinaryMap.get(fProcName);