gdbgdbinit

Get return from gdb exec


In .gdbinit I call to function

call open("tmp/test",1)

Then I got return value

$15 = 1

I want to use $15 to the next operation.

How can I got this var to the .gdbinit next line ?


Solution

  • You can simply assign the return value to a variable with a name of your choosing:

    (gdb) call $ret = open("tmp/test", 1)
    (gdb) print $ret
    -1