This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Some Python bugs
- From: Daniel Jacobowitz <drow at false dot org>
- To: archer at sourceware dot org
- Date: Tue, 13 Oct 2009 15:16:23 -0400
- Subject: Some Python bugs
I recently wrote a Python script to search through debug info and
generate some XML data I needed. Here's a few issues I noticed
(from memory, please excuse typos):
* The Python bindings do not expose array bounds. I had to use sizeof
to determine the size and assume the array was zero-indexed (which is
C-specific).
* Calling type.fields on an array type crashes. It accesses
TYPE_N_BASECLASSES; cplus_stuff isn't allocated for non-structs.
* The archer branch calls PyGILState_Ensure in several places where it
should call ensure_python_env. So python_language was often unset if
I tried 'gdb -ex "source -p file.py"'. To work around it, I had the
end of file.py register a new gdb.Command, and called the command.
* There's no way to get at macro definitions (e.g. info macro). Also,
GDB doesn't offer a list of all macros defined... I had to use
"complete print " and pass them all to info macro.
* It would be really useful to temporarily redirect GDB output to a
memory buffer, i.e. a version of gdb.execute that captured the
command's output. Especially where there aren't specific Python
bindings for what I wanted.
--
Daniel Jacobowitz
CodeSourcery