1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 17:55:39 +02:00

More comments

This commit is contained in:
Alain Magloire 2003-03-16 21:52:13 +00:00
parent 14e24ea6b1
commit 5dfe2bf8c4
2 changed files with 24 additions and 0 deletions

View file

@ -26,6 +26,29 @@ public class StackFrame extends CObject implements ICDIStackFrame {
Thread cthread;
int level;
/*
*
GDB/MI does not keep the stack level, from what we expect. In gdb, the
highest stack is level 0 and lower stack as the highest level:
-stack-list-frames
^done,stack=[frame={level="0 ",addr="0x0804845b",func="main",file="hello.c",line="24"},
frame={level="1 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}]
-stack-list-frames
^done,stack=[frame={level="0 ",addr="0x08048556",func="main2",file="hello.c",line="58"},
frame={level="1 ",addr="0x08048501",func="main",file="hello.c",line="41"},
frame={level="2 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}]
This is of no use to us since the level is always "0". The level is necessary for example when
doing recursive calls to make a distinction between frames.
So in CDT this reverse the hidghest frame will have the highest number. In CDT:
stack=[frame={level="2 ",addr="0x0804845b",func="main",file="hello.c",line="24"},
frame={level="1 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}]
stack=[frame={level="3 ",addr="0x08048556",func="main2",file="hello.c",line="58"},
frame={level="2 ",addr="0x08048501",func="main",file="hello.c",line="41"},
frame={level="1 ",addr="0x42017499",func="__libc_start_main",from="/lib/i686/libc.so.6"}]
*/
public StackFrame(Thread thread, MIFrame f, int l) {
super(thread.getTarget());
cthread = thread;

View file

@ -207,6 +207,7 @@ public class Thread extends CObject implements ICDIThread {
MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory();
// Need the GDB/MI view of level which is the reverse, i.e. the highest level is 0
// See comment in StackFrame constructor.
int miLevel = getStackFrameCount() - frameLevel;
MIStackSelectFrame frame = factory.createMIStackSelectFrame(miLevel);
// Set ourself as the current thread first.