开发者

How do I get an entire stack trace in gdb in one shot?

I'm debugging a ker开发者_C百科nel, 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜