57

In gdb, after reaching a breakpoint, I want to list all the variables in the current context, instead of giving each variable name explicitly? Is there any way to achieve this at all?

Hailiang Zhang
  • 17,604
  • 23
  • 71
  • 117
  • 1
    I don't think there is single command, but this should be close enough: http://stackoverflow.com/questions/6261392/in-gdb-how-can-i-print-all-global-variables-local-variables – dbrank0 Jun 03 '13 at 07:15

1 Answers1

99

You want info locals. Or, if you are getting a back trace, bt full.

You can attach info locals to a breakpoint with the commands command.

spoulson
  • 21,335
  • 15
  • 77
  • 102
Tom Tromey
  • 21,507
  • 2
  • 45
  • 63