public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* how to print a function's return value
@ 2012-07-11 15:10 Tom Frank
  2012-07-11 21:49 ` Doug Evans
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Frank @ 2012-07-11 15:10 UTC (permalink / raw)
  To: gdb

hi,

in source code , there is a fuction call like this :  int a = func(param);

then I debug it with gdb , whein it stop at this line,I want to print
the func's retvalue, which results  in a gdb sigtrap,and

cause gdb to go into a trap,  then I can not find where am I .

I konw there is a command to prevent gdb going to trap  like  this,
what is  that command?

thanks!

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

* Re: how to print a function's return value
  2012-07-11 15:10 how to print a function's return value Tom Frank
@ 2012-07-11 21:49 ` Doug Evans
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Evans @ 2012-07-11 21:49 UTC (permalink / raw)
  To: Tom Frank; +Cc: gdb

On Wed, Jul 11, 2012 at 8:10 AM, Tom Frank <gdbhelper@gmail.com> wrote:
> hi,
>
> in source code , there is a fuction call like this :  int a = func(param);
>
> then I debug it with gdb , whein it stop at this line,I want to print
> the func's retvalue, which results  in a gdb sigtrap,and
>
> cause gdb to go into a trap,  then I can not find where am I .
>
> I konw there is a command to prevent gdb going to trap  like  this,
> what is  that command?

Hi.
Your question is a bit confusing.
If I were to set the sigtrap aside, there are two ways to print func's
return value.

#1
(gdb) print func(param)

IOW call func from gdb.  Depending on what func does this may or may
not be reasonable.

The second way is to either set a breakpoint on func or step into into
and then step out of it like this:

#2
(gdb) step   # step into func
(gdb) finish   # run until func returns, gdb will print its return value


Now, as for sigtrap, I think in order to provide an accurate answer I
need more details.  An example session log for example.

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

end of thread, other threads:[~2012-07-11 21:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11 15:10 how to print a function's return value Tom Frank
2012-07-11 21:49 ` Doug Evans

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).