This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/11482] Side effect of set print address on python API


------- 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]