I need to analyse a large pcap file and find problematic packets, so I want gdb
automatically outputs packet index when error occurs. Below are the gdb
commands:
(gdb) b packet.c:1430
Breakpoint 2 at 0x7ffff0f910aa: file packet.c, line 1430.
(gdb) commands
Type commands for breakpoint(s) 2, one per line.
End with a line saying just "end".
>silent
>frame 10
>printf "frame.number == %zu ||\n", packet_index
>c
>end
(gdb) r
Or you put them in a script:
b packet.c:1430
commands
silent
frame 10
printf "frame.number == %zu ||\n", packet_index
c
end
And it should be handy to log the output for checking later:
(gdb) set logging on