Reading memory from inferior at given pointer

Tom Tromey
Tue Apr 23 18:27:00 GMT 2013

>>>>> ">" == Weller  <> writes:

>> Which allows me to read the long and double values just fine. But my
>> hurdle is reading the char *. Which no matter which function I try
>> always results in a bad address from which I can't read the correct
>> string. I tried different functions mentioned in 9.3 of "GDB Internal"
>> and also looked around in different language implementations. But I am
>> clearly doing something wrong here.

>> Which would be the correct way to read from this memory area from the
>> inferior process? Any help would be appreciated.

Are you trying to see the value of the pointer, or the pointed-to

To get the pointer I would use the various "value" APIs (see
gdb/value.h) to extract the field from the value returned by

For the characters, you can use read_string.


More information about the Gdb mailing list