I'm debugging a kernel, and apparently the way fault handlers operate on ARM is they go through hundreds of layers of __pabt_usr's before they reach any actual code. Anyway, I'm doing this debugging remotely through an emulator, and fetching the trace bit by bit is slow. Is there any way to fetch the whole thing at once?
EDIT: Printing the stack trace in reverse would also be helpful.
To print a backtrace of the entire stack, use the backtrace command, or its alias bt . This command will print one line per frame for frames in the stack. By default, all stack frames are printed. You can stop the backtrace at any time by typing the system interrupt character, normally Ctrl-c .
A full stack trace allows you to see the chain of files from when your custom tag reached your set breakpoint. If you click on any of the pages in the caller chain then FusionDebug will show you that page and will highlight the line at which the next page in the chain was called.
Use the "info threads" command to see the IDs of currently known threads. The GDB thread debugging facility allows you to observe all threads while your program runs--but whenever GDB takes control, one thread in particular is always the focus of debugging. This thread is called the current thread.
I don't know if the full backtrace can be given but you can give a numeric argument to 'bt' to get more frames:
(gdb) bt 10
#0 x () at test.c:4
#1 0x080483bf in x () at test.c:4
#2 0x080483bf in x () at test.c:4
#3 0x080483bf in x () at test.c:4
#4 0x080483bf in x () at test.c:4
#5 0x080483bf in x () at test.c:4
#6 0x080483bf in x () at test.c:4
#7 0x080483bf in x () at test.c:4
#8 0x080483bf in x () at test.c:4
#9 0x080483bf in x () at test.c:4
(More stack frames follow...)
This also works with negative numbers, which give the outermost frames:
(gdb) bt -2
#122467 0x080483bf in x () at test.c:4
#122468 0x080483bf in x () at test.c:4
So if you need the last couple of frames, you could use a negative number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With