hi
GDB branch tracing offer function and instruction histories,
function history generate a "call graph" of functions over time,
here is an example:
(gdb) record function-call-history /ilc 1
1 main inst 1,8 at function_call_history.c:40,41
2 inc inst 9,19 at function_call_history.c:22,24
3 main inst 20,31 at function_call_history.c:40,41
4 inc inst 32,42 at function_call_history.c:22,24
5 main inst 43,54 at function_call_history.c:40,41
6 inc inst 55,65 at function_call_history.c:22,24
7 main inst 66,77 at function_call_history.c:40,41
8 inc inst 78,88 at function_call_history.c:22,24
9 main inst 89,100 at function_call_history.c:40,41
10 inc inst 101,111 at function_call_history.c:22,24
11 main inst 112,123 at function_call_history.c:40,41
12 inc inst 124,134 at function_call_history.c:22,24
13 main inst 135,146 at function_call_history.c:40,41
14 inc inst 147,157 at function_call_history.c:22,24
15 main inst 158,169 at function_call_history.c:40,41
16 inc inst 170,180 at function_call_history.c:22,24
17 main inst 181,192 at function_call_history.c:40,41
18 inc inst 193,203 at function_call_history.c:22,24
19 main inst 204,215 at function_call_history.c:40,41
20 inc inst 216,226 at function_call_history.c:22,24
21 main inst 227,238 at function_call_history.c:40,43
22 fib inst 239,249 at function_call_history.c:28,32
23 fib inst 250,262 at function_call_history.c:28,33
24 fib inst 263,267 at function_call_history.c:32
25 fib inst 268,278 at function_call_history.c:28,32
26 fib inst 279,291 at function_call_history.c:28,33
27 fib inst 292,296 at function_call_history.c:32
28 fib inst 297,309 at function_call_history.c:28,33
29 fib inst 310,315 at function_call_history.c:32,33
30 fib inst 316,321 at function_call_history.c:32,33
31 main inst 322,326 at function_call_history.c:43,44
(gdb)
instruction history generate a list of
assembly instructions that were executed with mapping to the
source code. here is an example
function_call_history.c:33 }
259 0x000103e4 <fib+44>: mov r0, r3
260 0x000103e6 <fib+46>: adds r7, #12
261 0x000103e8 <fib+48>: mov sp, r7
262 0x000103ea <fib+50>: pop {r4, r7, pc}
263 0x000103d4 <fib+28>: mov r4, r0
264 0x000103d6 <fib+30>: ldr r3, [r7, #4]
265 0x000103d8 <fib+32>: subs r3, #1
266 0x000103da <fib+34>: mov r0, r3
267 0x000103dc <fib+36>: bl 0x103b8 <fib>
function_call_history.c:28 {
268 0x000103b8 <fib+0>: push {r4, r7, lr}
269 0x000103ba <fib+2>: sub sp, #12
270 0x000103bc <fib+4>: add r7, sp, #0
271 0x000103be <fib+6>: str r0, [r7, #4]
function_call_history.c:29 if (n <= 1)
272 0x000103c0 <fib+8>: ldr r3, [r7, #4]
273 0x000103c2 <fib+10>: cmp r3, #1
274 0x000103c4 <fib+12>: bgt.n 0x103ca <fib+18>
function_call_history.c:32 return fib(n-2) + fib(n-1);
275 0x000103ca <fib+18>: ldr r3, [r7, #4]
276 0x000103cc <fib+20>: subs r3, #2
277 0x000103ce <fib+22>: mov r0, r3
278 0x000103d0 <fib+24>: bl 0x103b8 <fib>
function_call_history.c:28 {
279 0x000103b8 <fib+0>: push {r4, r7, lr}
280 0x000103ba <fib+2>: sub sp, #12
281 0x000103bc <fib+4>: add r7, sp, #0
282 0x000103be <fib+6>: str r0, [r7, #4]
function_call_history.c:29 if (n <= 1)
283 0x000103c0 <fib+8>: ldr r3, [r7, #4]
284 0x000103c2 <fib+10>: cmp r3, #1
285 0x000103c4 <fib+12>: bgt.n 0x103ca <fib+18>
function_call_history.c:30 return n;
286 0x000103c6 <fib+14>: ldr r3, [r7, #4]
287 0x000103c8 <fib+16>: b.n 0x103e4 <fib+44>
is it possible to display function
calls history as a flame chart, and instruction history as an
event list? what do we need to interface it to gdb and get a
smooth transition between debug view and trace comapss view?
Kind Regards
Zied Guermazi
--
Zied Guermazi
founder
Trande UG
Leuschnerstraße 2
69469 Weinheim/Germany
Mobile: +491722645127
mailto:zied.guermazi@xxxxxxxxx
Trande UG
Leuschnerstraße
2, D-69469 Weinheim; Telefon: +491722645127
Sitz der Gesellschaft:
Weinheim- Registergericht: AG Mannheim HRB 736209 -
Geschäftsführung: Zied Guermazi
Confidentiality
Note
This
message is intended only for the use of the named
recipient(s) and may contain confidential and/or
privileged information. If you are not the intended
recipient, please contact the sender and delete the
message. Any unauthorized use of the information
contained in this message is prohibited.