Hello,
For clarification, neither option 1 or 2 have any UI dependencies. The only UI line is the very first line*, which is getting the selection from the Debug View - if you are not using it in the UI, you still need to have some handle to the debug target, so replace that line with something that is or can be adapted to what you need.
What is the type of object you are getting? Have you tried to adapt it to an IResumeHandler?
Since it sounds like you may have an ILaunch type object (presumably/hopefully GdbLaunch?) then you need to get its "children" before you can do anything. e.g.
// These two lines just used to get the current ILaunch
IAdaptable debugContext = DebugUITools.getDebugContext();
ILaunch launch = debugContext.getAdapter(ILaunch.class);
if (launch instanceof GdbLaunch) {
GdbLaunch gdbLaunch = (GdbLaunch) launch;
DsfSession session = gdbLaunch.getSession();
DsfExecutor executor = session.getExecutor();
executor.submit(() -> {
// Use your plug-in Activator or similar for the bundle context
BundleContext bundleContext = DsfPlugin.getBundleContext();
DsfServicesTracker tracker = new DsfServicesTracker(bundleContext, session.getId());
try {
IGDBProcesses processes = tracker.getService(IGDBProcesses.class);
IMIRunControl runcontrol = tracker.getService(IMIRunControl.class);
ICommandControlService commandControl = tracker.getService(ICommandControlService.class);
ICommandControlDMContext context = commandControl.getContext();
processes.getProcessesBeingDebugged(context,
new DataRequestMonitor<IDMContext[]>(executor, null) {
@Override
protected void handleSuccess() {
// data now contains all the processes being debugged.
// if you pass elements of data back to getProcessesBeingDebugged you can
// get the individual threads being debugged if you need that control.
IDMContext[] data = ""> if (data[0] instanceof IExecutionDMContext) {
IExecutionDMContext execDmc = (IExecutionDMContext) data[0];
runcontrol.resume(execDmc, null);
}
}
});
} finally {
tracker.dispose();
}
});
* If I had written Option 1 out it would have had the same first line.
HTH,
Jonah