Python API questions and use cases

Joel Borggrén-Franck joel.borggren.franck@gmail.com
Thu Sep 16 11:56:00 GMT 2010


On Thu, Sep 16, 2010 at 11:48 AM, André Pönitz <andre.poenitz@nokia.com> wrote:
> On Thursday 16 September 2010 09:32:31 ext Joel Borggrén-Franck wrote:
>> > I think the tricky part is getting a Value holding the appropriate
>> > constant.  For that you might not have anything better, at present, than
>> > parse_and_eval.
>>
>> True. Then I think this would be useful:
>>
>> gdb.new_address(addr) - returns a new gdb.Value (of type (void *)) pointing
>> to addr. addr is checked to be within bounds of the address space of the
>> inferior upon creation.
>
>
> gdb.Value(addr).cast(gdb.lookup_type('void').pointer()) should do the trick.
>

This might be a case of missing (or obscure) documentation. Is there a
place (other than the C impl.) where I can find documentation for the
constructors/inits for the different gdb.XYZ types?

With your example I can turn a string into an address without escaping to
gdb-script. That is good enough for me, I can just roll my own helpers on
top of that (which is the primary benefit of using Python imho).

Cheers
/Joel



More information about the Gdb mailing list