mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 20:05:35 +02:00
[240092] Move getSessionType() and getIsAttachSession() from IGDBControl to IGDBBackend. Also, remove IGDBControl.getExecutablePath() since IGDBBackend.getProgramPath() did the same thing.
This commit is contained in:
parent
0113d94674
commit
cd35fa70ba
11 changed files with 60 additions and 73 deletions
|
@ -23,6 +23,7 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.dd.dsf.service.DsfSession;
|
import org.eclipse.dd.dsf.service.DsfSession;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
||||||
|
import org.eclipse.dd.gdb.internal.provisional.service.IGDBBackend;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
||||||
import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin;
|
import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
@ -76,8 +77,9 @@ public class GdbRestartCommand implements IRestart {
|
||||||
@Override
|
@Override
|
||||||
protected void execute(final DataRequestMonitor<Object> rm) {
|
protected void execute(final DataRequestMonitor<Object> rm) {
|
||||||
final IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
|
final IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
|
||||||
if (gdbControl != null) {
|
final IGDBBackend backend = fTracker.getService(IGDBBackend.class);
|
||||||
execPathRef.set(gdbControl.getExecutablePath());
|
if (gdbControl != null && backend != null) {
|
||||||
|
execPathRef.set(backend.getProgramPath());
|
||||||
gdbControl.initInferiorInputOutput(new RequestMonitor(fExecutor, rm) {
|
gdbControl.initInferiorInputOutput(new RequestMonitor(fExecutor, rm) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
|
||||||
import org.eclipse.dd.dsf.service.DsfSession;
|
import org.eclipse.dd.dsf.service.DsfSession;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.breakpoints.CBreakpointGdbThreadsFilterExtension;
|
import org.eclipse.dd.gdb.internal.provisional.breakpoints.CBreakpointGdbThreadsFilterExtension;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
import org.eclipse.dd.gdb.internal.provisional.service.IGDBBackend;
|
||||||
import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin;
|
import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin;
|
||||||
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
|
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
|
||||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||||
|
@ -468,14 +468,14 @@ public class GdbThreadFilterEditor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceTracker tracker = new ServiceTracker(GdbUIPlugin.getBundleContext(), IGDBControl.class
|
ServiceTracker tracker = new ServiceTracker(GdbUIPlugin.getBundleContext(), IGDBBackend.class
|
||||||
.getName(), null);
|
.getName(), null);
|
||||||
tracker.open();
|
tracker.open();
|
||||||
IGDBControl gdbControl = (IGDBControl) tracker.getService();
|
IGDBBackend backend = (IGDBBackend) tracker.getService();
|
||||||
if (gdbControl != null) {
|
if (backend != null) {
|
||||||
rm.setData(gdbControl.getExecutablePath().toOSString());
|
rm.setData(backend.getProgramPath().toOSString());
|
||||||
} else {
|
} else {
|
||||||
rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "GDB Control not accessible.")); //$NON-NLS-1$
|
rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "GDB Backend not accessible.")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
rm.done();
|
rm.done();
|
||||||
tracker.close();
|
tracker.close();
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class FinalLaunchSequence extends Sequence {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final IPath execPath = fCommandControl.getExecutablePath();
|
final IPath execPath = fGDBBackend.getProgramPath();
|
||||||
if (!noFileCommand && execPath != null && !execPath.isEmpty()) {
|
if (!noFileCommand && execPath != null && !execPath.isEmpty()) {
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
new MIFileExecAndSymbols(fCommandControl.getContext(),
|
new MIFileExecAndSymbols(fCommandControl.getContext(),
|
||||||
|
|
|
@ -77,6 +77,9 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
|
||||||
private List<String> fSharedLibPaths;
|
private List<String> fSharedLibPaths;
|
||||||
private String fProgramArguments;
|
private String fProgramArguments;
|
||||||
|
|
||||||
|
private SessionType fSessionType;
|
||||||
|
private Boolean fAttach;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique ID of this service instance.
|
* Unique ID of this service instance.
|
||||||
*/
|
*/
|
||||||
|
@ -322,6 +325,20 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
|
||||||
return fGDBExitValue;
|
return fGDBExitValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SessionType getSessionType() {
|
||||||
|
if (fSessionType == null) {
|
||||||
|
fSessionType = LaunchUtils.getSessionType(fLaunchConfiguration);
|
||||||
|
}
|
||||||
|
return fSessionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsAttachSession() {
|
||||||
|
if (fAttach == null) {
|
||||||
|
fAttach = LaunchUtils.getIsAttach(fLaunchConfiguration);
|
||||||
|
}
|
||||||
|
return fAttach;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BundleContext getBundleContext() {
|
protected BundleContext getBundleContext() {
|
||||||
return GdbPlugin.getBundleContext();
|
return GdbPlugin.getBundleContext();
|
||||||
|
|
|
@ -141,7 +141,10 @@ public class GDBProcesses extends MIProcesses {
|
||||||
|
|
||||||
String name = fProcessNames.get(pid);
|
String name = fProcessNames.get(pid);
|
||||||
// If we still don't find the name in our list, return the default name of our program
|
// If we still don't find the name in our list, return the default name of our program
|
||||||
if (name == null) name = fGdb.getExecutablePath().lastSegment();
|
if (name == null) {
|
||||||
|
IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class);
|
||||||
|
name = backend.getProgramPath().lastSegment();
|
||||||
|
}
|
||||||
rm.setData(new MIThreadDMData(name, pidStr));
|
rm.setData(new MIThreadDMData(name, pidStr));
|
||||||
rm.done();
|
rm.done();
|
||||||
} else {
|
} else {
|
||||||
|
@ -230,7 +233,8 @@ public class GDBProcesses extends MIProcesses {
|
||||||
@Override
|
@Override
|
||||||
public void getRunningProcesses(IDMContext dmc, final DataRequestMonitor<IProcessDMContext[]> rm) {
|
public void getRunningProcesses(IDMContext dmc, final DataRequestMonitor<IProcessDMContext[]> rm) {
|
||||||
final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
|
final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
|
||||||
if (fGdb.getSessionType() == SessionType.LOCAL) {
|
IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class);
|
||||||
|
if (backend.getSessionType() == SessionType.LOCAL) {
|
||||||
IProcessList list = null;
|
IProcessList list = null;
|
||||||
try {
|
try {
|
||||||
list = CCorePlugin.getDefault().getProcessList();
|
list = CCorePlugin.getDefault().getProcessList();
|
||||||
|
|
|
@ -543,7 +543,8 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
}
|
}
|
||||||
|
|
||||||
public void isDebuggerAttachSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
|
public void isDebuggerAttachSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
|
||||||
rm.setData(fCommandControl.getIsAttachSession());
|
IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class);
|
||||||
|
rm.setData(backend.getIsAttachSession());
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +572,8 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
}
|
}
|
||||||
|
|
||||||
public void canDetachDebuggerFromProcess(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
|
public void canDetachDebuggerFromProcess(IDMContext dmc, DataRequestMonitor<Boolean> rm) {
|
||||||
rm.setData(fCommandControl.getIsAttachSession() && fCommandControl.isConnected());
|
IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class);
|
||||||
|
rm.setData(backend.getIsAttachSession() && fCommandControl.isConnected());
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,4 +84,14 @@ public interface IGDBBackend extends IMIBackend {
|
||||||
* Sends an interrupt signal to the GDB process.
|
* Sends an interrupt signal to the GDB process.
|
||||||
*/
|
*/
|
||||||
public void interrupt();
|
public void interrupt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The type of the session currently ongoing with the backend
|
||||||
|
*/
|
||||||
|
public SessionType getSessionType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the ongoing session is attaching to a remote target.
|
||||||
|
*/
|
||||||
|
public boolean getIsAttachSession();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.utils.pty.PTY;
|
import org.eclipse.cdt.utils.pty.PTY;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
||||||
|
@ -38,7 +37,6 @@ import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.dd.dsf.service.DsfSession;
|
import org.eclipse.dd.dsf.service.DsfSession;
|
||||||
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.launching.LaunchUtils;
|
|
||||||
import org.eclipse.dd.gdb.internal.provisional.service.IGDBBackend;
|
import org.eclipse.dd.gdb.internal.provisional.service.IGDBBackend;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
||||||
import org.eclipse.dd.mi.service.IMIBackend;
|
import org.eclipse.dd.mi.service.IMIBackend;
|
||||||
|
@ -98,10 +96,6 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
|
|
||||||
private GDBControlDMContext fControlDmc;
|
private GDBControlDMContext fControlDmc;
|
||||||
|
|
||||||
private SessionType fSessionType;
|
|
||||||
|
|
||||||
private boolean fAttach;
|
|
||||||
|
|
||||||
private IGDBBackend fMIBackend;
|
private IGDBBackend fMIBackend;
|
||||||
|
|
||||||
private boolean fConnected = true;
|
private boolean fConnected = true;
|
||||||
|
@ -115,8 +109,6 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
|
|
||||||
public GDBControl(DsfSession session, ILaunchConfiguration config) {
|
public GDBControl(DsfSession session, ILaunchConfiguration config) {
|
||||||
super(session, false);
|
super(session, false);
|
||||||
fSessionType = LaunchUtils.getSessionType(config);
|
|
||||||
fAttach = LaunchUtils.getIsAttach(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -183,14 +175,6 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
return fControlDmc;
|
return fControlDmc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SessionType getSessionType() {
|
|
||||||
return fSessionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getIsAttachSession() {
|
|
||||||
return fAttach;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void terminate(final RequestMonitor rm) {
|
public void terminate(final RequestMonitor rm) {
|
||||||
// Schedule a runnable to be executed 2 seconds from now.
|
// Schedule a runnable to be executed 2 seconds from now.
|
||||||
// If we don't get a response to the quit command, this
|
// If we don't get a response to the quit command, this
|
||||||
|
@ -233,7 +217,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
* be used instead; this decision is based on the type of session.
|
* be used instead; this decision is based on the type of session.
|
||||||
*/
|
*/
|
||||||
public void initInferiorInputOutput(final RequestMonitor requestMonitor) {
|
public void initInferiorInputOutput(final RequestMonitor requestMonitor) {
|
||||||
if (fSessionType == SessionType.REMOTE || fAttach) {
|
if (fMIBackend.getSessionType() == SessionType.REMOTE || fMIBackend.getIsAttachSession()) {
|
||||||
// These types do not use a PTY
|
// These types do not use a PTY
|
||||||
fPty = null;
|
fPty = null;
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
|
@ -263,7 +247,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
|
|
||||||
|
|
||||||
public boolean canRestart() {
|
public boolean canRestart() {
|
||||||
if (fAttach) return false;
|
if (fMIBackend.getIsAttachSession()) return false;
|
||||||
|
|
||||||
// Before GDB6.8, the Linux gdbserver would restart a new
|
// Before GDB6.8, the Linux gdbserver would restart a new
|
||||||
// process when getting a -exec-run but the communication
|
// process when getting a -exec-run but the communication
|
||||||
|
@ -271,7 +255,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
// with GDB6.8 the program restarts properly one time,
|
// with GDB6.8 the program restarts properly one time,
|
||||||
// but on a second attempt, gdbserver crashes.
|
// but on a second attempt, gdbserver crashes.
|
||||||
// So, lets just turn off the Restart for Remote debugging
|
// So, lets just turn off the Restart for Remote debugging
|
||||||
if (fSessionType == SessionType.REMOTE) return false;
|
if (fMIBackend.getSessionType() == SessionType.REMOTE) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +279,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
* Insert breakpoint at entry if set, and start or restart the program.
|
* Insert breakpoint at entry if set, and start or restart the program.
|
||||||
*/
|
*/
|
||||||
protected void startOrRestart(final GdbLaunch launch, boolean restart, final RequestMonitor requestMonitor) {
|
protected void startOrRestart(final GdbLaunch launch, boolean restart, final RequestMonitor requestMonitor) {
|
||||||
if (fAttach) {
|
if (fMIBackend.getIsAttachSession()) {
|
||||||
// When attaching to a running process, we do not need to set a breakpoint or
|
// 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.
|
// start the program; it is left up to the user.
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
|
@ -309,7 +293,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
final IContainerDMContext containerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
|
final IContainerDMContext containerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||||
|
|
||||||
final MICommand<MIInfo> execCommand;
|
final MICommand<MIInfo> execCommand;
|
||||||
if (fSessionType == SessionType.REMOTE) {
|
if (fMIBackend.getSessionType() == SessionType.REMOTE) {
|
||||||
// When doing remote debugging, we use -exec-continue instead of -exec-run
|
// When doing remote debugging, we use -exec-continue instead of -exec-run
|
||||||
execCommand = new MIExecContinue(containerDmc);
|
execCommand = new MIExecContinue(containerDmc);
|
||||||
} else {
|
} else {
|
||||||
|
@ -386,9 +370,6 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
return fInferiorProcess;
|
return fInferiorProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPath getExecutablePath() { return fMIBackend.getProgramPath(); }
|
|
||||||
|
|
||||||
|
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(ICommandControlShutdownDMEvent e) {
|
public void eventDispatched(ICommandControlShutdownDMEvent e) {
|
||||||
// Handle our "GDB Exited" event and stop processing commands.
|
// Handle our "GDB Exited" event and stop processing commands.
|
||||||
|
|
|
@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.utils.pty.PTY;
|
import org.eclipse.cdt.utils.pty.PTY;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
||||||
|
@ -38,7 +37,6 @@ import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.dd.dsf.service.DsfSession;
|
import org.eclipse.dd.dsf.service.DsfSession;
|
||||||
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.launching.LaunchUtils;
|
|
||||||
import org.eclipse.dd.gdb.internal.provisional.service.IGDBBackend;
|
import org.eclipse.dd.gdb.internal.provisional.service.IGDBBackend;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
||||||
import org.eclipse.dd.mi.service.IMIBackend;
|
import org.eclipse.dd.mi.service.IMIBackend;
|
||||||
|
@ -97,10 +95,6 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
||||||
|
|
||||||
private GDBControlDMContext fControlDmc;
|
private GDBControlDMContext fControlDmc;
|
||||||
|
|
||||||
private SessionType fSessionType;
|
|
||||||
|
|
||||||
private boolean fAttach;
|
|
||||||
|
|
||||||
private IGDBBackend fMIBackend;
|
private IGDBBackend fMIBackend;
|
||||||
|
|
||||||
private boolean fConnected = true;
|
private boolean fConnected = true;
|
||||||
|
@ -114,8 +108,6 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
||||||
|
|
||||||
public GDBControl_7_0(DsfSession session, ILaunchConfiguration config) {
|
public GDBControl_7_0(DsfSession session, ILaunchConfiguration config) {
|
||||||
super(session, true);
|
super(session, true);
|
||||||
fSessionType = LaunchUtils.getSessionType(config);
|
|
||||||
fAttach = LaunchUtils.getIsAttach(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -181,14 +173,6 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
||||||
return fControlDmc;
|
return fControlDmc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SessionType getSessionType() {
|
|
||||||
return fSessionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getIsAttachSession() {
|
|
||||||
return fAttach;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void terminate(final RequestMonitor rm) {
|
public void terminate(final RequestMonitor rm) {
|
||||||
// Schedule a runnable to be executed 2 seconds from now.
|
// Schedule a runnable to be executed 2 seconds from now.
|
||||||
// If we don't get a response to the quit command, this
|
// If we don't get a response to the quit command, this
|
||||||
|
@ -207,9 +191,8 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
||||||
},
|
},
|
||||||
2, TimeUnit.SECONDS);
|
2, TimeUnit.SECONDS);
|
||||||
|
|
||||||
MIGDBExit cmd = new MIGDBExit(fControlDmc);
|
|
||||||
queueCommand(
|
queueCommand(
|
||||||
cmd,
|
new MIGDBExit(fControlDmc),
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
|
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
|
||||||
@Override
|
@Override
|
||||||
public void handleCompleted() {
|
public void handleCompleted() {
|
||||||
|
@ -232,7 +215,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
||||||
* be used instead; this decision is based on the type of session.
|
* be used instead; this decision is based on the type of session.
|
||||||
*/
|
*/
|
||||||
public void initInferiorInputOutput(final RequestMonitor requestMonitor) {
|
public void initInferiorInputOutput(final RequestMonitor requestMonitor) {
|
||||||
if (fSessionType == SessionType.REMOTE || fAttach) {
|
if (fMIBackend.getSessionType() == SessionType.REMOTE || fMIBackend.getIsAttachSession()) {
|
||||||
// These types do not use a PTY
|
// These types do not use a PTY
|
||||||
fPty = null;
|
fPty = null;
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
|
@ -262,7 +245,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
||||||
|
|
||||||
|
|
||||||
public boolean canRestart() {
|
public boolean canRestart() {
|
||||||
if (fAttach) return false;
|
if (fMIBackend.getIsAttachSession()) return false;
|
||||||
|
|
||||||
// Before GDB6.8, the Linux gdbserver would restart a new
|
// Before GDB6.8, the Linux gdbserver would restart a new
|
||||||
// process when getting a -exec-run but the communication
|
// process when getting a -exec-run but the communication
|
||||||
|
@ -270,7 +253,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
||||||
// with GDB6.8 the program restarts properly one time,
|
// with GDB6.8 the program restarts properly one time,
|
||||||
// but on a second attempt, gdbserver crashes.
|
// but on a second attempt, gdbserver crashes.
|
||||||
// So, lets just turn off the Restart for Remote debugging
|
// So, lets just turn off the Restart for Remote debugging
|
||||||
if (fSessionType == SessionType.REMOTE) return false;
|
if (fMIBackend.getSessionType() == SessionType.REMOTE) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -294,7 +277,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
||||||
* Insert breakpoint at entry if set, and start or restart the program.
|
* Insert breakpoint at entry if set, and start or restart the program.
|
||||||
*/
|
*/
|
||||||
protected void startOrRestart(final GdbLaunch launch, boolean restart, final RequestMonitor requestMonitor) {
|
protected void startOrRestart(final GdbLaunch launch, boolean restart, final RequestMonitor requestMonitor) {
|
||||||
if (fAttach) {
|
if (fMIBackend.getIsAttachSession()) {
|
||||||
// When attaching to a running process, we do not need to set a breakpoint or
|
// 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.
|
// start the program; it is left up to the user.
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
|
@ -308,7 +291,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
||||||
final IContainerDMContext containerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
|
final IContainerDMContext containerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||||
|
|
||||||
final MICommand<MIInfo> execCommand;
|
final MICommand<MIInfo> execCommand;
|
||||||
if (fSessionType == SessionType.REMOTE) {
|
if (fMIBackend.getSessionType() == SessionType.REMOTE) {
|
||||||
// When doing remote debugging, we use -exec-continue instead of -exec-run
|
// When doing remote debugging, we use -exec-continue instead of -exec-run
|
||||||
execCommand = new MIExecContinue(containerDmc);
|
execCommand = new MIExecContinue(containerDmc);
|
||||||
} else {
|
} else {
|
||||||
|
@ -379,8 +362,6 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
||||||
return fInferiorProcess;
|
return fInferiorProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPath getExecutablePath() { return fMIBackend.getProgramPath(); }
|
|
||||||
|
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(ICommandControlShutdownDMEvent e) {
|
public void eventDispatched(ICommandControlShutdownDMEvent e) {
|
||||||
// Handle our "GDB Exited" event and stop processing commands.
|
// Handle our "GDB Exited" event and stop processing commands.
|
||||||
|
|
|
@ -45,8 +45,6 @@ class GDBInferiorProcess extends MIInferiorProcess {
|
||||||
getSession().getExecutor().submit(new DsfRunnable() {
|
getSession().getExecutor().submit(new DsfRunnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (isDisposed() || !getSession().isActive()) return;
|
if (isDisposed() || !getSession().isActive()) return;
|
||||||
IGDBControl gdb = (IGDBControl)getCommandControlService();
|
|
||||||
if (gdb == null) return;
|
|
||||||
|
|
||||||
// An inferior will be destroy():interrupt and kill if
|
// An inferior will be destroy():interrupt and kill if
|
||||||
// - For attach session:
|
// - For attach session:
|
||||||
|
@ -55,7 +53,7 @@ class GDBInferiorProcess extends MIInferiorProcess {
|
||||||
// if the inferior is still running.
|
// if the inferior is still running.
|
||||||
// - For PostMortem(Core): send event
|
// - For PostMortem(Core): send event
|
||||||
// else noop
|
// else noop
|
||||||
if (gdb.getIsAttachSession() == false) {
|
if (fBackend.getIsAttachSession() == false) {
|
||||||
// Try to interrupt the inferior, first.
|
// Try to interrupt the inferior, first.
|
||||||
if (getState() == State.RUNNING) {
|
if (getState() == State.RUNNING) {
|
||||||
fBackend.interrupt();
|
fBackend.interrupt();
|
||||||
|
|
|
@ -10,20 +10,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.gdb.internal.provisional.service.command;
|
package org.eclipse.dd.gdb.internal.provisional.service.command;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
|
||||||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
|
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
|
||||||
import org.eclipse.dd.mi.service.command.AbstractCLIProcess;
|
import org.eclipse.dd.mi.service.command.AbstractCLIProcess;
|
||||||
import org.eclipse.dd.mi.service.command.MIInferiorProcess;
|
import org.eclipse.dd.mi.service.command.MIInferiorProcess;
|
||||||
|
|
||||||
public interface IGDBControl extends ICommandControlService {
|
public interface IGDBControl extends ICommandControlService {
|
||||||
|
|
||||||
SessionType getSessionType();
|
|
||||||
|
|
||||||
boolean getIsAttachSession();
|
|
||||||
|
|
||||||
void terminate(final RequestMonitor rm);
|
void terminate(final RequestMonitor rm);
|
||||||
void initInferiorInputOutput(final RequestMonitor requestMonitor);
|
void initInferiorInputOutput(final RequestMonitor requestMonitor);
|
||||||
|
|
||||||
|
@ -39,6 +33,4 @@ public interface IGDBControl extends ICommandControlService {
|
||||||
AbstractCLIProcess getCLIProcess();
|
AbstractCLIProcess getCLIProcess();
|
||||||
|
|
||||||
MIInferiorProcess getInferiorProcess();
|
MIInferiorProcess getInferiorProcess();
|
||||||
|
|
||||||
IPath getExecutablePath();
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue