2010-11-27 42 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 

所以,如果你需要最後幾幀,你可以使用負數。