mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-16 13:35:22 +02:00
Bug 239050
some improvements to the IProcesses interface where needed: 1- getRunningProcesses() should take an IContainerDMContext as a parameter to prepare for multi-core/multi-processor debugging. 2- attachDebuggerToProcess() should return an IContainerDMContext as part of the requestMonitor. This is because, once a process is attached to, it will then need to have a container context to use the RunControl service. 3- getProcessesBeingDebugged() should take an IContainerDMContext as a parameter to prepare for multi-core/multi-processor debugging. Also, it should return an array of IContainerDMContexts as part of the requestMonitor; this is because, processes that are being debugged should have a container context to use the RunControl service.
This commit is contained in:
parent
e3eb35603d
commit
f440765624
3 changed files with 37 additions and 18 deletions
|
@ -17,6 +17,7 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
import org.eclipse.dd.dsf.datamodel.IDMData;
|
import org.eclipse.dd.dsf.datamodel.IDMData;
|
||||||
import org.eclipse.dd.dsf.datamodel.IDMEvent;
|
import org.eclipse.dd.dsf.datamodel.IDMEvent;
|
||||||
import org.eclipse.dd.dsf.datamodel.IDMService;
|
import org.eclipse.dd.dsf.datamodel.IDMService;
|
||||||
|
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface provides access to the OS's process
|
* This interface provides access to the OS's process
|
||||||
|
@ -68,14 +69,20 @@ public interface IProcesses extends IDMService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the current list of processes running on target.
|
* Retrieves the current list of processes running on target.
|
||||||
|
* @param containerDmc The processor or core for which to list all processes
|
||||||
* @param rm Request completion monitor, to be filled in with array of process contexts.
|
* @param rm Request completion monitor, to be filled in with array of process contexts.
|
||||||
*/
|
*/
|
||||||
void getRunningProcesses(DataRequestMonitor<IProcessDMContext[]> rm);
|
void getRunningProcesses(IContainerDMContext containerDmc, DataRequestMonitor<IProcessDMContext[]> rm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attaches debugger to the given process.
|
* Attaches debugger to the given process.
|
||||||
*/
|
* When attaching to a process, a container context can now be used to characterize the process.
|
||||||
void attachDebuggerToProcess(IProcessDMContext procCtx, RequestMonitor requestMonitor);
|
* IContainerDMContext has IProcessDMContext as a parent. This method can optionally choose
|
||||||
|
* to return the IContainerDMContext inside the DataRequestMonitor. This can be useful for
|
||||||
|
* backends that do not have the ability to obtain the different IContainerDMContexts through
|
||||||
|
* {@link getProcessesBeingDebugged}
|
||||||
|
*/
|
||||||
|
void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IContainerDMContext> rm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detaches debugger from the given process.
|
* Detaches debugger from the given process.
|
||||||
|
@ -99,9 +106,12 @@ public interface IProcesses extends IDMService {
|
||||||
/**
|
/**
|
||||||
* Retrieves the list of processes which are currently under
|
* Retrieves the list of processes which are currently under
|
||||||
* debugger control.
|
* debugger control.
|
||||||
* @param rm Request completion monitor.
|
* @param containerDmc The processor or core for which to list processes being debugged
|
||||||
|
* @param rm Request completion monitor which contains all container contexts representing
|
||||||
|
* the processes being debugged. Note that each of these containers also has
|
||||||
|
* IProcessDMContext as a parent.
|
||||||
*/
|
*/
|
||||||
void getProcessesBeingDebugged(DataRequestMonitor<IProcessDMContext[]> rm);
|
void getProcessesBeingDebugged(IContainerDMContext containerDmc, DataRequestMonitor<IContainerDMContext[]> rm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the given process or thread can be terminated.
|
* Checks whether the given process or thread can be terminated.
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.eclipse.dd.dsf.concurrent.DsfExecutor;
|
||||||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.dd.dsf.concurrent.Sequence;
|
import org.eclipse.dd.dsf.concurrent.Sequence;
|
||||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||||
|
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
||||||
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
|
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
|
||||||
|
@ -444,18 +445,18 @@ public class FinalLaunchSequence extends Sequence {
|
||||||
|
|
||||||
fProcService.attachDebuggerToProcess(
|
fProcService.attachDebuggerToProcess(
|
||||||
procDmc,
|
procDmc,
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
new DataRequestMonitor<IContainerDMContext>(getExecutor(), requestMonitor));
|
||||||
} else {
|
} else {
|
||||||
promptForProcessID(fLaunch.getLaunchConfiguration(),
|
promptForProcessID(fLaunch.getLaunchConfiguration(),
|
||||||
new DataRequestMonitor<Integer>(getExecutor(), requestMonitor) {
|
new DataRequestMonitor<Integer>(getExecutor(), requestMonitor) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
IProcessDMContext procDmc =
|
IProcessDMContext procDmc =
|
||||||
fProcService.createProcessContext(Integer.toString(getData()));
|
fProcService.createProcessContext(Integer.toString(getData()));
|
||||||
|
|
||||||
fProcService.attachDebuggerToProcess(
|
fProcService.attachDebuggerToProcess(
|
||||||
procDmc,
|
procDmc,
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
new DataRequestMonitor<IContainerDMContext>(getExecutor(), requestMonitor));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
||||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
import org.eclipse.dd.dsf.debug.service.IProcesses;
|
import org.eclipse.dd.dsf.debug.service.IProcesses;
|
||||||
|
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||||
import org.eclipse.dd.dsf.service.AbstractDsfService;
|
import org.eclipse.dd.dsf.service.AbstractDsfService;
|
||||||
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;
|
||||||
|
@ -87,7 +88,6 @@ public class GDBProcesses extends AbstractDsfService implements IProcesses {
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @param sessionId Session that this context belongs to.
|
* @param sessionId Session that this context belongs to.
|
||||||
* @param name process name
|
|
||||||
* @param id process identifier.
|
* @param id process identifier.
|
||||||
*/
|
*/
|
||||||
protected GdbProcessDMC(String sessionId, String id) {
|
protected GdbProcessDMC(String sessionId, String id) {
|
||||||
|
@ -235,7 +235,8 @@ public class GDBProcesses extends AbstractDsfService implements IProcesses {
|
||||||
public void getExecutionData(IThreadDMContext dmc, DataRequestMonitor<IThreadDMData> rm) {
|
public void getExecutionData(IThreadDMContext dmc, DataRequestMonitor<IThreadDMData> rm) {
|
||||||
// We must first check for GdbProcessDMC because it is also a GdbThreadDMC
|
// We must first check for GdbProcessDMC because it is also a GdbThreadDMC
|
||||||
if (dmc instanceof GdbProcessDMC) {
|
if (dmc instanceof GdbProcessDMC) {
|
||||||
rm.setData(new GdbThreadDMData("", ((GdbProcessDMC)dmc).getId())); //$NON-NLS-1$
|
rm.setData(new GdbThreadDMData(fCommandControl.getExecutablePath().lastSegment(),
|
||||||
|
((GdbProcessDMC)dmc).getId()));
|
||||||
rm.done();
|
rm.done();
|
||||||
} else if (dmc instanceof GdbThreadDMC) {
|
} else if (dmc instanceof GdbThreadDMC) {
|
||||||
rm.setData(new GdbThreadDMData("", ((GdbThreadDMC)dmc).getId())); //$NON-NLS-1$
|
rm.setData(new GdbThreadDMData("", ((GdbThreadDMC)dmc).getId())); //$NON-NLS-1$
|
||||||
|
@ -246,7 +247,7 @@ public class GDBProcesses extends AbstractDsfService implements IProcesses {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void attachDebuggerToProcess(IProcessDMContext procCtx, final RequestMonitor rm) {
|
public void attachDebuggerToProcess(IProcessDMContext procCtx, final DataRequestMonitor<IContainerDMContext> rm) {
|
||||||
if (procCtx instanceof GdbProcessDMC) {
|
if (procCtx instanceof GdbProcessDMC) {
|
||||||
int pid;
|
int pid;
|
||||||
try {
|
try {
|
||||||
|
@ -259,7 +260,14 @@ public class GDBProcesses extends AbstractDsfService implements IProcesses {
|
||||||
|
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
new CLIAttach(procCtx, pid),
|
new CLIAttach(procCtx, pid),
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
|
||||||
|
@Override
|
||||||
|
protected void handleSuccess() {
|
||||||
|
rm.setData(null);
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
|
@ -299,20 +307,20 @@ public class GDBProcesses extends AbstractDsfService implements IProcesses {
|
||||||
NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getProcessesBeingDebugged(DataRequestMonitor<IProcessDMContext[]> rm) {
|
public void getProcessesBeingDebugged(IContainerDMContext containerDmc, DataRequestMonitor<IContainerDMContext[]> rm) {
|
||||||
// use -list-thread-groups
|
// use -list-thread-groups
|
||||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
|
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
|
||||||
NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getRunningProcesses(DataRequestMonitor<IProcessDMContext[]> rm) {
|
public void getRunningProcesses(IContainerDMContext containerDmc, DataRequestMonitor<IProcessDMContext[]> rm) {
|
||||||
// use -list-thread-groups for local session
|
// use -list-thread-groups for local session
|
||||||
|
|
||||||
// monitor list processes is only for remote session
|
// monitor list processes is only for remote session
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
new CLIMonitorListProcesses(fCommandControl.getControlDMContext()),
|
new CLIMonitorListProcesses(containerDmc),
|
||||||
new DataRequestMonitor<CLIMonitorListProcessesInfo>(getExecutor(), rm) {
|
new DataRequestMonitor<CLIMonitorListProcessesInfo>(getExecutor(), rm) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue