mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
fixed for bug# 151253 -Single steping a mult-thread program to fast results in unexpected behavior
This commit is contained in:
parent
f8b90d3d95
commit
06016b3405
7 changed files with 228 additions and 109 deletions
|
@ -184,9 +184,10 @@ public class ExpressionManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.lockTarget();
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarCreate var = factory.createMIVarCreate(code);
|
MIVarCreate var = factory.createMIVarCreate(code);
|
||||||
|
@ -204,6 +205,7 @@ public class ExpressionManager extends Manager {
|
||||||
} finally {
|
} finally {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -254,9 +254,10 @@ public class RegisterManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.lockTarget();
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarCreate var = factory.createMIVarCreate(regName);
|
MIVarCreate var = factory.createMIVarCreate(regName);
|
||||||
|
@ -269,8 +270,12 @@ public class RegisterManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
} finally {
|
||||||
|
target.releaseTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -424,13 +424,15 @@ public class SourceManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.lockTarget();
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
return getDetailTypeName(target, variable);
|
return getDetailTypeName(target, variable);
|
||||||
} finally {
|
} finally {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public String getDetailTypeName(Target target, String typename) throws CDIException {
|
public String getDetailTypeName(Target target, String typename) throws CDIException {
|
||||||
|
@ -460,13 +462,15 @@ public class SourceManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.lockTarget();
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
return getTypeName(target, variable);
|
return getTypeName(target, variable);
|
||||||
} finally {
|
} finally {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,9 +175,10 @@ public class VariableManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.lockTarget();
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
MISession miSession = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
RxThread rxThread = miSession.getRxThread();
|
RxThread rxThread = miSession.getRxThread();
|
||||||
rxThread.setEnableConsole(false);
|
rxThread.setEnableConsole(false);
|
||||||
|
@ -196,6 +197,7 @@ public class VariableManager extends Manager {
|
||||||
rxThread.setEnableConsole(true);
|
rxThread.setEnableConsole(true);
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_type")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_type")); //$NON-NLS-1$
|
||||||
|
@ -367,9 +369,10 @@ public class VariableManager extends Manager {
|
||||||
Target target = (Target)argDesc.getTarget();
|
Target target = (Target)argDesc.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.setCurrentThread(stack.getThread(), false);
|
target.lockTarget();
|
||||||
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(stack.getThread(), false);
|
||||||
|
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarCreate var = factory.createMIVarCreate(name);
|
MIVarCreate var = factory.createMIVarCreate(name);
|
||||||
|
@ -388,6 +391,7 @@ public class VariableManager extends Manager {
|
||||||
} finally {
|
} finally {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return argument;
|
return argument;
|
||||||
|
@ -398,9 +402,10 @@ public class VariableManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.lockTarget();
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
int depth = frame.getThread().getStackFrameCount();
|
int depth = frame.getThread().getStackFrameCount();
|
||||||
|
@ -429,6 +434,7 @@ public class VariableManager extends Manager {
|
||||||
} finally {
|
} finally {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
return (ICDIArgumentDescriptor[]) argObjects.toArray(new ICDIArgumentDescriptor[0]);
|
return (ICDIArgumentDescriptor[]) argObjects.toArray(new ICDIArgumentDescriptor[0]);
|
||||||
}
|
}
|
||||||
|
@ -489,9 +495,10 @@ public class VariableManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.lockTarget();
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
int level = frame.getLevel();
|
int level = frame.getLevel();
|
||||||
|
@ -514,6 +521,7 @@ public class VariableManager extends Manager {
|
||||||
} finally {
|
} finally {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
return (ICDILocalVariableDescriptor[]) varObjects.toArray(new ICDILocalVariableDescriptor[0]);
|
return (ICDILocalVariableDescriptor[]) varObjects.toArray(new ICDILocalVariableDescriptor[0]);
|
||||||
}
|
}
|
||||||
|
@ -530,9 +538,10 @@ public class VariableManager extends Manager {
|
||||||
Target target = (Target)varDesc.getTarget();
|
Target target = (Target)varDesc.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.setCurrentThread(stack.getThread(), false);
|
target.lockTarget();
|
||||||
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(stack.getThread(), false);
|
||||||
|
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIVarCreate var = factory.createMIVarCreate(name);
|
MIVarCreate var = factory.createMIVarCreate(name);
|
||||||
|
@ -551,6 +560,7 @@ public class VariableManager extends Manager {
|
||||||
} finally {
|
} finally {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return local;
|
return local;
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation;
|
import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||||
|
@ -87,6 +88,45 @@ import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo;
|
||||||
*/
|
*/
|
||||||
public class Target extends SessionObject implements ICDITarget {
|
public class Target extends SessionObject implements ICDITarget {
|
||||||
|
|
||||||
|
public class Lock {
|
||||||
|
|
||||||
|
java.lang.Thread heldBy;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
public Lock() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void aquire() {
|
||||||
|
if (heldBy == null || heldBy == java.lang.Thread.currentThread()) {
|
||||||
|
heldBy = java.lang.Thread.currentThread();
|
||||||
|
count++;
|
||||||
|
} else {
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
wait();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
if (heldBy == null) {
|
||||||
|
heldBy = java.lang.Thread.currentThread();
|
||||||
|
count++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void release() {
|
||||||
|
if (heldBy == null || heldBy != java.lang.Thread.currentThread()) {
|
||||||
|
throw new IllegalStateException("Thread does not own lock");
|
||||||
|
}
|
||||||
|
if(--count == 0) {
|
||||||
|
heldBy = null;
|
||||||
|
notifyAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MISession miSession;
|
MISession miSession;
|
||||||
ICDITargetConfiguration fConfiguration;
|
ICDITargetConfiguration fConfiguration;
|
||||||
Thread[] noThreads = new Thread[0];
|
Thread[] noThreads = new Thread[0];
|
||||||
|
@ -95,13 +135,22 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
String fEndian = null;
|
String fEndian = null;
|
||||||
boolean suspended = true;
|
boolean suspended = true;
|
||||||
boolean deferBreakpoints = true;
|
boolean deferBreakpoints = true;
|
||||||
|
Lock lock = new Lock();
|
||||||
|
|
||||||
public Target(Session s, MISession mi) {
|
public Target(Session s, MISession mi) {
|
||||||
super(s);
|
super(s);
|
||||||
miSession = mi;
|
miSession = mi;
|
||||||
currentThreads = noThreads;
|
currentThreads = noThreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void lockTarget() {
|
||||||
|
lock.aquire();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void releaseTarget() {
|
||||||
|
lock.release();
|
||||||
|
}
|
||||||
|
|
||||||
public MISession getMISession() {
|
public MISession getMISession() {
|
||||||
return miSession;
|
return miSession;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +165,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
public ICDITarget getTarget() {
|
public ICDITarget getTarget() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#setCurrentThread(ICDIThread)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#setCurrentThread(ICDIThread)
|
||||||
*/
|
*/
|
||||||
|
@ -127,7 +176,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
throw new CDIException(CdiResources.getString("cdi.model.Target.Unknown_thread")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.model.Target.Unknown_thread")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentThread(ICDIThread cthread, boolean doUpdate) throws CDIException {
|
public void setCurrentThread(ICDIThread cthread, boolean doUpdate) throws CDIException {
|
||||||
if (cthread instanceof Thread) {
|
if (cthread instanceof Thread) {
|
||||||
setCurrentThread((Thread)cthread, doUpdate);
|
setCurrentThread((Thread)cthread, doUpdate);
|
||||||
|
@ -163,7 +212,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
currentThreadId = info.getNewThreadId();
|
currentThreadId = info.getNewThreadId();
|
||||||
|
|
||||||
// @^&#@^$*^$
|
// @^&#@^$*^$
|
||||||
// GDB reset the currentFrame to some other level 0 when switching thread.
|
// GDB reset the currentFrame to some other level 0 when switching thread.
|
||||||
// we need to reposition the current stack level.
|
// we need to reposition the current stack level.
|
||||||
MIFrame miFrame = info.getFrame();
|
MIFrame miFrame = info.getFrame();
|
||||||
if (miFrame != null) {
|
if (miFrame != null) {
|
||||||
|
@ -176,7 +225,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
|
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
// Resetting threads may change the value of
|
// Resetting threads may change the value of
|
||||||
// some variables like Register. Call an update()
|
// some variables like Register. Call an update()
|
||||||
// To generate changeEvents.
|
// To generate changeEvents.
|
||||||
if (doUpdate) {
|
if (doUpdate) {
|
||||||
RegisterManager regMgr = session.getRegisterManager();
|
RegisterManager regMgr = session.getRegisterManager();
|
||||||
|
@ -192,7 +241,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
|
|
||||||
// We should be allright now.
|
// We should be allright now.
|
||||||
if (currentThreadId != id) {
|
if (currentThreadId != id) {
|
||||||
// thread is gone. Generate a Thread destroyed.
|
// thread is gone. Generate a Thread destroyed.
|
||||||
miSession.fireEvent(new MIThreadExitEvent(miSession, id));
|
miSession.fireEvent(new MIThreadExitEvent(miSession, id));
|
||||||
throw new CDIException(CdiResources.getString("cdi.model.Target.Cannot_switch_to_thread") + id); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.model.Target.Cannot_switch_to_thread") + id); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -205,7 +254,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
Thread[] oldThreads = currentThreads;
|
Thread[] oldThreads = currentThreads;
|
||||||
|
|
||||||
// If we use "info threads" in getCThreads() this
|
// If we use "info threads" in getCThreads() this
|
||||||
// will be overwritten. However if we use -stack-list-threads
|
// will be overwritten. However if we use -stack-list-threads
|
||||||
// it does not provide to the current thread
|
// it does not provide to the current thread
|
||||||
currentThreadId = newThreadId;
|
currentThreadId = newThreadId;
|
||||||
|
|
||||||
|
@ -280,11 +329,11 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
// HACK/FIXME: gdb/mi thread-list-ids does not
|
// HACK/FIXME: gdb/mi thread-list-ids does not
|
||||||
// show any newly create thread, we workaround by
|
// show any newly create thread, we workaround by
|
||||||
// issuing "info threads" instead.
|
// issuing "info threads" instead.
|
||||||
//MIThreadListIds tids = factory.createMIThreadListIds();
|
// MIThreadListIds tids = factory.createMIThreadListIds();
|
||||||
//MIThreadListIdsInfo info = tids.getMIThreadListIdsInfo();
|
// MIThreadListIdsInfo info = tids.getMIThreadListIdsInfo();
|
||||||
miSession.postCommand(tids);
|
miSession.postCommand(tids);
|
||||||
CLIInfoThreadsInfo info = tids.getMIInfoThreadsInfo();
|
CLIInfoThreadsInfo info = tids.getMIInfoThreadsInfo();
|
||||||
int [] ids;
|
int[] ids;
|
||||||
String[] names;
|
String[] names;
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
ids = new int[0];
|
ids = new int[0];
|
||||||
|
@ -310,7 +359,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
cthreads = new Thread[]{new Thread(this, 0)};
|
cthreads = new Thread[]{new Thread(this, 0)};
|
||||||
}
|
}
|
||||||
currentThreadId = info.getCurrentThread();
|
currentThreadId = info.getCurrentThread();
|
||||||
//FIX: When attaching there is no thread selected
|
// FIX: When attaching there is no thread selected
|
||||||
// We will choose the first one as a workaround.
|
// We will choose the first one as a workaround.
|
||||||
if (currentThreadId == 0 && cthreads.length > 0) {
|
if (currentThreadId == 0 && cthreads.length > 0) {
|
||||||
currentThreadId = cthreads[0].getId();
|
currentThreadId = cthreads[0].getId();
|
||||||
|
@ -416,10 +465,9 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
}
|
}
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepIntoInstruction()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepIntoInstruction()
|
||||||
*/
|
*/
|
||||||
|
@ -442,7 +490,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -466,7 +514,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
}
|
}
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -529,14 +577,14 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (location instanceof ICDIAddressLocation) {
|
} else if (location instanceof ICDIAddressLocation) {
|
||||||
ICDIAddressLocation addrLocation = (ICDIAddressLocation) location;
|
ICDIAddressLocation addrLocation = (ICDIAddressLocation)location;
|
||||||
if (! addrLocation.getAddress().equals(BigInteger.ZERO)) {
|
if (!addrLocation.getAddress().equals(BigInteger.ZERO)) {
|
||||||
loc = "*0x" + addrLocation.getAddress().toString(16); //$NON-NLS-1$
|
loc = "*0x" + addrLocation.getAddress().toString(16); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Throw an exception we do know where to go
|
// Throw an exception we do know where to go
|
||||||
if (loc == null) {
|
if (loc == null) {
|
||||||
throw new CDIException (CdiResources.getString("cdi.mode.Target.Bad_location")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.mode.Target.Bad_location")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
MIExecUntil until = factory.createMIExecUntil(loc);
|
MIExecUntil until = factory.createMIExecUntil(loc);
|
||||||
try {
|
try {
|
||||||
|
@ -547,7 +595,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
}
|
}
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -580,7 +628,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
((EventManager)getSession().getEventManager()).allowProcessingEvents(false);
|
((EventManager)getSession().getEventManager()).allowProcessingEvents(false);
|
||||||
suspend();
|
suspend();
|
||||||
} finally {
|
} finally {
|
||||||
((EventManager)getSession().getEventManager()).allowProcessingEvents(true);
|
((EventManager)getSession().getEventManager()).allowProcessingEvents(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CommandFactory factory = miSession.getCommandFactory();
|
CommandFactory factory = miSession.getCommandFactory();
|
||||||
|
@ -651,7 +699,7 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
}
|
}
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -676,14 +724,14 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (location instanceof ICDIAddressLocation) {
|
} else if (location instanceof ICDIAddressLocation) {
|
||||||
ICDIAddressLocation addrLocation = (ICDIAddressLocation) location;
|
ICDIAddressLocation addrLocation = (ICDIAddressLocation)location;
|
||||||
if (! addrLocation.getAddress().equals(BigInteger.ZERO)) {
|
if (!addrLocation.getAddress().equals(BigInteger.ZERO)) {
|
||||||
loc = "*0x" + addrLocation.getAddress().toString(16); //$NON-NLS-1$
|
loc = "*0x" + addrLocation.getAddress().toString(16); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Throw an exception we do know where to go
|
// Throw an exception we do know where to go
|
||||||
if (loc == null) {
|
if (loc == null) {
|
||||||
throw new CDIException (CdiResources.getString("cdi.mode.Target.Bad_location")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.mode.Target.Bad_location")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
CLIJump jump = factory.createCLIJump(loc);
|
CLIJump jump = factory.createCLIJump(loc);
|
||||||
|
@ -871,10 +919,10 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
*/
|
*/
|
||||||
public void deleteAllBreakpoints() throws CDIException {
|
public void deleteAllBreakpoints() throws CDIException {
|
||||||
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager();
|
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager();
|
||||||
bMgr.deleteAllBreakpoints(this);
|
bMgr.deleteAllBreakpoints(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createCondition(int, java.lang.String, String)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createCondition(int, java.lang.String, String)
|
||||||
*/
|
*/
|
||||||
public ICDICondition createCondition(int ignoreCount, String expression) {
|
public ICDICondition createCondition(int ignoreCount, String expression) {
|
||||||
|
@ -1090,14 +1138,14 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
if (fConfiguration == null) {
|
if (fConfiguration == null) {
|
||||||
if (miSession.isProgramSession()) {
|
if (miSession.isProgramSession()) {
|
||||||
fConfiguration = new TargetConfiguration(this);
|
fConfiguration = new TargetConfiguration(this);
|
||||||
} else if (miSession.isAttachSession()){
|
} else if (miSession.isAttachSession()) {
|
||||||
fConfiguration = new TargetConfiguration(this);
|
fConfiguration = new TargetConfiguration(this);
|
||||||
} else if (miSession.isCoreSession()) {
|
} else if (miSession.isCoreSession()) {
|
||||||
fConfiguration = new CoreFileConfiguration(this);
|
fConfiguration = new CoreFileConfiguration(this);
|
||||||
} else {
|
} else {
|
||||||
fConfiguration = new TargetConfiguration(this);
|
fConfiguration = new TargetConfiguration(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fConfiguration;
|
return fConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1119,12 +1167,12 @@ public class Target extends SessionObject implements ICDITarget {
|
||||||
if (varDesc instanceof RegisterDescriptor) {
|
if (varDesc instanceof RegisterDescriptor) {
|
||||||
Session session = (Session)getTarget().getSession();
|
Session session = (Session)getTarget().getSession();
|
||||||
RegisterManager mgr = session.getRegisterManager();
|
RegisterManager mgr = session.getRegisterManager();
|
||||||
return mgr.createRegister((RegisterDescriptor)varDesc);
|
return mgr.createRegister((RegisterDescriptor)varDesc);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deferBreakpoints( boolean defer ) {
|
public void deferBreakpoints(boolean defer) {
|
||||||
this.deferBreakpoints = defer;
|
this.deferBreakpoints = defer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,9 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
currentFrames = new ArrayList();
|
currentFrames = new ArrayList();
|
||||||
Target target = (Target)getTarget();
|
Target target = (Target)getTarget();
|
||||||
ICDIThread currentThread = target.getCurrentThread();
|
ICDIThread currentThread = target.getCurrentThread();
|
||||||
target.setCurrentThread(this, false);
|
target.lockTarget();
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(this, false);
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIStackListFrames frames = factory.createMIStackListFrames();
|
MIStackListFrames frames = factory.createMIStackListFrames();
|
||||||
|
@ -131,6 +132,7 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
} finally {
|
} finally {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
// assign the currentFrame if it was not done yet.
|
// assign the currentFrame if it was not done yet.
|
||||||
if (currentFrame == null) {
|
if (currentFrame == null) {
|
||||||
|
@ -152,8 +154,9 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
if (stackdepth == 0) {
|
if (stackdepth == 0) {
|
||||||
Target target = (Target)getTarget();
|
Target target = (Target)getTarget();
|
||||||
ICDIThread currentThread = target.getCurrentThread();
|
ICDIThread currentThread = target.getCurrentThread();
|
||||||
target.setCurrentThread(this, false);
|
target.lockTarget();
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(this, false);
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIStackInfoDepth depth = factory.createMIStackInfoDepth();
|
MIStackInfoDepth depth = factory.createMIStackInfoDepth();
|
||||||
|
@ -184,6 +187,7 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stackdepth;
|
return stackdepth;
|
||||||
|
@ -197,8 +201,9 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
currentFrames = new ArrayList();
|
currentFrames = new ArrayList();
|
||||||
Target target = (Target) getTarget();
|
Target target = (Target) getTarget();
|
||||||
ICDIThread currentThread = target.getCurrentThread();
|
ICDIThread currentThread = target.getCurrentThread();
|
||||||
target.setCurrentThread(this, false);
|
target.lockTarget();
|
||||||
try {
|
try {
|
||||||
|
target.setCurrentThread(this, false);
|
||||||
int depth = getStackFrameCount();
|
int depth = getStackFrameCount();
|
||||||
int upperBound;
|
int upperBound;
|
||||||
// try to get the largest subset.
|
// try to get the largest subset.
|
||||||
|
@ -230,6 +235,7 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
} finally {
|
} finally {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
// take time to assign the currentFrame, if it is in the set
|
// take time to assign the currentFrame, if it is in the set
|
||||||
if (currentFrame == null) {
|
if (currentFrame == null) {
|
||||||
|
@ -268,7 +274,6 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
Target target = (Target)getTarget();
|
Target target = (Target)getTarget();
|
||||||
MISession mi = target.getMISession();
|
MISession mi = target.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
@ -277,29 +282,33 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
int miLevel = getStackFrameCount() - frameLevel;
|
int miLevel = getStackFrameCount() - frameLevel;
|
||||||
MIStackSelectFrame frame = factory.createMIStackSelectFrame(miLevel);
|
MIStackSelectFrame frame = factory.createMIStackSelectFrame(miLevel);
|
||||||
// Set ourself as the current thread first.
|
// Set ourself as the current thread first.
|
||||||
target.setCurrentThread(this, doUpdate);
|
target.lockTarget();
|
||||||
mi.postCommand(frame);
|
try {
|
||||||
MIInfo info = frame.getMIInfo();
|
target.setCurrentThread(this, doUpdate);
|
||||||
if (info == null) {
|
mi.postCommand(frame);
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
MIInfo info = frame.getMIInfo();
|
||||||
}
|
if (info == null) {
|
||||||
currentFrame = stackframe;
|
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||||
// Resetting stackframe may change the value of
|
|
||||||
// some variables like registers. Call an update()
|
|
||||||
// To generate changeEvents.
|
|
||||||
if (doUpdate) {
|
|
||||||
Session session = (Session) target.getSession();
|
|
||||||
RegisterManager regMgr = session.getRegisterManager();
|
|
||||||
if (regMgr.isAutoUpdate()) {
|
|
||||||
regMgr.update(target);
|
|
||||||
}
|
}
|
||||||
VariableManager varMgr = session.getVariableManager();
|
currentFrame = stackframe;
|
||||||
if (varMgr.isAutoUpdate()) {
|
// Resetting stackframe may change the value of
|
||||||
varMgr.update(target);
|
// some variables like registers. Call an update()
|
||||||
|
// To generate changeEvents.
|
||||||
|
if (doUpdate) {
|
||||||
|
Session session = (Session) target.getSession();
|
||||||
|
RegisterManager regMgr = session.getRegisterManager();
|
||||||
|
if (regMgr.isAutoUpdate()) {
|
||||||
|
regMgr.update(target);
|
||||||
|
}
|
||||||
|
VariableManager varMgr = session.getVariableManager();
|
||||||
|
if (varMgr.isAutoUpdate()) {
|
||||||
|
varMgr.update(target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
|
} finally {
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,8 +323,13 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepInto(int)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepInto(int)
|
||||||
*/
|
*/
|
||||||
public void stepInto(int count) throws CDIException {
|
public void stepInto(int count) throws CDIException {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
((Target)getTarget()).lockTarget();
|
||||||
getTarget().stepInto(count);
|
try {
|
||||||
|
((Target)getTarget()).setCurrentThread(this);
|
||||||
|
getTarget().stepInto(count);
|
||||||
|
} finally {
|
||||||
|
((Target)getTarget()).releaseTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -329,8 +343,13 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepIntoInstruction(int)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepIntoInstruction(int)
|
||||||
*/
|
*/
|
||||||
public void stepIntoInstruction(int count) throws CDIException {
|
public void stepIntoInstruction(int count) throws CDIException {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
((Target)getTarget()).lockTarget();
|
||||||
getTarget().stepIntoInstruction(count);
|
try {
|
||||||
|
((Target)getTarget()).setCurrentThread(this);
|
||||||
|
getTarget().stepIntoInstruction(count);
|
||||||
|
} finally {
|
||||||
|
((Target)getTarget()).releaseTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -344,9 +363,13 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOver(int)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOver(int)
|
||||||
*/
|
*/
|
||||||
public void stepOver(int count) throws CDIException {
|
public void stepOver(int count) throws CDIException {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
((Target)getTarget()).lockTarget();
|
||||||
getTarget().stepOver(count);
|
try {
|
||||||
|
((Target)getTarget()).setCurrentThread(this);
|
||||||
|
getTarget().stepOver(count);
|
||||||
|
} finally {
|
||||||
|
((Target)getTarget()).releaseTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -360,8 +383,13 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOverInstruction(int)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOverInstruction(int)
|
||||||
*/
|
*/
|
||||||
public void stepOverInstruction(int count) throws CDIException {
|
public void stepOverInstruction(int count) throws CDIException {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
((Target)getTarget()).lockTarget();
|
||||||
getTarget().stepOverInstruction(count);
|
try {
|
||||||
|
((Target)getTarget()).setCurrentThread(this);
|
||||||
|
getTarget().stepOverInstruction(count);
|
||||||
|
} finally {
|
||||||
|
((Target)getTarget()).releaseTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -382,9 +410,14 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepUntil(org.eclipse.cdt.debug.core.cdi.ICDILocation)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepUntil(org.eclipse.cdt.debug.core.cdi.ICDILocation)
|
||||||
*/
|
*/
|
||||||
public void stepUntil(ICDILocation location) throws CDIException {
|
public void stepUntil(ICDILocation location) throws CDIException {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
((Target)getTarget()).lockTarget();
|
||||||
getTarget().stepUntil(location);
|
try {
|
||||||
}
|
((Target)getTarget()).setCurrentThread(this);
|
||||||
|
getTarget().stepUntil(location);
|
||||||
|
} finally {
|
||||||
|
((Target)getTarget()).releaseTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#isSuspended()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#isSuspended()
|
||||||
|
@ -412,26 +445,38 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void resume(boolean passSignal) throws CDIException {
|
public void resume(boolean passSignal) throws CDIException {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
((Target)getTarget()).lockTarget();
|
||||||
getTarget().resume(passSignal);
|
try {
|
||||||
|
((Target)getTarget()).setCurrentThread(this);
|
||||||
|
getTarget().resume(passSignal);
|
||||||
|
} finally {
|
||||||
|
((Target)getTarget()).releaseTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.ICDILocation)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.ICDILocation)
|
||||||
*/
|
*/
|
||||||
public void resume(ICDILocation location) throws CDIException {
|
public void resume(ICDILocation location) throws CDIException {
|
||||||
// TODO Auto-generated method stub
|
((Target)getTarget()).lockTarget();
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
try {
|
||||||
getTarget().resume(location);
|
((Target)getTarget()).setCurrentThread(this);
|
||||||
|
getTarget().resume(location);
|
||||||
|
} finally {
|
||||||
|
((Target)getTarget()).releaseTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.model.ICDISignal)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.model.ICDISignal)
|
||||||
*/
|
*/
|
||||||
public void resume(ICDISignal signal) throws CDIException {
|
public void resume(ICDISignal signal) throws CDIException {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
((Target)getTarget()).lockTarget();
|
||||||
getTarget().resume(signal);
|
try {
|
||||||
|
((Target)getTarget()).setCurrentThread(this);
|
||||||
|
getTarget().resume(signal);
|
||||||
|
} finally {
|
||||||
|
((Target)getTarget()).releaseTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -240,17 +240,18 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
StackFrame frame = (StackFrame)getStackFrame();
|
StackFrame frame = (StackFrame)getStackFrame();
|
||||||
Thread thread = (Thread)getThread();
|
Thread thread = (Thread)getThread();
|
||||||
if (frame != null) {
|
target.lockTarget();
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
|
||||||
} else if (thread != null) {
|
|
||||||
target.setCurrentThread(thread, false);
|
|
||||||
}
|
|
||||||
MISession mi = target.getMISession();
|
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
|
||||||
String exp = "sizeof(" + getTypeName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
MIDataEvaluateExpression evaluate = factory.createMIDataEvaluateExpression(exp);
|
|
||||||
try {
|
try {
|
||||||
|
if (frame != null) {
|
||||||
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
|
} else if (thread != null) {
|
||||||
|
target.setCurrentThread(thread, false);
|
||||||
|
}
|
||||||
|
MISession mi = target.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
String exp = "sizeof(" + getTypeName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
MIDataEvaluateExpression evaluate = factory.createMIDataEvaluateExpression(exp);
|
||||||
mi.postCommand(evaluate);
|
mi.postCommand(evaluate);
|
||||||
MIDataEvaluateExpressionInfo info = evaluate.getMIDataEvaluateExpressionInfo();
|
MIDataEvaluateExpressionInfo info = evaluate.getMIDataEvaluateExpressionInfo();
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
|
@ -260,11 +261,15 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
if (frame != null) {
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
if (frame != null) {
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
} else if (thread != null) {
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
target.setCurrentThread(currentThread, false);
|
} else if (thread != null) {
|
||||||
|
target.setCurrentThread(currentThread, false);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
target.releaseTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue