This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug python/11482] Side effect of set print address on python API
- From: "pmuldoon at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 14 Apr 2010 17:05:02 -0000
- Subject: [Bug python/11482] Side effect of set print address on python API
- References: <20100409172931.11482.michel.metzger@st.com>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From pmuldoon at redhat dot com 2010-04-14 17:05 -------
argv needs to be dereferenced:
(gdb) ptype argv
type = char **
(gdb) set print address off
(gdb) python print gdb.selected_frame().read_var("argv").dereference()
"/home/pmuldoon/simple"
The length you were seeing was the textual length of the address before
dereferencing:
(gdb) set print address on
(gdb) python print gdb.selected_frame().read_var("argv")
0x7fffffffe1a8
(gdb) python print len(str(gdb.selected_frame().read_var("argv")))
14
The address is printed as part of the Value's Python str() method. This is
because argv is a pointer to a pointer. Does this conform with your view?
--
http://sourceware.org/bugzilla/show_bug.cgi?id=11482
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.