This is the mail archive of the mailing list for the Archer 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]

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

* 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"'.  To work around it, I had the
end of 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

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