Author Topic: GDB inspecting a return value  (Read 3908 times)

Offline Manolo

  • Multiple posting newcomer
  • *
  • Posts: 47
GDB inspecting a return value
« on: February 20, 2015, 12:39:25 am »
Whenever I have a function that returns a value that is not previously assigned to a var, if I want to know that return value I have to send the command finish to GDB and search for "Value returned is $1 = true" or similar. The search is hard (many many lines)

Can this returned value part of the watches window?


Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5371
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: GDB inspecting a return value
« Reply #1 on: February 20, 2015, 04:40:43 am »
By reading this:
I see that "finish" is the only command to get the return value. So, maybe, we need to parse the returned text from GDB after we type/send "finish" command.

If we use gdb MI
we can also get a returned value.
« Last Edit: February 20, 2015, 04:42:52 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: GDB inspecting a return value
« Reply #2 on: February 20, 2015, 09:51:21 am »
I don't think this could be implemented reliably.
Because if you never execute the finish/-exec-finish commands, then you won't see any return value ever.
If you execute another command like step you'll loose the return value.

Please post a feature request on the project page. Here it will get lost.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]