I set a breakpoint and set its conditions and some other commands. Now I realize that I should had set it a few lines ahead. How can I change the line of the breakpoint without deleting it and losing its settings?
Setting breakpoints A breakpoint is like a stop sign in your code -- whenever gdb gets to a breakpoint it halts execution of your program and allows you to examine it. To set breakpoints, type "break [filename]:[linenumber]". For example, if you wanted to set a breakpoint at line 55 of main.
You can create a breakpoint at an offset from the current stopped position with gdb breakpoint +<offset> . You can also create a breakpoint on a specific line number using either gdb break <linenumber> (for the current source file) or gdb break <filename>:<linenumber> (for a file other than the current file).
The breakpoint will stop your program just before it executes any of the code on that line. Set a breakpoint at line linenum in source file filename . Set a breakpoint at entry to function function found in file filename .
How can I change the line of the breakpoint without deleting it and losing its settings?
You can't.
What you can do is use save breakpoints /tmp/bp.txt
command to save current settings for all breakpoints, edit the /tmp/bp.txt
file to update the line info (or anything else), and finally delete
to remove current breakpoints and source /tmp/bp.txt
to reload them.
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