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/17728] gdb.LazyString is confused by typedefs


https://sourceware.org/bugzilla/show_bug.cgi?id=17728

--- Comment #1 from Jonathan Wakely <jwakely.gcc at gmail dot com> ---
This seems odd:

(gdb) python print StrPrinter(gdb.parse_and_eval('foo')).to_string().type
const char
(gdb) python print StrPrinter(gdb.parse_and_eval('bar')).to_string().type
Bar::pointer

https://sourceware.org/gdb/onlinedocs/gdb/Lazy-Strings-In-Python.html says type
"will always be a pointer type" but the lazy string for foo is not a pointer.
The lazy string for bar is a typedef for a pointer, but doesn't work correctly.

Also odd:

(gdb) python print StrPrinter(gdb.parse_and_eval('foo')).to_string().value()
102 'f'
(gdb) python print StrPrinter(gdb.parse_and_eval('bar')).to_string().value()
0x4006b4 "bar"

The LazyString.value() method shows the right thing for bar, but not for foo
(which is at least consistent with the .type attribute which says that foo's
type is just a char not a char*)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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