1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Hacked threadId for non multi-thread applications.

This commit is contained in:
Francois Chouinard 2008-07-27 18:05:39 +00:00
parent 7506ff7d02
commit 15070bcc55
2 changed files with 7 additions and 5 deletions

View file

@ -303,7 +303,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl
private StateChangeReason fStateChangeReason;
private IExecutionDMContext fStateChangeTriggeringContext;
private static final int DEFAULT_THREAD_ID = 1;
private static final int FAKE_THREAD_ID = 0;
public MIRunControl(DsfSession session) {
super(session);
@ -655,9 +655,11 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl
private IExecutionDMContext[] makeExecutionDMCs(IContainerDMContext containerCtx, MIThreadListIdsInfo info) {
if (info.getThreadIds().length == 0) {
//Main thread always exist even if it is not reported by GDB.
//So create thread-id= 0 when no thread is reported
return new IMIExecutionDMContext[]{createMIExecutionContext(containerCtx, DEFAULT_THREAD_ID)};
// Main thread always exist even if it is not reported by GDB.
// So create thread-id = 0 when no thread is reported.
// This hack is necessary to prevent AbstractMIControl from issuing a thread-select
// because it doesn't work if the application was not compiled with pthread.
return new IMIExecutionDMContext[]{new MIExecutionDMC(getSession().getId(), containerCtx, FAKE_THREAD_ID)};
} else {
IExecutionDMContext[] executionDmcs = new IMIExecutionDMContext[info.getThreadIds().length];
for (int i = 0; i < info.getThreadIds().length; i++) {

View file

@ -259,7 +259,7 @@ public abstract class AbstractMIControl extends AbstractDsfService
if (runControl != null && execDmc != null && runControl.isSuspended(execDmc)) {
// Before the command is sent, Check the Thread Id and send it to
// the queue only if the id has been changed.
if (targetThread != -1 && targetThread != fCurrentThreadId) {
if (targetThread > 0 && targetThread != fCurrentThreadId) {
fCurrentThreadId = targetThread;
resetCurrentStackLevel();
CommandHandle cmdHandle = new CommandHandle(new MIThreadSelect(execDmc), null);