public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/9830] New: Add a way to show what the last function call returned
@ 2009-02-09 16:33 spamfaenger at gmx dot de
  2009-02-09 16:42 ` [Bug gdb/9830] " drow at sources dot redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: spamfaenger at gmx dot de @ 2009-02-09 16:33 UTC (permalink / raw)
  To: gdb-prs

Hi there,

I frequently find myself in the position that I'd like to check what the last function called did return. (For 
example while stepping through nested function calls, or just after stepping over a return statement 
(C/C++/Objc).

This is generally not possible in GDB (from what I understand from the docs and from the ever helpfull 
#gdb chaannel)

I can aproximate some of this by trying print $eax and try to remember what the heck the right register 
is on a different plattform and also hope that struct returns aren't handled differently.

But, that really doesn't work very good.

So what I'd really want is something like 

print $return_value
or 
info return-value

(Whatever best suits the purpose, I haven't quite understood all the finer details of these commands)

Somebody on #gdb mentioned that this is not generally possible before the return has actually 
happened - but after it did, that sure is possible (and commands like "finish" already do it to some 
degree).

So, please do it. :)

Greetings, Martin

-- 
           Summary: Add a way to show what the last function call returned
           Product: gdb
           Version: 6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: spamfaenger at gmx dot de
                CC: gdb-prs at sourceware dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=9830

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug gdb/9830] Add a way to show what the last function call returned
  2009-02-09 16:33 [Bug gdb/9830] New: Add a way to show what the last function call returned spamfaenger at gmx dot de
@ 2009-02-09 16:42 ` drow at sources dot redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: drow at sources dot redhat dot com @ 2009-02-09 16:42 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From drow at sources dot redhat dot com  2009-02-09 16:42 -------
To clarify, it will only work on the instruction immediately after a return.  If
you use 'finish', it would work - but so does "print $".  If you use 'return' it
would work, but there you provided the return value.  If you 'stepi' out of the
function, then you'll be in the right place; if you 'step' out of the function
then the calling statement will finish, after which the return value might be
anywhere.

Also, GDB has no way to figure out what function returned, so it won't know the
type of the return value.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=9830

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-09 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-09 16:33 [Bug gdb/9830] New: Add a way to show what the last function call returned spamfaenger at gmx dot de
2009-02-09 16:42 ` [Bug gdb/9830] " drow at sources dot redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).