gdb python how to output integer for examine memory

dieter dieter at handshake.de
Wed Mar 26 03:10:23 EDT 2014


Wesley <nispray at gmail.com> writes:
> ...
> Actually, I can now see the varialbe names at Python level and C level.
> I just want to verify x command to monitor the memory content.
> So, in my origin post, I can get variable i's address, and see the value is 1,
> then, I wanna have a try x command, the issue is, when use x/format i's address, the output is not 1, but other things:-(

All Python objects start (at C level) with a header (containing
the reference count, a pointer to the associated type and
maybe other things); the "real" value starts behind this header.

This means, to see the "1" in your example, you must skip the
associated object header -- either in the output or by adding
the size of the header to the initial address.




More information about the Python-list mailing list