11

If I break in line 3:

1  int foo()
2  {
3      return func();
4  }

is there a way to examine the return value of func()?

Thanks.

jackhab
  • 17,128
  • 37
  • 99
  • 136

4 Answers4

19

Use the finish command.

David Schmitt
  • 58,259
  • 26
  • 121
  • 165
3

If you step into "func()", and then say "finish", gdb will return to foo and print the return value of func.

Michael Snyder
  • 5,519
  • 4
  • 28
  • 19
3

After line three the return value will be in EAX, so you can

print $eax

Hope this helps

Jake
  • 3,427
  • 2
  • 28
  • 23
2

I answered a simular question here, info frame is a platform independent way todo this.

Community
  • 1
  • 1
RandomNickName42
  • 5,923
  • 1
  • 36
  • 35