(編輯:根據當前「技巧」下面的第一個答案似乎是使用Atom處理器,但我希望有些gdb大師可以回答這是否是一個基本的限制,或者是否在路線圖上添加對其他處理器的支持?)如何在GDB中運行記錄指令歷史和函數調用歷史記錄?
反向執行似乎在我的環境中工作:我可以反向繼續,看到一個似是而非的記錄日誌,並在其中走動:
(gdb) start
...Temporary breakpoint 5 at 0x8048460: file bang.cpp, line 13.
Starting program: /home/thomasg/temp/./bang
Temporary breakpoint 5, main() at bang.cpp:13
13 f(1000);
(gdb) record
(gdb) continue
Continuing.
Breakpoint 3, f (d=900) at bang.cpp:5
5 if(d) {
(gdb) info record
Active record target: record-full
Record mode:
Lowest recorded instruction number is 1.
Highest recorded instruction number is 1005.
Log contains 1005 instructions.
Max logged instructions is 200000.
(gdb) reverse-continue
Continuing.
Breakpoint 3, f (d=901) at bang.cpp:5
5 if(d) {
(gdb) record goto end
Go forward to insn number 1005
#0 f (d=900) at bang.cpp:5
5 if(d) {
但是指令和功能的歷史不可用:
(gdb) record instruction-history
You can't do that when your target is `record-full'
(gdb) record function-call-history
You can't do that when your target is `record-full'
並且唯一可用的目標類型已滿,另一個記錄類型「btrace」會因「目標不支持分支跟蹤」而失敗。因爲它是現代主流(gdb 7.6.1-ubuntu,在amd64 Linux Mint「Petra」上運行「Intel(R)Core™」),所以它很可能只是不支持這個目標。 i5-3570「)我希望我忽略了一個關鍵的步驟或配置?
有很多輝煌的答案肉質的鏈接 - 我沒有把PT作爲同義詞/底層技術(https:// sof tware.intel.com/en-us/blogs/2013/09/18/processor-tracing) - 謝謝! –