1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Implement getCurrentStackFrame()

This commit is contained in:
Alain Magloire 2002-08-30 04:56:28 +00:00
parent b5478f02b4
commit 8c9166d694

View file

@ -23,6 +23,7 @@ public class CThread extends CObject implements ICDIThread {
int id; int id;
static StackFrame[] noStack = new StackFrame[0]; static StackFrame[] noStack = new StackFrame[0];
StackFrame currentFrame;
public CThread(CTarget target, int threadId) { public CThread(CTarget target, int threadId) {
super(target); super(target);
@ -37,12 +38,8 @@ public class CThread extends CObject implements ICDIThread {
return Integer.toString(id); return Integer.toString(id);
} }
/** StackFrame getCurrentStackFrame() {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#finish() return currentFrame;
*/
public void finish() throws CDIException {
getCTarget().setCurrentThread(this);
getTarget().finish();
} }
/** /**
@ -71,11 +68,11 @@ public class CThread extends CObject implements ICDIThread {
} }
return stack; return stack;
} catch (MIException e) { } catch (MIException e) {
//throw new CDIException(e.toString()); //throw new CDIException(e.getMessage());
System.out.println(e); //System.out.println(e);
} catch (CDIException e) { } catch (CDIException e) {
//throw e; //throw e;
System.out.println(e); //System.out.println(e);
} }
return stack; return stack;
} }
@ -86,17 +83,22 @@ public class CThread extends CObject implements ICDIThread {
public void setCurrentStackFrame(StackFrame stackframe) throws CDIException { public void setCurrentStackFrame(StackFrame stackframe) throws CDIException {
MISession mi = getCTarget().getCSession().getMISession(); MISession mi = getCTarget().getCSession().getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
int frameNum = stackframe.getLevel(); int frameNum = 0;
if (stackframe != null) {
frameNum = stackframe.getLevel();
}
MIStackSelectFrame frame = factory.createMIStackSelectFrame(frameNum); MIStackSelectFrame frame = factory.createMIStackSelectFrame(frameNum);
try { try {
// Set ourself as the current thread first.
getCTarget().setCurrentThread(this); getCTarget().setCurrentThread(this);
mi.postCommand(frame); mi.postCommand(frame);
MIInfo info = frame.getMIInfo(); MIInfo info = frame.getMIInfo();
if (info == null) { if (info == null) {
throw new CDIException("No answer"); throw new CDIException("No answer");
} }
currentFrame = stackframe;
} catch (MIException e) { } catch (MIException e) {
throw new CDIException(e.toString()); throw new CDIException(e.getMessage());
} }
} }
@ -107,6 +109,14 @@ public class CThread extends CObject implements ICDIThread {
return getTarget().isSuspended(); return getTarget().isSuspended();
} }
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#finish()
*/
public void finish() throws CDIException {
getCTarget().setCurrentThread(this);
getTarget().finish();
}
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#resume() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#resume()
*/ */