mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-27 02:45:32 +02:00
Bug 245749 In the end, we decided to isolate the threadId to groupId map into the eventProcessor, and not crowd the IMIProcesses interface.
This commit is contained in:
parent
2552eacead
commit
0fb7dec635
9 changed files with 92 additions and 132 deletions
|
@ -98,11 +98,20 @@ public class GDBProcesses extends MIProcesses {
|
||||||
return GdbPlugin.getBundleContext();
|
return GdbPlugin.getBundleContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getExecutionData(IThreadDMContext dmc, DataRequestMonitor<IThreadDMData> rm) {
|
public void getExecutionData(IThreadDMContext dmc, DataRequestMonitor<IThreadDMData> rm) {
|
||||||
if (dmc instanceof IMIProcessDMContext) {
|
if (dmc instanceof IMIProcessDMContext) {
|
||||||
String pidStr = ((IMIProcessDMContext)dmc).getProcId();
|
String pidStr = ((IMIProcessDMContext)dmc).getProcId();
|
||||||
|
// In our context hierarchy we don't actually use the pid in this version, because in this version,
|
||||||
|
// we only debug a single process. This means we will not have a proper pid in all cases
|
||||||
|
// inside the context, so must find it another way. Note that this method is also called to find the name
|
||||||
|
// of processes to attach to, and in this case, we do have the proper pid.
|
||||||
|
if (pidStr == null || pidStr.length() == 0) {
|
||||||
|
MIInferiorProcess inferiorProcess = fGdb.getInferiorProcess();
|
||||||
|
if (inferiorProcess != null) {
|
||||||
|
pidStr = inferiorProcess.getPid();
|
||||||
|
}
|
||||||
|
}
|
||||||
int pid = -1;
|
int pid = -1;
|
||||||
try {
|
try {
|
||||||
pid = Integer.parseInt(pidStr);
|
pid = Integer.parseInt(pidStr);
|
||||||
|
@ -110,7 +119,7 @@ public class GDBProcesses extends MIProcesses {
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = fProcessNames.get(pid);
|
String name = fProcessNames.get(pid);
|
||||||
// If we 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) name = fGdb.getExecutablePath().lastSegment();
|
||||||
rm.setData(new MIThreadDMData(name, pidStr));
|
rm.setData(new MIThreadDMData(name, pidStr));
|
||||||
rm.done();
|
rm.done();
|
||||||
|
@ -182,8 +191,7 @@ public class GDBProcesses extends MIProcesses {
|
||||||
// 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);
|
||||||
// Get the groupId properly for the case of an attach
|
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
String groupId = getExecutionGroupIdFromThread(null);
|
|
||||||
IProcessDMContext procDmc = createProcessContext(controlDmc, groupId);
|
IProcessDMContext procDmc = createProcessContext(controlDmc, groupId);
|
||||||
IMIExecutionGroupDMContext newGroupDmc = createExecutionGroupContext(procDmc, groupId);
|
IMIExecutionGroupDMContext newGroupDmc = createExecutionGroupContext(procDmc, groupId);
|
||||||
rm.setData(new IContainerDMContext[] {newGroupDmc});
|
rm.setData(new IContainerDMContext[] {newGroupDmc});
|
||||||
|
@ -262,21 +270,4 @@ public class GDBProcesses extends MIProcesses {
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExecutionGroupIdFromThread(String threadId) {
|
|
||||||
// We need to properly return the groupId based on the pid
|
|
||||||
// to properly handle the case of an attach. See bug 244749
|
|
||||||
String groupId = null;
|
|
||||||
MIInferiorProcess inferiorProcess = fGdb.getInferiorProcess();
|
|
||||||
if (inferiorProcess != null) {
|
|
||||||
groupId = inferiorProcess.getPid();
|
|
||||||
}
|
|
||||||
if (groupId != null) {
|
|
||||||
return groupId;
|
|
||||||
} else {
|
|
||||||
return super.getExecutionGroupIdFromThread(threadId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,8 +325,6 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IMIProcesses
|
||||||
|
|
||||||
// A map of process id to process names. It is filled when we get all the processes that are running
|
// A map of process id to process names. It is filled when we get all the processes that are running
|
||||||
private Map<String, String> fProcessNames = new HashMap<String, String>();
|
private Map<String, String> fProcessNames = new HashMap<String, String>();
|
||||||
// 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> fGroupIdMap = new HashMap<String, String>();
|
|
||||||
|
|
||||||
private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
|
private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -683,12 +681,6 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IMIProcesses
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutionGroupIdFromThread(String threadId) {
|
|
||||||
String groupId = fGroupIdMap.get(threadId);
|
|
||||||
if (groupId == null) return ""; //$NON-NLS-1$
|
|
||||||
else return groupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(final MIThreadGroupCreatedEvent e) {
|
public void eventDispatched(final MIThreadGroupCreatedEvent e) {
|
||||||
IProcessDMContext procDmc = e.getDMContext();
|
IProcessDMContext procDmc = e.getDMContext();
|
||||||
|
@ -752,13 +744,4 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IMIProcesses
|
||||||
fContainerCommandCache.reset(context);
|
fContainerCommandCache.reset(context);
|
||||||
fThreadCommandCache.reset(context);
|
fThreadCommandCache.reset(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addThreadId(String threadId, String groupId) {
|
|
||||||
fGroupIdMap.put(threadId, groupId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeThreadId(String threadId) {
|
|
||||||
fGroupIdMap.remove(threadId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,30 +53,5 @@ public interface IMIProcesses extends IProcesses
|
||||||
*/
|
*/
|
||||||
IMIExecutionGroupDMContext createExecutionGroupContext(IProcessDMContext processDmc,
|
IMIExecutionGroupDMContext createExecutionGroupContext(IProcessDMContext processDmc,
|
||||||
String groupId);
|
String groupId);
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the groupId to which this threadId belongs
|
|
||||||
*
|
|
||||||
* @param threadId The ID of the thread
|
|
||||||
* @return The ID of the group to which the specified thread belongs
|
|
||||||
*/
|
|
||||||
String getExecutionGroupIdFromThread(String threadId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method should be called when a new thread is created. It allows
|
|
||||||
* to keep track of the thread to group relationship.
|
|
||||||
*
|
|
||||||
* @param threadId The ID of the new thread
|
|
||||||
* @param groupId The ID of the group to which the new thread belongs
|
|
||||||
*/
|
|
||||||
void addThreadId(String threadId, String groupId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method should be called when a thread exits. It is meant
|
|
||||||
* to remove the thread to group entry.
|
|
||||||
*
|
|
||||||
* @param threadId The ID of the thread that exited
|
|
||||||
*/
|
|
||||||
void removeThreadId(String threadId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,7 +302,7 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
|
||||||
|
|
||||||
private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
|
private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
|
||||||
// The unique id should be an empty string so that the views know not to display the fake id
|
// The unique id should be an empty string so that the views know not to display the fake id
|
||||||
private static final String UNIQUE_GROUP_ID = ""; //$NON-NLS-1$
|
public static final String UNIQUE_GROUP_ID = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
public MIProcesses(DsfSession session) {
|
public MIProcesses(DsfSession session) {
|
||||||
super(session);
|
super(session);
|
||||||
|
@ -553,8 +553,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);
|
||||||
// Get the groupId properly for the case of an attach
|
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
String groupId = getExecutionGroupIdFromThread(null);
|
|
||||||
IProcessDMContext procDmc = createProcessContext(controlDmc, groupId);
|
IProcessDMContext procDmc = createProcessContext(controlDmc, groupId);
|
||||||
IMIExecutionGroupDMContext newGroupDmc = createExecutionGroupContext(procDmc, groupId);
|
IMIExecutionGroupDMContext newGroupDmc = createExecutionGroupContext(procDmc, groupId);
|
||||||
rm.setData(new IContainerDMContext[] {newGroupDmc});
|
rm.setData(new IContainerDMContext[] {newGroupDmc});
|
||||||
|
@ -607,10 +606,6 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutionGroupIdFromThread(String threadId) {
|
|
||||||
return UNIQUE_GROUP_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(IResumedDMEvent e) {
|
public void eventDispatched(IResumedDMEvent e) {
|
||||||
if (e instanceof IContainerResumedDMEvent) {
|
if (e instanceof IContainerResumedDMEvent) {
|
||||||
|
@ -648,15 +643,4 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
|
||||||
public void flushCache(IDMContext context) {
|
public void flushCache(IDMContext context) {
|
||||||
fContainerCommandCache.reset(context);
|
fContainerCommandCache.reset(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addThreadId(String threadId, String groupId) {
|
|
||||||
// This version of the service does not support multiple
|
|
||||||
// processes, so there is nothing to do here
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeThreadId(String threadId) {
|
|
||||||
// This version of the service does not support multiple
|
|
||||||
// processes, so there is nothing to do here
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandC
|
||||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||||
|
import org.eclipse.dd.mi.service.MIProcesses;
|
||||||
import org.eclipse.dd.mi.service.command.commands.CLICommand;
|
import org.eclipse.dd.mi.service.command.commands.CLICommand;
|
||||||
import org.eclipse.dd.mi.service.command.commands.MIInterpreterExecConsole;
|
import org.eclipse.dd.mi.service.command.commands.MIInterpreterExecConsole;
|
||||||
import org.eclipse.dd.mi.service.command.events.MIBreakpointChangedEvent;
|
import org.eclipse.dd.mi.service.command.events.MIBreakpointChangedEvent;
|
||||||
|
@ -123,13 +124,15 @@ public class CLIEventProcessor
|
||||||
String threadId = Integer.toString(++fLastThreadId);
|
String threadId = Integer.toString(++fLastThreadId);
|
||||||
|
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
String groupId = procService.getExecutionGroupIdFromThread(threadId);
|
if (procService != null) {
|
||||||
|
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
|
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
||||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(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());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// For GDB thread exit events, we won't use the events generated by GDB. This event is
|
// For GDB thread exit events, we won't use the events generated by GDB. This event is
|
||||||
// raised in GDBRunControl class by polling and comparing the ExecutionContexts returned by
|
// raised in GDBRunControl class by polling and comparing the ExecutionContexts returned by
|
||||||
|
@ -173,7 +176,8 @@ public class CLIEventProcessor
|
||||||
if (type != -1) {
|
if (type != -1) {
|
||||||
// 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);
|
||||||
String groupId = procService.getExecutionGroupIdFromThread(null);
|
if (procService != null) {
|
||||||
|
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
|
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
||||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
||||||
|
@ -181,6 +185,7 @@ public class CLIEventProcessor
|
||||||
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An attempt to discover the command type and
|
* An attempt to discover the command type and
|
||||||
|
@ -188,7 +193,7 @@ public class CLIEventProcessor
|
||||||
*/
|
*/
|
||||||
private void processSettingChanges(CLICommand<?> cmd) {
|
private void processSettingChanges(CLICommand<?> cmd) {
|
||||||
String operation = cmd.getOperation().trim();
|
String operation = cmd.getOperation().trim();
|
||||||
// In refactoring we are no longer genwerating the token id as
|
// In refactoring we are no longer generating the token id as
|
||||||
// part of the command. It is passed here and stored away and
|
// part of the command. It is passed here and stored away and
|
||||||
// then never really used. So it has just been changed to 0.
|
// then never really used. So it has just been changed to 0.
|
||||||
processSettingChanges(cmd.getContext(), 0, operation);
|
processSettingChanges(cmd.getContext(), 0, operation);
|
||||||
|
@ -197,7 +202,7 @@ public class CLIEventProcessor
|
||||||
private void processSettingChanges(MIInterpreterExecConsole<?> exec) {
|
private void processSettingChanges(MIInterpreterExecConsole<?> exec) {
|
||||||
String[] operations = exec.getParameters();
|
String[] operations = exec.getParameters();
|
||||||
if (operations != null && operations.length > 0) {
|
if (operations != null && operations.length > 0) {
|
||||||
// In refactoring we are no longer genwerating the token id as
|
// In refactoring we are no longer generating the token id as
|
||||||
// part of the command. It is passed here and stored away and
|
// part of the command. It is passed here and stored away and
|
||||||
// then never really used. So it has just been changed to 0.
|
// then never really used. So it has just been changed to 0.
|
||||||
processSettingChanges(exec.getContext(), 0, operations[0]);
|
processSettingChanges(exec.getContext(), 0, operations[0]);
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandC
|
||||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||||
|
import org.eclipse.dd.mi.service.MIProcesses;
|
||||||
import org.eclipse.dd.mi.service.command.commands.MIExecContinue;
|
import org.eclipse.dd.mi.service.command.commands.MIExecContinue;
|
||||||
import org.eclipse.dd.mi.service.command.commands.MIExecFinish;
|
import org.eclipse.dd.mi.service.command.commands.MIExecFinish;
|
||||||
import org.eclipse.dd.mi.service.command.commands.MIExecNext;
|
import org.eclipse.dd.mi.service.command.commands.MIExecNext;
|
||||||
|
@ -136,8 +137,10 @@ public class MIRunControlEventProcessor
|
||||||
// "reason" ??? still fire a stopped event.
|
// "reason" ??? still fire a stopped event.
|
||||||
if (events.isEmpty()) {
|
if (events.isEmpty()) {
|
||||||
MIEvent<?> e = createEvent(STOPPED_REASON, exec);
|
MIEvent<?> e = createEvent(STOPPED_REASON, exec);
|
||||||
|
if (e != null) {
|
||||||
events.add(e);
|
events.add(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (MIEvent<?> event : events) {
|
for (MIEvent<?> event : events) {
|
||||||
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
||||||
|
@ -149,7 +152,6 @@ public class MIRunControlEventProcessor
|
||||||
|
|
||||||
protected MIEvent<?> createEvent(String reason, MIExecAsyncOutput exec) {
|
protected MIEvent<?> createEvent(String reason, MIExecAsyncOutput exec) {
|
||||||
String threadId = null;
|
String threadId = null;
|
||||||
String groupId = 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++) {
|
||||||
|
@ -164,8 +166,11 @@ public class MIRunControlEventProcessor
|
||||||
}
|
}
|
||||||
|
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
|
if (procService == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
groupId = procService.getExecutionGroupIdFromThread(threadId);
|
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
|
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
||||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
||||||
|
@ -241,12 +246,14 @@ public class MIRunControlEventProcessor
|
||||||
else { type = MIRunningEvent.CONTINUE; }
|
else { type = MIRunningEvent.CONTINUE; }
|
||||||
|
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
String groupId = procService.getExecutionGroupIdFromThread(null);
|
if (procService != null) {
|
||||||
|
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
||||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
||||||
|
|
||||||
fCommandControl.getSession().dispatchEvent(
|
fCommandControl.getSession().dispatchEvent(
|
||||||
new MIRunningEvent(processContainerDmc, id, type), fCommandControl.getProperties());
|
new MIRunningEvent(processContainerDmc, id, type), fCommandControl.getProperties());
|
||||||
|
}
|
||||||
} else if ("exit".equals(state)) { //$NON-NLS-1$
|
} else if ("exit".equals(state)) { //$NON-NLS-1$
|
||||||
// No need to do anything, terminate() will.
|
// No need to do anything, terminate() will.
|
||||||
// Send exited?
|
// Send exited?
|
||||||
|
|
|
@ -11,8 +11,10 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.mi.service.command;
|
package org.eclipse.dd.mi.service.command;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
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.IProcesses.IThreadDMContext;
|
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||||
|
@ -86,6 +88,11 @@ public class MIRunControlEventProcessor_7_0
|
||||||
|
|
||||||
private final DsfServicesTracker fServicesTracker;
|
private final DsfServicesTracker fServicesTracker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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> fGroupIdMap = new HashMap<String, String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the event processor and registers it as listener with the debugger
|
* Creates the event processor and registers it as listener with the debugger
|
||||||
* control.
|
* control.
|
||||||
|
@ -142,8 +149,10 @@ public class MIRunControlEventProcessor_7_0
|
||||||
// "reason" ??? still fire a stopped event.
|
// "reason" ??? still fire a stopped event.
|
||||||
if (events.isEmpty()) {
|
if (events.isEmpty()) {
|
||||||
MIEvent<?> e = createEvent(STOPPED_REASON, exec);
|
MIEvent<?> e = createEvent(STOPPED_REASON, exec);
|
||||||
|
if (e != null) {
|
||||||
events.add(e);
|
events.add(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (MIEvent<?> event : events) {
|
for (MIEvent<?> event : events) {
|
||||||
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
||||||
|
@ -178,18 +187,19 @@ public class MIRunControlEventProcessor_7_0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
|
||||||
|
|
||||||
if ("thread-created".equals(miEvent)) { //$NON-NLS-1$
|
if ("thread-created".equals(miEvent)) { //$NON-NLS-1$
|
||||||
// Update the thread to groupId map with the new groupId
|
// Update the thread to groupId map with the new groupId
|
||||||
procService.addThreadId(threadId, groupId);
|
fGroupIdMap.put(threadId, groupId);
|
||||||
} else {
|
} else {
|
||||||
// It was not clear if MI would specify the groupId in the event
|
// It was not clear if MI would specify the groupId in the thread-exited event
|
||||||
if (groupId == null) {
|
if (groupId == null) {
|
||||||
groupId = procService.getExecutionGroupIdFromThread(threadId);
|
groupId = fGroupIdMap.get(threadId);
|
||||||
}
|
}
|
||||||
procService.removeThreadId(threadId);
|
fGroupIdMap.remove(threadId);
|
||||||
}
|
}
|
||||||
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
|
|
||||||
|
if (procService != null) {
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
||||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
||||||
|
|
||||||
|
@ -201,6 +211,7 @@ public class MIRunControlEventProcessor_7_0
|
||||||
}
|
}
|
||||||
|
|
||||||
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
||||||
|
}
|
||||||
} else if ("thread-group-created".equals(miEvent) || "thread-group-exited".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
|
} else if ("thread-group-created".equals(miEvent) || "thread-group-exited".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
String groupId = null;
|
String groupId = null;
|
||||||
|
@ -216,8 +227,8 @@ public class MIRunControlEventProcessor_7_0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupId != null) {
|
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
|
if (groupId != null && procService != null) {
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
||||||
|
|
||||||
MIEvent<?> event = null;
|
MIEvent<?> event = null;
|
||||||
|
@ -255,10 +266,13 @@ public class MIRunControlEventProcessor_7_0
|
||||||
}
|
}
|
||||||
|
|
||||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||||
|
if (procService == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// MI does not currently provide the group-id in these events
|
// MI does not currently provide the group-id in these events
|
||||||
if (groupId == null) {
|
if (groupId == null) {
|
||||||
groupId = procService.getExecutionGroupIdFromThread(threadId);
|
groupId = fGroupIdMap.get(threadId);
|
||||||
}
|
}
|
||||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
|
||||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
||||||
|
|
|
@ -108,9 +108,9 @@ public class GDBProcessesTest extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
fSession.getExecutor().submit(new Runnable() {
|
fSession.getExecutor().submit(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String pid = fProcService.getExecutionGroupIdFromThread(null);
|
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
|
|
||||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGdbCtrl.getContext(), pid);
|
IProcessDMContext procDmc = fProcService.createProcessContext(fGdbCtrl.getContext(), groupId);
|
||||||
fProcService.getExecutionData(procDmc, rm);
|
fProcService.getExecutionData(procDmc, rm);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -158,7 +158,7 @@ public class GDBProcessesTest extends BaseTestCase {
|
||||||
|
|
||||||
fProcService.getExecutor().submit(new Runnable() {
|
fProcService.getExecutor().submit(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String groupId = fProcService.getExecutionGroupIdFromThread(THREAD_ID);
|
String groupId = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGdbCtrl.getContext(), groupId);
|
IProcessDMContext procDmc = fProcService.createProcessContext(fGdbCtrl.getContext(), groupId);
|
||||||
IThreadDMContext threadDmc = fProcService.createThreadContext(procDmc, THREAD_ID);
|
IThreadDMContext threadDmc = fProcService.createThreadContext(procDmc, THREAD_ID);
|
||||||
fProcService.getExecutionData(threadDmc, rm);
|
fProcService.getExecutionData(threadDmc, rm);
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControlDMConte
|
||||||
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
||||||
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;
|
||||||
|
import org.eclipse.dd.mi.service.MIProcesses;
|
||||||
import org.eclipse.dd.mi.service.MIRunControl;
|
import org.eclipse.dd.mi.service.MIRunControl;
|
||||||
import org.eclipse.dd.mi.service.command.events.MIStoppedEvent;
|
import org.eclipse.dd.mi.service.command.events.MIStoppedEvent;
|
||||||
import org.eclipse.dd.mi.service.command.output.MIInfo;
|
import org.eclipse.dd.mi.service.command.output.MIInfo;
|
||||||
|
@ -115,7 +116,7 @@ public class MIRunControlTest extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String pid = fProcService.getExecutionGroupIdFromThread(null);
|
String pid = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
||||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
||||||
fRunCtrl.getExecutionContexts(groupDmc, rm);
|
fRunCtrl.getExecutionContexts(groupDmc, rm);
|
||||||
|
@ -201,7 +202,7 @@ public class MIRunControlTest extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String pid = fProcService.getExecutionGroupIdFromThread(null);
|
String pid = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
||||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
||||||
fRunCtrl.getExecutionContexts(groupDmc, rmExecutionCtxts);
|
fRunCtrl.getExecutionContexts(groupDmc, rmExecutionCtxts);
|
||||||
|
@ -253,7 +254,7 @@ public class MIRunControlTest extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String pid = fProcService.getExecutionGroupIdFromThread(null);
|
String pid = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
||||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
||||||
fRunCtrl.getExecutionData(fRunCtrl.createMIExecutionContext(groupDmc, 1), rm);
|
fRunCtrl.getExecutionData(fRunCtrl.createMIExecutionContext(groupDmc, 1), rm);
|
||||||
|
@ -472,7 +473,7 @@ public class MIRunControlTest extends BaseTestCase {
|
||||||
|
|
||||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String pid = fProcService.getExecutionGroupIdFromThread(null);
|
String pid = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
||||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
||||||
fRunCtrl.resume(groupDmc, rm);
|
fRunCtrl.resume(groupDmc, rm);
|
||||||
|
@ -492,7 +493,7 @@ public class MIRunControlTest extends BaseTestCase {
|
||||||
wait.waitReset();
|
wait.waitReset();
|
||||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String pid = fProcService.getExecutionGroupIdFromThread(null);
|
String pid = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
||||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
||||||
|
|
||||||
|
@ -547,7 +548,7 @@ public class MIRunControlTest extends BaseTestCase {
|
||||||
wait.waitReset();
|
wait.waitReset();
|
||||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String pid = fProcService.getExecutionGroupIdFromThread(null);
|
String pid = MIProcesses.UNIQUE_GROUP_ID;
|
||||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
||||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, pid);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue