6

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?

1

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.