How to get a sequence of bytes with python?

S Boucher stbya@yahoo.com
Wed Oct 5 20:08:00 GMT 2011


I get gdb.Value that is a pointer, and want to read 16 bytes and store this in a python string.

gdb.Value's string() doesn't seem to have a way to interpret memory as raw bytes.

Alternatively, accessing memory via gdb.Inferior seems problematic in that:

1) I don't see a way to programatically get the relevant/current gdb.Inferior using gdb.inferiors()

2) read_memory() will require me to iterate and convert explicitly to a real python string (ok, this is only a minor annoyance)

Any suggestion on how I could go about doing this?

I'm with gdb 7.3.1

Thanks,



More information about the Gdb mailing list