How to get whole stack trace in gdb in one snapshot?

I am debugging the kernel, and apparently how the error handlers on ARM work, they look at hundreds of __pabt_usr levels before they reach the real code. Anyway, I do this debugging remotely through the emulator, and fetching by bits is slow. Is there a way to get everything at once?

EDIT: It will also be useful to print the stack trace in reverse order.

+3
source share
1 answer

I don’t know if it is possible to provide full backtrace, but you can give the numeric argument β€œ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 that give the outermost frames:

(gdb) bt -2
#122467 0x080483bf in x () at test.c:4
#122468 0x080483bf in x () at test.c:4

, , .

+5

Source: https://habr.com/ru/post/1777195/


All Articles