From 8ca35f737a689680b786ef35e17f1e3ab7e59a1d Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Thu, 20 Dec 2012 21:39:20 -0500 Subject: [PATCH] Bug 396386 - Cannot attach to process when prompted for a pid Change-Id: I9a682bd7be70b6633f2e455a76dba4bcfa801eec Reviewed-on: https://git.eclipse.org/r/9352 Reviewed-by: Marc-Andre Laperle Reviewed-by: Marc Khouzam IP-Clean: Marc Khouzam Tested-by: Marc Khouzam --- .../dsf/gdb/internal/ui/commands/GdbConnectCommand.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbConnectCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbConnectCommand.java index d90dc5752ac..d797a6e48ae 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbConnectCommand.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbConnectCommand.java @@ -164,6 +164,9 @@ public class GdbConnectCommand extends AbstractDebugCommand implements IConnectH fRequestMonitor.cancel(); } else if (result instanceof IProcessExtendedInfo[] || result instanceof String) { fRequestMonitor.setData(result); + } else if (result instanceof Integer) { + // This is the case where the user typed in a pid number directly + fRequestMonitor.setData(new IProcessExtendedInfo[] { new ProcessInfo((Integer)result, "")}); //$NON-NLS-1$ } else { fRequestMonitor.setStatus(NO_PID_STATUS); } @@ -231,8 +234,10 @@ public class GdbConnectCommand extends AbstractDebugCommand implements IConnectH protected void handleSuccess() { // Store the path of the binary so we can use it again for another process // with the same name. Only do this on success, to avoid being stuck with - // a path that is invalid - fProcessNameToBinaryMap.put(fProcName, finalBinaryPath); + // a path that is invalid. + if (fProcName != null && !fProcName.isEmpty()) { + fProcessNameToBinaryMap.put(fProcName, finalBinaryPath); + } fRm.done(); }; });