mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
2 new methods getStackFrame(int low, int hi) and
getStackFrameCount().
This commit is contained in:
parent
9a302b9897
commit
2638b185d2
1 changed files with 58 additions and 0 deletions
|
@ -11,10 +11,12 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIStackInfoDepth;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIStackListFrames;
|
import org.eclipse.cdt.debug.mi.core.command.MIStackListFrames;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIStackSelectFrame;
|
import org.eclipse.cdt.debug.mi.core.command.MIStackSelectFrame;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIStackInfoDepthInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIStackListFramesInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIStackListFramesInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,6 +86,62 @@ public class CThread extends CObject implements ICDIThread {
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getStackFrames()
|
||||||
|
*/
|
||||||
|
public int getStackFrameCount() throws CDIException {
|
||||||
|
CSession session = getCTarget().getCSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIStackInfoDepth depth = factory.createMIStackInfoDepth();
|
||||||
|
try {
|
||||||
|
mi.postCommand(depth);
|
||||||
|
MIStackInfoDepthInfo info = depth.getMIStackInfoDepthInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
return info.getDepth();
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new CDIException(e.getMessage());
|
||||||
|
//System.out.println(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getStackFrames()
|
||||||
|
*/
|
||||||
|
public ICDIStackFrame[] getStackFrames(int low, int high) throws CDIException {
|
||||||
|
StackFrame[] stack = noStack;
|
||||||
|
CSession session = getCTarget().getCSession();
|
||||||
|
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIStackListFrames frames = factory.createMIStackListFrames(low, high);
|
||||||
|
try {
|
||||||
|
ICDIThread oldThread = getCTarget().getCurrentThread();
|
||||||
|
getCTarget().setCurrentThread(this);
|
||||||
|
mi.postCommand(frames);
|
||||||
|
MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
MIFrame[] miFrames = info.getMIFrames();
|
||||||
|
stack = new StackFrame[miFrames.length];
|
||||||
|
for (int i = 0; i < stack.length; i++) {
|
||||||
|
stack[i] = new StackFrame(this, miFrames[i]);
|
||||||
|
}
|
||||||
|
getCTarget().setCurrentThread(oldThread);
|
||||||
|
return stack;
|
||||||
|
} catch (MIException e) {
|
||||||
|
//throw new CDIException(e.getMessage());
|
||||||
|
//System.out.println(e);
|
||||||
|
} catch (CDIException e) {
|
||||||
|
//throw e;
|
||||||
|
//System.out.println(e);
|
||||||
|
}
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#setCurrentStackFrame(ICDIStackFrame)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#setCurrentStackFrame(ICDIStackFrame)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue