Get the char* value with python gdb

132 Views Asked by At

With GDB and Python I tried to get the char* value on x1 register

python
a= gdb.execute("x/s $x1", to_string=True)
print(a)
end

But I got 0xbb4aaa: "SomeString"

I want to get only the SomeString without the address

How can I do that directly with python GDB (without regex/split)

1

There are 1 best solutions below

0
PythonNewbe On

I had the exact same problem and was super annoyed by the output of the address. Using the method .string() worked for me:

print(a.string())