I'm using some third party macros in gdb, which take a long time to run.
I keep pressing Enter, because my muscle memory does that.
This causes the macro to run again.
Is there any way that I can persuade gdb
not to run the previous command on pressing Enter?
I found the dont-repeat
documentation, but it seems that I have to add it to the user-defined command. These are third-party commands, and I don't particularly want to edit all of them.
Is there any way to turn this behaviour off globally? Or for specific commands (possibly with a wildcard/regex)?
To stop your program while it is running, type "(ctrl) + c" (hold down the ctrl key and press c). gdb will stop your program at whatever line it has just executed. From here you can examine variables and move through your program. To specify other places where gdb should stop, see the section on breakpoints below.
A breakpoint makes your program stop whenever a certain point in the program is reached. For each breakpoint, you can add conditions to control in finer detail whether your program stops.
A backtrace is a summary of how your program got where it is. It shows one line per frame, for many frames, starting with the currently executing frame (frame zero), followed by its caller (frame one), and on up the stack.
With the clear command you can delete breakpoints according to where they are in your program. With the delete command you can delete individual breakpoints, watchpoints, or catchpoints by specifying their breakpoint numbers.
These are third-party commands, and I don't particularly want to edit all of them.
For a specific command you can define pre hook, turning off repeating last command. This will let you to avoid editing them. For example you can define such pre hook for continue
command:
(gdb) c
The program is not being run.
(gdb)
The program is not being run.
(gdb)
The program is not being run.
(gdb)
The program is not being run.
(gdb)
The program is not being run.
(gdb) define hook-continue
Type commands for definition of "hook-continue".
End with a line saying just "end".
>dont-repeat
>end
(gdb) c
The program is not being run.
(gdb)
(gdb)
(gdb)
(gdb)
(gdb)
See hooks doc.
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