This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: How to store function-name and its return values while program runs
- From: Michael Snyder <msnyder at vmware dot com>
- To: Gaius Mulley <gaius at glam dot ac dot uk>
- Cc: Sandeep222 <sandeep dot srikumar at honeywell dot com>, "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Fri, 21 Nov 2008 11:04:12 -0800
- Subject: Re: How to store function-name and its return values while program runs
- References: <20618721.post@talk.nabble.com> <87skpl1gy7.fsf@j228-gm.comp.glam.ac.uk>
Gaius Mulley wrote:
Sandeep222 <sandeep.srikumar@honeywell.com> writes:
As we proceed with debugging a program, if I need to know the order of
functions being executed by printing on screen along with their return
values when a 'run' command or 'next' command is executed, how can i
proceed? I went thru frame.c but all the function seem to execute only when
a command is executed in the gdb. Plz help.
Reg,
Sandeep
set a breakpoint at each of the functions of interest.
(gdb) break function1
(gdb) break function2
etc
now run the program
(gdb) run
when gdb hits a breakpoint you can finish the function and
print the result via:
(gdb) fin
And indeed, you can make that automatic by attaching the
commands to the breakpoints:
(gdb) break function1
(gdb) commands
> finish
> continue
> end
(gdb)