Reputation: 61
How do I print the local variables in GDB every "next" or "step" command?
Is there a way instead of writing "info locals" every time?
Upvotes: 6
Views: 8671
Reputation: 213897
If you can use GDB TUI mode, that's probably best. See this answer.
If you can't use TUI for some reason, this should also work:
# put this into ~/.gdbinit:
define hook-next
info locals
end
More info on hooking commands here.
Upvotes: 5