Is there a way to set a breakpoint at every line in the code with GDB? Obviously I don\'t want to hit b *addr
for every single line, so I\'m wondering if there\'s a
Can't you just place the breakpoint on the first line of execution and then step through each line ? This depends on what are you trying to achieve by setting breakpoints on each line. If you want to evaluate expressions, you can do it by following my logic (step through each line).
PowerPC has hardware support for ranged breakpoints, and GCB offers:
break-range start end
in that arch. So I think you could just break on the entire memory address, or the entire text section (untested).
The command fails on x86.
Doc: https://sourceware.org/gdb/onlinedocs/gdb.html#index-break_002drange-1548
Use si
(stepi
) to instruction step through the code. You can use ni
(nexti
) to step over library functions you're not interested in. If you accidentally step into one of them, finish
should get you back to your original routine. People working at this level typically have gdb set to display the next few instructions that are about to be executed, e.g. disp/3i $pc
.