From 6240b802f427719a5d68441ca9a0bb23869badeb Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sun, 1 Mar 2009 02:35:50 +0000 Subject: [PATCH] [266599] For remote attach launches, we no longer force the user to attach right away. --- .../dsf/gdb/launching/FinalLaunchSequence.java | 11 ++++++++++- .../cdt/dsf/gdb/service/GDBProcesses_7_0.java | 16 ++++++++++++++++ .../dsf/gdb/service/GdbDebugServicesFactory.java | 2 +- .../cdt/dsf/gdb/service/command/GDBControl.java | 11 ++++++----- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java index c779e58e4c1..3b6394ace2b 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java @@ -388,7 +388,16 @@ public class FinalLaunchSequence extends Sequence { new Step() { @Override public void execute(final RequestMonitor requestMonitor) { - if (fAttach) { + // A local attach can figure out the binary from the attach + // command. This allows the user not to specify the binary + // in the launch. But for breakpoints to work, we must do the + // attach before we set the breakpoints, i.e., here. + // On the other hand, for a remote attach, we need to specify + // the binary anyway, or use the solib command. In both cases, + // breakpoints can be set before we attach. Therefore, we don't + // force an attach here, but wait for the user to decide to connect + // using the connect action. + if (fAttach && fSessionType != SessionType.REMOTE) { // If we are attaching, get the process id. int pid = -1; try { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java index eb9bb96e130..65a81a6900d 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java @@ -543,6 +543,14 @@ public class GDBProcesses_7_0 extends AbstractDsfService } public void isDebuggerAttachSupported(IDMContext dmc, DataRequestMonitor rm) { + // Until bug 256798 is fixed, the service tracker could be null + if (getServicesTracker() == null) { + // service is shutdown + rm.setData(false); + rm.done(); + return; + } + IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class); rm.setData(backend.getIsAttachSession()); rm.done(); @@ -570,6 +578,14 @@ public class GDBProcesses_7_0 extends AbstractDsfService } public void canDetachDebuggerFromProcess(IDMContext dmc, DataRequestMonitor rm) { + // Until bug 256798 is fixed, the service tracker could be null + if (getServicesTracker() == null) { + // service is shutdown + rm.setData(false); + rm.done(); + return; + } + IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class); rm.setData(backend.getIsAttachSession() && fCommandControl.isConnected()); rm.done(); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java index 32c33595517..3215e1693f4 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java @@ -126,7 +126,7 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory { // Multi-process is not part of GDB HEAD yet, // but is part of this very specific build. // We'll need to change this when 7.0 is ready - if (fVersion.startsWith("6.8.50.20081118")) { //$NON-NLS-1$ + if (fVersion.startsWith("6.8.50.20090218")) { //$NON-NLS-1$ return new GDBProcesses_7_0(session); } return new GDBProcesses(session); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java index 80a1ebd9a2b..338c0676ebf 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java @@ -99,7 +99,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { private IGDBBackend fMIBackend; - private boolean fConnected = true; + private boolean fConnected = false; private MIRunControlEventProcessor fMIEventProcessor; private CLIEventProcessor fCLICommandProcessor; @@ -354,11 +354,12 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { fInferiorProcess = new GDBInferiorProcess(GDBControl.this, fMIBackend, fPty); } } - - public boolean isConnected() { - return fInferiorProcess.getState() != MIInferiorProcess.State.TERMINATED && fConnected; - } + public boolean isConnected() { + return fInferiorProcess.getState() != MIInferiorProcess.State.TERMINATED && + (!fMIBackend.getIsAttachSession() || fConnected); + } + public void setConnected(boolean connected) { fConnected = connected; }