c - GDB : how can I get the name of all local variables? -


is there way in gdb name of local variables ? know

info local

prints names , values of local variables, automatically compare value of locals @ several points of execution of function (and there huge number of local variables in function, doing manually 1 one tedious ...)

thanks !

it sounds want way compare locals @ 2 points in time. there couple of ways this.

one low-tech way dump variables info locals. can dump them file using set logging facility, , can automate setting breakpoint commands logging, dumping, disable logging, , end continue.

in approach write separate script compare results.

another approach use gdb's python scripting facility. it's easy local variables here: selected frame gdb.selected_frame(); frame's block (frame.block()); iterate on locals of block block's variables, , walk blocks (see gdb.block.superblock) until reach function boundary.

you can either evaluate or ignore symbols find (if, say, want compare subset). and, can decide how want compare values collect.

in approach work done in gdb, without separate comparison script.


Comments