Re: repo to work on python scripting support

Paul Koning
2008-03-25T19:31:46Z

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> The basic problem is that we have a syntax for embedding a
Tom> python call in an expression that looks like $(stuff).

Tom> Now, internally to gdb, "stuff" is just a string. But, most of
Tom> the time, the implementation of this function, whatever it is,
Tom> won't want just a string -- it will want an expression, or a
Tom> file name, or something.

Tom> So, what Jim and Daniel want, I think, is a declarative way for
Tom> the Python code (which implements the given function) to tell
Tom> gdb's core how to parse this string.

Something akin to the way that C extension modules inside Python tell
the Python execution machinery what data type it wants might serve.

The notion of asking for a particular type is a bit foreign to Python;
arguments have no fixed type.

Another possibility is to pass strings but then have standard
conversion routines (things callable by Python and supplied by gdb).
For example parse_and_eval_address. And the target functions. And so
on.

def walklist (head):
addr = parse_and_eval_address (head)
while addr:
print "list item at", addr
addr = target_read_memory (addr, 4)

paul