Arm, prepare custom frame for gdb.
dpc@ucore.info
dpc@ucore.info
Tue May 24 23:08:00 GMT 2011
Hi,
I'm writing a ARM exception handlers, and I'd like to make gdb use the
interrupted code backtrace as ancestor of handling code. This would
allow to break on supervisor logic and `backtrace` command would
display the backtrace of interrupted non-supervisor code as well.
Obviously the handler is written in assembler. I'm dumping whole
context and moving on to C code that handles the required logic. When
I'm doing `backtrace` inside the C code, the backtrace is displayed to
the point of assembler code for exception entering and "Backtrace
stopped: previous frame identical to this frame (corrupt stack?)"
The C code is using virtual frame pointer (I think) as fp/ip does not
seem to be used on disassembled code. -O2 is causing -fomit-frame, I
guess.
I'm trying to put some values in ip / fp before calling C code so that
gdb recognizes dumped exception context as a stack frame and
interrupted code as a "caller". However without luck. It seems to me
that gdb does not use the hard frame (fp) registers in case of lacking
virtual frame pointers.
I suspect the following could be possible:
- add some linker symbols to assembler code so that gdb recognizes
dumped interrupt context as frame
- set some option in gdb so it uses fp for finding frame
or, might be, I just don't set the fp correctly (but I think I do).
Could anyone help me with an insights, links or example code how to
achieve what I've described?
Regards,
--
Dawid Ciężarkiewicz
http://ucore.info
More information about the Gdb
mailing list