mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 317500: Dissociates the groupId from the pId, since stating with GDB 7.2, the two ids are no longer the same.
This commit is contained in:
parent
dcd77391c3
commit
2aed0a778f
9 changed files with 100 additions and 67 deletions
|
@ -92,8 +92,7 @@ public class GDBProcesses extends MIProcesses {
|
||||||
new Hashtable<String, String>());
|
new Hashtable<String, String>());
|
||||||
|
|
||||||
ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class);
|
ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class);
|
||||||
IProcessDMContext procDmc = createProcessContext(commandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
|
IContainerDMContext containerDmc = createContainerContextFromGroupId(commandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
|
||||||
IContainerDMContext containerDmc = createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
|
|
||||||
fGdb.getInferiorProcess().setContainerContext(containerDmc);
|
fGdb.getInferiorProcess().setContainerContext(containerDmc);
|
||||||
|
|
||||||
getSession().addServiceEventListener(this, null);
|
getSession().addServiceEventListener(this, null);
|
||||||
|
|
|
@ -392,6 +392,10 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
* A map of thread id to thread group id. We use this to find out to which threadGroup a thread belongs.
|
* A map of thread id to thread group id. We use this to find out to which threadGroup a thread belongs.
|
||||||
*/
|
*/
|
||||||
private Map<String, String> fThreadToGroupMap = new HashMap<String, String>();
|
private Map<String, String> fThreadToGroupMap = new HashMap<String, String>();
|
||||||
|
/**
|
||||||
|
* A map of thread group id to process id. We use this to find out to which pid a group refers.
|
||||||
|
*/
|
||||||
|
private Map<String, String> fGroupToPidMap = new HashMap<String, String>();
|
||||||
|
|
||||||
private IGDBControl fCommandControl;
|
private IGDBControl fCommandControl;
|
||||||
private IGDBBackend fBackend;
|
private IGDBBackend fBackend;
|
||||||
|
@ -549,7 +553,17 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
|
|
||||||
|
return createContainerContextFromGroupId(controlDmc, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 4.0 */
|
||||||
|
public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
|
||||||
|
String pid = fGroupToPidMap.get(groupId);
|
||||||
|
if (pid == null) {
|
||||||
|
pid = groupId;
|
||||||
|
}
|
||||||
|
IProcessDMContext processDmc = createProcessContext(controlDmc, pid);
|
||||||
return createContainerContext(processDmc, groupId);
|
return createContainerContext(processDmc, groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -765,11 +779,10 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
@Override
|
@Override
|
||||||
protected void handleFailure() {
|
protected void handleFailure() {
|
||||||
// If the target is not available, generate the list ourselves
|
// If the target is not available, generate the list ourselves
|
||||||
IMIContainerDMContext[] containerDmcs = new IMIContainerDMContext[fDebuggedProcessesAndNames.size()];
|
IMIContainerDMContext[] containerDmcs = new IMIContainerDMContext[fGroupToPidMap.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String groupId : fDebuggedProcessesAndNames.keySet()) {
|
for (String groupId : fGroupToPidMap.keySet()) {
|
||||||
IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
|
containerDmcs[i++] = createContainerContextFromGroupId(controlDmc, groupId);
|
||||||
containerDmcs[i++] = createContainerContext(processDmc, groupId);
|
|
||||||
}
|
}
|
||||||
rm.setData(containerDmcs);
|
rm.setData(containerDmcs);
|
||||||
rm.done();
|
rm.done();
|
||||||
|
@ -808,9 +821,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
// code can be removed when GDB 7.2 is released
|
// code can be removed when GDB 7.2 is released
|
||||||
// START OF WORKAROUND
|
// START OF WORKAROUND
|
||||||
if (groups.length == 0 && fBackend.getSessionType() == SessionType.CORE) {
|
if (groups.length == 0 && fBackend.getSessionType() == SessionType.CORE) {
|
||||||
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
return new IMIContainerDMContext[] {createContainerContextFromGroupId(controlDmc, MIProcesses.UNIQUE_GROUP_ID)};
|
||||||
IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
|
|
||||||
return new IMIContainerDMContext[] {createContainerContext(processDmc, groupId)};
|
|
||||||
}
|
}
|
||||||
// END OF WORKAROUND to be removed when GDB 7.2 is available
|
// END OF WORKAROUND to be removed when GDB 7.2 is available
|
||||||
|
|
||||||
|
@ -828,8 +839,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String groupId = group.getGroupId();
|
String groupId = group.getGroupId();
|
||||||
IProcessDMContext procDmc = createProcessContext(controlDmc, groupId);
|
containerDmcs.add(createContainerContextFromGroupId(controlDmc, groupId));
|
||||||
containerDmcs.add(createContainerContext(procDmc, groupId));
|
|
||||||
}
|
}
|
||||||
return containerDmcs.toArray(new IMIContainerDMContext[containerDmcs.size()]);
|
return containerDmcs.toArray(new IMIContainerDMContext[containerDmcs.size()]);
|
||||||
}
|
}
|
||||||
|
@ -1049,6 +1059,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
"thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
|
"thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
|
||||||
|
|
||||||
String groupId = null;
|
String groupId = null;
|
||||||
|
String pId = null;
|
||||||
|
|
||||||
MIResult[] results = exec.getMIResults();
|
MIResult[] results = exec.getMIResults();
|
||||||
for (int i = 0; i < results.length; i++) {
|
for (int i = 0; i < results.length; i++) {
|
||||||
|
@ -1058,19 +1069,32 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
if (val instanceof MIConst) {
|
if (val instanceof MIConst) {
|
||||||
groupId = ((MIConst) val).getString().trim();
|
groupId = ((MIConst) val).getString().trim();
|
||||||
}
|
}
|
||||||
|
} else if (var.equals("pid")) { //$NON-NLS-1$
|
||||||
|
// Available starting with GDB 7.2
|
||||||
|
if (val instanceof MIConst) {
|
||||||
|
pId = ((MIConst) val).getString().trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pId == null) {
|
||||||
|
// Before GDB 7.2, the groupId was the pid of the process
|
||||||
|
pId = groupId;
|
||||||
|
}
|
||||||
|
|
||||||
if (groupId != null) {
|
if (groupId != null) {
|
||||||
if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
|
if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
fDebuggedProcessesAndNames.put(groupId, ""); //$NON-NLS-1$
|
|
||||||
|
fGroupToPidMap.put(groupId, pId);
|
||||||
|
|
||||||
|
fDebuggedProcessesAndNames.put(pId, ""); //$NON-NLS-1$
|
||||||
|
|
||||||
// GDB is debugging a new process. Let's fetch its
|
// GDB is debugging a new process. Let's fetch its
|
||||||
// name and remember it. In order to get the name,
|
// name and remember it. In order to get the name,
|
||||||
// we have to request all running processes, not
|
// we have to request all running processes, not
|
||||||
// just the ones being debugged. We got a lot more
|
// just the ones being debugged. We got a lot more
|
||||||
// information when we request all processes.
|
// information when we request all processes.
|
||||||
final String finalGroupId = groupId;
|
final String finalPId = pId;
|
||||||
fListThreadGroupsAvailableCache.execute(
|
fListThreadGroupsAvailableCache.execute(
|
||||||
fCommandFactory.createMIListThreadGroups(fCommandControl.getContext(), true),
|
fCommandFactory.createMIListThreadGroups(fCommandControl.getContext(), true),
|
||||||
new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), null) {
|
new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), null) {
|
||||||
|
@ -1081,10 +1105,12 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
// sending of this command.
|
// sending of this command.
|
||||||
fListThreadGroupsAvailableCache.reset();
|
fListThreadGroupsAvailableCache.reset();
|
||||||
|
|
||||||
|
// Note that the output of the "-list-thread-groups --available" command
|
||||||
|
// still shows the pid as a groupId, even for GDB 7.2.
|
||||||
if (isSuccess()) {
|
if (isSuccess()) {
|
||||||
for (IThreadGroupInfo groupInfo : getData().getGroupList()) {
|
for (IThreadGroupInfo groupInfo : getData().getGroupList()) {
|
||||||
if (groupInfo.getPid().equals(finalGroupId)) {
|
if (groupInfo.getPid().equals(finalPId)) {
|
||||||
fDebuggedProcessesAndNames.put(finalGroupId, groupInfo.getName());
|
fDebuggedProcessesAndNames.put(finalPId, groupInfo.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1097,10 +1123,11 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
IProcessList list = null;
|
IProcessList list = null;
|
||||||
try {
|
try {
|
||||||
list = CCorePlugin.getDefault().getProcessList();
|
list = CCorePlugin.getDefault().getProcessList();
|
||||||
int groupId_int = Integer.parseInt(finalGroupId);
|
int pId_int = Integer.parseInt(finalPId);
|
||||||
for (IProcessInfo procInfo : list.getProcessList()) {
|
for (IProcessInfo procInfo : list.getProcessList()) {
|
||||||
if (procInfo.getPid() == groupId_int) {
|
if (procInfo.getPid() == pId_int) {
|
||||||
fDebuggedProcessesAndNames.put(finalGroupId, procInfo.getName());
|
fDebuggedProcessesAndNames.put(finalPId, procInfo.getName());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
@ -1110,8 +1137,11 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if ("thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
|
} else if ("thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
|
||||||
|
|
||||||
|
fGroupToPidMap.remove(groupId);
|
||||||
|
|
||||||
// GDB is no longer debugging this process. Remove it from our list.
|
// GDB is no longer debugging this process. Remove it from our list.
|
||||||
fDebuggedProcessesAndNames.remove(groupId);
|
fDebuggedProcessesAndNames.remove(pId);
|
||||||
|
|
||||||
// Remove any entries for that group from our thread to group map
|
// Remove any entries for that group from our thread to group map
|
||||||
// When detaching from a group, we won't have received any thread-exited event
|
// When detaching from a group, we won't have received any thread-exited event
|
||||||
|
|
|
@ -18,8 +18,8 @@ import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
||||||
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
|
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
|
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
|
||||||
|
@ -43,10 +42,10 @@ import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIBackend;
|
import org.eclipse.cdt.dsf.mi.service.IMIBackend;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.IMIBackend.BackendStateChangedEvent;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
|
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIBackend.BackendStateChangedEvent;
|
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerExitedDMEvent;
|
import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerExitedDMEvent;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerStartedDMEvent;
|
import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerStartedDMEvent;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.AbstractCLIProcess;
|
import org.eclipse.cdt.dsf.mi.service.command.AbstractCLIProcess;
|
||||||
|
@ -55,8 +54,8 @@ import org.eclipse.cdt.dsf.mi.service.command.CLIEventProcessor;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.MIControlDMContext;
|
import org.eclipse.cdt.dsf.mi.service.command.MIControlDMContext;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess;
|
import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.MIRunControlEventProcessor;
|
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess.State;
|
import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess.State;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.MIRunControlEventProcessor;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||||
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
|
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
|
||||||
|
@ -319,8 +318,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
DsfServicesTracker servicesTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), getSession().getId());
|
DsfServicesTracker servicesTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), getSession().getId());
|
||||||
IMIProcesses procService = servicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = servicesTracker.getService(IMIProcesses.class);
|
||||||
servicesTracker.dispose();
|
servicesTracker.dispose();
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
final IContainerDMContext containerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||||
final IContainerDMContext containerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
|
|
||||||
|
|
||||||
final ICommand<MIInfo> execCommand;
|
final ICommand<MIInfo> execCommand;
|
||||||
if (useContinueCommand(launch, restart)) {
|
if (useContinueCommand(launch, restart)) {
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
||||||
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
|
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
|
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
|
||||||
|
@ -449,8 +448,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
||||||
@Override
|
@Override
|
||||||
public void execute(RequestMonitor rm) {
|
public void execute(RequestMonitor rm) {
|
||||||
IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
|
IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
fContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||||
fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
|
|
||||||
ICommand<MIInfo> command;
|
ICommand<MIInfo> command;
|
||||||
|
|
||||||
if (useContinueCommand(launch, restart)) {
|
if (useContinueCommand(launch, restart)) {
|
||||||
|
|
|
@ -57,11 +57,23 @@ public interface IMIProcesses extends IProcesses
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a container context based on a threadId. This implies knowledge
|
* Create a container context based on a threadId. This implies knowledge
|
||||||
* of which threads belong to which container.
|
* of which threads belong to which container. This method can only be used
|
||||||
|
* if the threadId has been already created.
|
||||||
*
|
*
|
||||||
* @param controlDmc The parent command control context of this context
|
* @param controlDmc The parent command control context of this context
|
||||||
* @param threadId The thread id belonging to the container we want to create
|
* @param threadId The thread id belonging to the container we want to create
|
||||||
*/
|
*/
|
||||||
IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId);
|
IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a container context based on a groupId. This implies knowledge
|
||||||
|
* of which pid is represented by the groupId. This method can only be used
|
||||||
|
* if the groupId has been already created.
|
||||||
|
*
|
||||||
|
* @param controlDmc The parent command control context of this context
|
||||||
|
* @param goupId The thread-group id of the container we want to create
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -413,11 +413,16 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId) {
|
public IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId) {
|
||||||
String groupId = UNIQUE_GROUP_ID;
|
return createContainerContextFromGroupId(controlDmc, UNIQUE_GROUP_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 4.0 */
|
||||||
|
public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
|
||||||
IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
|
IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
|
||||||
return createContainerContext(processDmc, groupId);
|
return createContainerContext(processDmc, groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getExecutionData(IThreadDMContext dmc, final DataRequestMonitor<IThreadDMData> rm) {
|
public void getExecutionData(IThreadDMContext dmc, final DataRequestMonitor<IThreadDMData> rm) {
|
||||||
if (dmc instanceof MIProcessDMC) {
|
if (dmc instanceof MIProcessDMC) {
|
||||||
rm.setData(new MIThreadDMData("", ((MIProcessDMC)dmc).getProcId())); //$NON-NLS-1$
|
rm.setData(new MIThreadDMData("", ((MIProcessDMC)dmc).getProcId())); //$NON-NLS-1$
|
||||||
|
@ -568,9 +573,7 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
|
||||||
// This service version only handles a single process to debug, therefore, we can simply
|
// This service version only handles a single process to debug, therefore, we can simply
|
||||||
// create the context describing this process ourselves.
|
// create the context describing this process ourselves.
|
||||||
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
|
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
|
||||||
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
IMIContainerDMContext newContainerDmc = createContainerContextFromGroupId(controlDmc, UNIQUE_GROUP_ID);
|
||||||
IProcessDMContext procDmc = createProcessContext(controlDmc, groupId);
|
|
||||||
IMIContainerDMContext newContainerDmc = createContainerContext(procDmc, groupId);
|
|
||||||
rm.setData(new IContainerDMContext[] {newContainerDmc});
|
rm.setData(new IContainerDMContext[] {newContainerDmc});
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,15 +20,14 @@ import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
|
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.ISignals.ISignalsDMContext;
|
import org.eclipse.cdt.dsf.debug.service.ISignals.ISignalsDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandListener;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandListener;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandToken;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandToken;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.IEventListener;
|
import org.eclipse.cdt.dsf.debug.service.command.IEventListener;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
||||||
|
@ -124,10 +123,7 @@ public class CLIEventProcessor
|
||||||
|
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
if (procService != null) {
|
if (procService != null) {
|
||||||
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||||
|
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
|
||||||
IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
|
|
||||||
MIEvent<?> e = new MIThreadCreatedEvent(processContainerDmc, threadId);
|
MIEvent<?> e = new MIThreadCreatedEvent(processContainerDmc, threadId);
|
||||||
fCommandControl.getSession().dispatchEvent(e, fCommandControl.getProperties());
|
fCommandControl.getSession().dispatchEvent(e, fCommandControl.getProperties());
|
||||||
}
|
}
|
||||||
|
@ -167,10 +163,7 @@ public class CLIEventProcessor
|
||||||
// if it was a step instruction set state running
|
// if it was a step instruction set state running
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
if (procService != null) {
|
if (procService != null) {
|
||||||
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||||
|
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
|
||||||
IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
|
|
||||||
MIEvent<?> event = new MIRunningEvent(processContainerDmc, token, type);
|
MIEvent<?> event = new MIRunningEvent(processContainerDmc, token, type);
|
||||||
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||||
|
@ -192,9 +193,7 @@ public class MIRunControlEventProcessor
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
if (runControl != null && procService != null) {
|
if (runControl != null && procService != null) {
|
||||||
// We don't know which thread stopped so we simply create a container event.
|
// We don't know which thread stopped so we simply create a container event.
|
||||||
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
|
||||||
IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
|
|
||||||
|
|
||||||
if (runControl.isSuspended(processContainerDmc) == false) {
|
if (runControl.isSuspended(processContainerDmc) == false) {
|
||||||
// Create an MISignalEvent because that is what the *stopped event should have been
|
// Create an MISignalEvent because that is what the *stopped event should have been
|
||||||
|
@ -235,13 +234,11 @@ public class MIRunControlEventProcessor
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||||
|
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
|
||||||
IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
|
|
||||||
|
|
||||||
IExecutionDMContext execDmc = processContainerDmc;
|
IExecutionDMContext execDmc = processContainerDmc;
|
||||||
if (threadId != null) {
|
if (threadId != null) {
|
||||||
|
IProcessDMContext procDmc = DMContexts.getAncestorOfType(processContainerDmc, IProcessDMContext.class);
|
||||||
IThreadDMContext threadDmc = procService.createThreadContext(procDmc, threadId);
|
IThreadDMContext threadDmc = procService.createThreadContext(procDmc, threadId);
|
||||||
execDmc = procService.createExecutionContext(processContainerDmc, threadDmc, threadId);
|
execDmc = procService.createExecutionContext(processContainerDmc, threadDmc, threadId);
|
||||||
}
|
}
|
||||||
|
@ -318,9 +315,7 @@ public class MIRunControlEventProcessor
|
||||||
|
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
if (procService != null) {
|
if (procService != null) {
|
||||||
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
|
||||||
IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
|
|
||||||
|
|
||||||
fCommandControl.getSession().dispatchEvent(
|
fCommandControl.getSession().dispatchEvent(
|
||||||
new MIRunningEvent(processContainerDmc, id, type), fCommandControl.getProperties());
|
new MIRunningEvent(processContainerDmc, id, type), fCommandControl.getProperties());
|
||||||
|
@ -343,9 +338,7 @@ public class MIRunControlEventProcessor
|
||||||
if (backendService != null && backendService.getIsAttachSession() == false) {
|
if (backendService != null && backendService.getIsAttachSession() == false) {
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
if (procService != null) {
|
if (procService != null) {
|
||||||
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
|
||||||
IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
|
|
||||||
|
|
||||||
fCommandControl.getSession().dispatchEvent(
|
fCommandControl.getSession().dispatchEvent(
|
||||||
new ContainerStartedDMEvent(processContainerDmc), fCommandControl.getProperties());
|
new ContainerStartedDMEvent(processContainerDmc), fCommandControl.getProperties());
|
||||||
|
@ -367,9 +360,7 @@ public class MIRunControlEventProcessor
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
if (runControl != null && procService != null) {
|
if (runControl != null && procService != null) {
|
||||||
// We don't know which thread stopped so we simply create a container event.
|
// We don't know which thread stopped so we simply create a container event.
|
||||||
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
|
||||||
IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
|
|
||||||
|
|
||||||
// An attaching operation is debugging a new inferior and always stops it.
|
// An attaching operation is debugging a new inferior and always stops it.
|
||||||
// We should not check that the container is suspended, because at startup, we are considered
|
// We should not check that the container is suspended, because at startup, we are considered
|
||||||
|
|
|
@ -197,8 +197,7 @@ public class MIRunControlEventProcessor_7_0
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
|
|
||||||
if (procService != null) {
|
if (procService != null) {
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, groupId);
|
||||||
IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
|
|
||||||
|
|
||||||
MIEvent<?> event = null;
|
MIEvent<?> event = null;
|
||||||
if ("thread-created".equals(miEvent)) { //$NON-NLS-1$
|
if ("thread-created".equals(miEvent)) { //$NON-NLS-1$
|
||||||
|
@ -216,6 +215,7 @@ public class MIRunControlEventProcessor_7_0
|
||||||
"thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
|
"thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
|
||||||
|
|
||||||
String groupId = null;
|
String groupId = null;
|
||||||
|
String pId = null;
|
||||||
|
|
||||||
MIResult[] results = exec.getMIResults();
|
MIResult[] results = exec.getMIResults();
|
||||||
for (int i = 0; i < results.length; i++) {
|
for (int i = 0; i < results.length; i++) {
|
||||||
|
@ -225,12 +225,22 @@ public class MIRunControlEventProcessor_7_0
|
||||||
if (val instanceof MIConst) {
|
if (val instanceof MIConst) {
|
||||||
groupId = ((MIConst) val).getString().trim();
|
groupId = ((MIConst) val).getString().trim();
|
||||||
}
|
}
|
||||||
|
} else if (var.equals("pid")) { //$NON-NLS-1$
|
||||||
|
// Available starting with GDB 7.2
|
||||||
|
if (val instanceof MIConst) {
|
||||||
|
pId = ((MIConst) val).getString().trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pId == null) {
|
||||||
|
// Before GDB 7.2, the groupId was the pid of the process
|
||||||
|
pId = groupId;
|
||||||
|
}
|
||||||
|
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
if (groupId != null && procService != null) {
|
if (pId != null && procService != null) {
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, pId);
|
||||||
|
|
||||||
MIEvent<?> event = null;
|
MIEvent<?> event = null;
|
||||||
if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
|
if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -295,8 +305,7 @@ public class MIRunControlEventProcessor_7_0
|
||||||
procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
|
procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
|
||||||
} else {
|
} else {
|
||||||
// This code would only trigger if the groupId was provided by MI
|
// This code would only trigger if the groupId was provided by MI
|
||||||
procDmc = procService.createProcessContext(fControlDmc, groupId);
|
containerDmc = procService.createContainerContextFromGroupId(fControlDmc, groupId);
|
||||||
containerDmc = procService.createContainerContext(procDmc, groupId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IExecutionDMContext execDmc = containerDmc;
|
IExecutionDMContext execDmc = containerDmc;
|
||||||
|
|
Loading…
Add table
Reference in a new issue