This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to store function-name and its return values while program runs


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]