This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug python/11915] New: API for casting pointer to array[length]
- From: "joachim dot protze at zih dot tu-dresden dot de" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 13 Aug 2010 23:02:47 -0000
- Subject: [Bug python/11915] New: API for casting pointer to array[length]
- Reply-to: sourceware-bugzilla at sourceware dot org
It would be nice, to have a python api mechanism to print a pointer as array of
specific length.
(gdb) python print gdb.parse_and_eval("(int[3]*)buf").type
int (*)[3]
(gdb) python print gdb.parse_and_eval("(int[3]*)buf").dereference()
{0, 1, 2}
It is possible to cast the pointer to array with the python cast function:
(gdb) python print gdb.parse_and_eval("buf").cast(gdb.parse_and_eval("(int[3]*)
buf").type).type
int (*)[3]
The pointer is successfully printed as array[length]:
(gdb) python print gdb.parse_and_eval("buf").cast(gdb.parse_and_eval("(int[3]*)
buf").type).dereference()
{0, 1, 2}
But there is no way to create the array type with python like:
gdb.lookup_type("int").array(3).pointer()
or:
gdb.lookup_type("int[3]").pointer()
--
Summary: API for casting pointer to array[length]
Product: gdb
Version: 7.2
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: python
AssignedTo: unassigned at sourceware dot org
ReportedBy: joachim dot protze at zih dot tu-dresden dot de
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=11915
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.