This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug python/11036] Python: provide access to "hidden" variables
- From: "pmuldoon at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 19 Jan 2010 14:16:31 -0000
- Subject: [Bug python/11036] Python: provide access to "hidden" variables
- References: <20091130173341.11036.andre.poenitz@nokia.com>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From pmuldoon at redhat dot com 2010-01-19 14:16 -------
I chatted with andre on irc and we came up with this reproducer:
simple.c ----------
#include <stdio.h>
int main()
{
int i = 0;
{
double i = 1.0;
double f = 2.0;
{
const char *i = "stuff";
const char *f = "foo";
const char *b = "bar";
printf ("break");
}
}
return 0;
}
symbol.py -----------------
frame = gdb.selected_frame()
block = frame.block()
count = 0
while True:
if block is None:
warn("UNEXPECTED 'None' BLOCK")
break
print "Block: ", count
for symbol in block:
name = symbol.print_name
try:
item = frame.read_var(name)
except RuntimeError:
continue
print name," (",item.type,") =",item
if not block.function is None:
break
block = block.superblock
count = count + 1
GDB output:
./gdb ./simple -ex 'b 13' -ex 'run' -ex 'python execfile("./symbol.py")'
Breakpoint 1 at 0x400507: file ../../frame/simple.c, line 13.
Breakpoint 1, main () at ../../frame/simple.c:13
13 printf ("break");
Block: 0
i ( const char * ) = 0x400618 "stuff"
f ( const char * ) = 0x40061e "foo"
b ( const char * ) = 0x400622 "bar"
Block: 1
i ( const char * ) = 0x400618 "stuff"
f ( const char * ) = 0x40061e "foo"
Block: 2
i ( const char * ) = 0x400618 "stuff"
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
http://sourceware.org/bugzilla/show_bug.cgi?id=11036
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.