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:
parent
7506ff7d02
commit
15070bcc55
2 changed files with 7 additions and 5 deletions
|
@ -303,7 +303,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl
|
||||||
private StateChangeReason fStateChangeReason;
|
private StateChangeReason fStateChangeReason;
|
||||||
private IExecutionDMContext fStateChangeTriggeringContext;
|
private IExecutionDMContext fStateChangeTriggeringContext;
|
||||||
|
|
||||||
private static final int DEFAULT_THREAD_ID = 1;
|
private static final int FAKE_THREAD_ID = 0;
|
||||||
|
|
||||||
public MIRunControl(DsfSession session) {
|
public MIRunControl(DsfSession session) {
|
||||||
super(session);
|
super(session);
|
||||||
|
@ -656,8 +656,10 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl
|
||||||
private IExecutionDMContext[] makeExecutionDMCs(IContainerDMContext containerCtx, MIThreadListIdsInfo info) {
|
private IExecutionDMContext[] makeExecutionDMCs(IContainerDMContext containerCtx, MIThreadListIdsInfo info) {
|
||||||
if (info.getThreadIds().length == 0) {
|
if (info.getThreadIds().length == 0) {
|
||||||
// Main thread always exist even if it is not reported by GDB.
|
// Main thread always exist even if it is not reported by GDB.
|
||||||
//So create thread-id= 0 when no thread is reported
|
// So create thread-id = 0 when no thread is reported.
|
||||||
return new IMIExecutionDMContext[]{createMIExecutionContext(containerCtx, DEFAULT_THREAD_ID)};
|
// 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 {
|
} else {
|
||||||
IExecutionDMContext[] executionDmcs = new IMIExecutionDMContext[info.getThreadIds().length];
|
IExecutionDMContext[] executionDmcs = new IMIExecutionDMContext[info.getThreadIds().length];
|
||||||
for (int i = 0; i < info.getThreadIds().length; i++) {
|
for (int i = 0; i < info.getThreadIds().length; i++) {
|
||||||
|
|
|
@ -259,7 +259,7 @@ public abstract class AbstractMIControl extends AbstractDsfService
|
||||||
if (runControl != null && execDmc != null && runControl.isSuspended(execDmc)) {
|
if (runControl != null && execDmc != null && runControl.isSuspended(execDmc)) {
|
||||||
// Before the command is sent, Check the Thread Id and send it to
|
// Before the command is sent, Check the Thread Id and send it to
|
||||||
// the queue only if the id has been changed.
|
// the queue only if the id has been changed.
|
||||||
if (targetThread != -1 && targetThread != fCurrentThreadId) {
|
if (targetThread > 0 && targetThread != fCurrentThreadId) {
|
||||||
fCurrentThreadId = targetThread;
|
fCurrentThreadId = targetThread;
|
||||||
resetCurrentStackLevel();
|
resetCurrentStackLevel();
|
||||||
CommandHandle cmdHandle = new CommandHandle(new MIThreadSelect(execDmc), null);
|
CommandHandle cmdHandle = new CommandHandle(new MIThreadSelect(execDmc), null);
|
||||||
|
|
Loading…
Add table
Reference in a new issue