How to list all variables in the current context in gdb?

Gdb

Gdb Problem Overview


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?

Gdb Solutions


Solution 1 - Gdb

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHailiang ZhangView Question on Stackoverflow
Solution 1 - GdbTom TromeyView Answer on Stackoverflow