I'm running through some assembly code in GDB trying to debug my program and I'd like to see what happens if I ignore an instruction entirely, is there a way to do this? (skip past it to the next line without executing it) without having to edit the source code and comment out the function and then recompile?
Sure: jump *0x1234 will jump to instruction at address 0x1234 .
Description. This command jumps the program counter to the specified location. The debugger resumes program execution at that point unless it encounters a breakpoint there.
If you really want to skip a line, thus stepping to the next one but NOT executing it, you can use jump X (X being a line number). Be careful and use breakpoints, because using jump will make the debugger resume code execution from line X.
Start calc from within gdb using the run command. It will go into an infinite loop. Press Ctrl-C (like before) to stop your program.
is there a way to do this
Sure: jump *0x1234
will jump to instruction at address 0x1234
.
skip past it to the next line without executing it
"Next line" and assembly debugging rarely go together. As this answer shows, you can skip a line as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With