[RFC] Strings and arrays without malloc

Tom Tromey tromey@redhat.com
Thu Mar 13 06:12:00 GMT 2008


Tom> In the end I think it would be preferable to just use Python for all
Tom> this stuff.  That way all the access code only needs to be done once.
Tom> IMO the $(...) syntax should simply eval the contents as a Python
Tom> expression.

Tonight I grabbed Volodya's branch and reworked the convenience
function patch to use python for everything.  I also added a couple
convenience functions for python -- one to access set/show variables,
and one to run any gdb command (maybe the latter should be done via
the MI interpreter?  I'm using the CLI).  (Note that the set/show
thing means that code like the "info args" thing we were discussing
recently needs to be cleaned up to work properly.)

This all works great.  I'm not completely happy about the extra syntax
(python requires more quoting and parentheses than we would with a
completely custom-for-gdb language), but I think I'll just end up
defining a bunch of helper code in python to make the user command
lines short.

I guess the next step to getting something actually useful is to
expose selected parts of gdb internals to python.  First I'm thinking
frame information... my current thinking is that the general approach
should be to write a thin binding, and then add a nicer OO API in pure
python.  I'm not a python person though, so maybe this is weird.

Opinions, advice, encouragement, etc ... all welcome.  At times I
suspect that nobody is reading this.

Tom



More information about the Gdb-patches mailing list