2010-11-27 45 views
3

我正在调试一个内核,很明显,错误处理程序在ARM上运行的方式是在__pabt_usr层到达任何实际代码之前,它们会经过数百个层。无论如何,我通过模拟器远程执行调试,并且慢慢获取跟踪信息。有什么方法可以一次获取所有东西吗?如何在一次性获取gdb中的整个堆栈跟踪?

编辑:反向打印堆栈跟踪也将有所帮助。

+0

我不确定我是否理解你的问题,但也许你想要类似[`bt`](http://www.circlemud.org/cdp/gdb/gdb_7.html#SEC42)或`bt full` ? – 2010-11-27 16:24:10

回答

5

我不知道是否完整回溯可以给,但你可以给一个数值参数“BT”来获得更多的图像:

(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...) 

这也适用于负数,这给最帧:

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

所以,如果你需要最后几帧,你可以使用负数。