write function-call-history
https://sourceware.org/gdb/onlinedocs/gdb/Process-Record-and-Replay.html
This can be a great hardware accelerated feature if you are one of the few people (2015) with a processor that supports Intel Processor Tracking (Intel PT, intel_pt in /proc/cpuinfo ).
GDB docs claim they can generate output, for example:
(gdb) list 1, 10 1 void foo (void) 2 { 3 } 4 5 void bar (void) 6 { 7 ... 8 foo (); 9 ... 10 } (gdb) record function-call-history /ilc 1 bar inst 1,4 at foo.c:6,8 2 foo inst 5,10 at foo.c:2,3 3 bar inst 11,13 at foo.c:9,10
Before using it, you need to run:
start record btrace
where processor failure is not possible:
Target does not support branch tracing.
CPU support is further discussed in: How to run the history of command entries and the history of function calls in GDB?
Related topics:
- How to track function call in C?
- Is there a compiler function for entering custom functions and exiting code?
For the built-in, you also consider JTAG and supporting hardware like ARM DSTREAM , but x86 support doesn’t look very good: debugging the x86 kernel with a hardware debugger
Ciro Santilli 华 涌 低端 人口 六四 事件 法轮功 Aug 04 '15 at 16:26 2015-08-04 16:26
source share