mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 353423: Simpler solution using -thread-info instead of -list-thread-groups --recurse 1
This commit is contained in:
parent
ebfa9bcd0a
commit
fd690737ac
1 changed files with 33 additions and 41 deletions
|
@ -30,10 +30,8 @@ import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
|
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
|
||||||
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.output.MIInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIListThreadGroupsInfo;
|
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIListThreadGroupsInfo.IThreadGroupInfo;
|
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIListThreadGroupsInfo.IThreadGroupInfo2;
|
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIThread;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIThread;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIThreadInfoInfo;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
@ -179,52 +177,46 @@ public class GDBRunControl_7_2_NS extends GDBRunControl_7_0_NS
|
||||||
fConnection.queueCommand(fCommandFactory.createMIExecContinue(context), new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
fConnection.queueCommand(fCommandFactory.createMIExecContinue(context), new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
protected void refreshThreads() {
|
protected void refreshThreads() {
|
||||||
fConnection.queueCommand(
|
fConnection.queueCommand(
|
||||||
fCommandFactory.createMIListThreadGroups(fConnection.getContext(), false, true),
|
fCommandFactory.createMIThreadInfo(fConnection.getContext()),
|
||||||
new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), null) {
|
new DataRequestMonitor<MIThreadInfoInfo>(getExecutor(), null) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
IThreadGroupInfo[] groups = getData().getGroupList();
|
MIThread[] threadList = getData().getThreadList();
|
||||||
for (IThreadGroupInfo group : groups) {
|
for (MIThread thread : threadList) {
|
||||||
if (group instanceof IThreadGroupInfo2) {
|
String threadId = thread.getThreadId();
|
||||||
MIThread[] threadList = ((IThreadGroupInfo2)group).getThreads();
|
IMIContainerDMContext containerDmc =
|
||||||
for (MIThread thread : threadList) {
|
fProcService.createContainerContextFromThreadId(fConnection.getContext(), threadId);
|
||||||
String threadId = thread.getThreadId();
|
IProcessDMContext processDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
|
||||||
IMIContainerDMContext containerDmc =
|
IThreadDMContext threadDmc =
|
||||||
fProcService.createContainerContextFromThreadId(fConnection.getContext(), threadId);
|
fProcService.createThreadContext(processDmc, threadId);
|
||||||
IProcessDMContext processDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
|
IMIExecutionDMContext execDmc = fProcService.createExecutionContext(containerDmc, threadDmc, threadId);
|
||||||
IThreadDMContext threadDmc =
|
|
||||||
fProcService.createThreadContext(processDmc, threadId);
|
|
||||||
IMIExecutionDMContext execDmc = fProcService.createExecutionContext(containerDmc, threadDmc, threadId);
|
|
||||||
|
|
||||||
MIThreadRunState threadState = fThreadRunStates.get(execDmc);
|
MIThreadRunState threadState = fThreadRunStates.get(execDmc);
|
||||||
if (threadState != null) {
|
if (threadState != null) {
|
||||||
// We may not know this thread. This can happen when dealing with a remote
|
// We may not know this thread. This can happen when dealing with a remote
|
||||||
// where thread events are not reported immediately.
|
// where thread events are not reported immediately.
|
||||||
// However, the -list-thread-groups command we just sent will make
|
// However, the -list-thread-groups command we just sent will make
|
||||||
// GDB send those events. Therefore, we can just ignore threads we don't
|
// GDB send those events. Therefore, we can just ignore threads we don't
|
||||||
// know about, and wait for those events.
|
// know about, and wait for those events.
|
||||||
if (MIThread.MI_THREAD_STATE_RUNNING.equals(thread.getState())) {
|
if (MIThread.MI_THREAD_STATE_RUNNING.equals(thread.getState())) {
|
||||||
if (threadState.fSuspended == true) {
|
if (threadState.fSuspended == true) {
|
||||||
// We missed a resumed event! Send it now.
|
// We missed a resumed event! Send it now.
|
||||||
IResumedDMEvent resumedEvent = new ResumedEvent(execDmc, null);
|
IResumedDMEvent resumedEvent = new ResumedEvent(execDmc, null);
|
||||||
fConnection.getSession().dispatchEvent(resumedEvent, getProperties());
|
fConnection.getSession().dispatchEvent(resumedEvent, getProperties());
|
||||||
}
|
}
|
||||||
} else if (MIThread.MI_THREAD_STATE_STOPPED.equals(thread.getState())) {
|
} else if (MIThread.MI_THREAD_STATE_STOPPED.equals(thread.getState())) {
|
||||||
if (threadState.fSuspended == false) {
|
if (threadState.fSuspended == false) {
|
||||||
// We missed a suspend event! Send it now.
|
// We missed a suspend event! Send it now.
|
||||||
ISuspendedDMEvent suspendedEvent = new SuspendedEvent(execDmc, null);
|
ISuspendedDMEvent suspendedEvent = new SuspendedEvent(execDmc, null);
|
||||||
fConnection.getSession().dispatchEvent(suspendedEvent, getProperties());
|
fConnection.getSession().dispatchEvent(suspendedEvent, getProperties());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert false : "Invalid thread state: " + thread.getState(); //$NON-NLS-1$
|
assert false : "Invalid thread state: " + thread.getState(); //$NON-NLS-1$
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue