mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-30 21:55:31 +02:00
Implement getCurrentStackFrame()
This commit is contained in:
parent
b5478f02b4
commit
8c9166d694
1 changed files with 21 additions and 11 deletions
|
@ -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()
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue