Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

gdb

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?

like image 779
Hailiang Zhang Avatar asked Jun 03 '13 06:06

Hailiang Zhang


People also ask

What does @entry mean in GDB?

The @entry form refers to the value of the parameter when the function was entered. This isn't always available, but sometimes it is -- there is a DWARF extension for it, and GCC emits this when possible. There's some information here: https://sourceware.org/gdb/onlinedocs/gdb/Variables.html.

What does print do in GDB?

The usual way to examine data in your program is with the print command (abbreviated p ), or its synonym inspect . It evaluates and prints the value of an expression of the language your program is written in (see section Using GDB with Different Languages).

How do I list breakpoints in GDB?

You can see these breakpoints with the GDB maintenance command `maint info breakpoints' . Using the same format as `info breakpoints' , display both the breakpoints you've set explicitly, and those GDB is using for internal purposes. Internal breakpoints are shown with negative breakpoint numbers.


1 Answers

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.

like image 120
Tom Tromey Avatar answered Sep 19 '22 15:09

Tom Tromey