This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
How do I get at the current stack pointer?
- From: Johan Walles <d92-jwa at nada dot kth dot se>
- To: gdb at sources dot redhat dot com
- Date: Fri, 06 Sep 2002 10:54:58 +0200
- Subject: How do I get at the current stack pointer?
Hi!
We are developing a virtual machine for Java. On Linux/IA64, the stack
lay out for the methods we have generated is different from that of
compiled C code. Thus, when walking the stack, in a back trace for
example, GDB can step into one of our stack frames, but on the way out
it gets confused.
We are trying to solve this problem by adding some code to
get_prev_frame() in blockframe.c, that:
* Checks the inferior for a stack walking helper function.
* If it exists, calls the function with the current pc and the current
stack pointer (bsp). It returns the stack pointer (bsp) and pc for the
previous frame.
I have two questions about this. First, does this seem like a
reasonable solution, or do you think there is an easier way for us to do
this?
Second, if I have a struct frame_info *, how do I get a stack pointer
out of it? I get the pc using gdbarch_frame_saved_pc() but I can't seem
to find a similar function for accessing the stack pointer.
Cheers //Johan