This is the mail archive of the gdb@sourceware.cygnus.com 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]

Re: showing function arguments


On Nov 15,  7:41pm, Dan Nicolaescu wrote:

> Stan Shebs <shebs@cygnus.com> writes:
> 
>        From: Dan Nicolaescu <dann@ics.uci.edu>
>        Lines: 19
>     
>        I would like to see all the arguments that each function is called
>        with. 
>        gdb certainly has this information, as it displays it when you look at
>        a backtrace. 
>     
>        I would like to produce a trace that contains something like this:
>        function_call1 (arg1=.., arg2=...)
>        function_call2 (arg1=.., arg2=...)
>        etc, etc
>     
>     Is this a trick question?  GDB already does this normally.  Are you
>     using a GUI that doesn't show arguments perhaps?
>     
> 								Stan
> No, no trick, sorry for being dense. 
> I am not using any GUI.
> 
> What I want is a trace of the execution of the whole program that
> contains all the function calls and their arguments, not just to see
> them when I do a "bt". 
> Is it possible to instruct gdb so produce something like that? If not,
> do you have any suggestion how I might accomplish that? 

I'm don't understand precisely what you want to do, but you should
know that it is possible to attach commands to breakpoints.  It is
also possible to define your own commands.  E.g, you could define
"btstep" which does an ordinary step followed by a backtrace as
follows:

	define btstep
	step
	bt
	end
	document btstep
	Provides a backtrace after an ordinary step.
	end

Attaching a breakpoint to a command is something that I've found to be
more useful (for my own debugging style).  It is quite easy.  After
you set the breakpoint, simply use the "command" command and then
gdb will prompt you for the commands to execute when the breakpoint
is hit.  Terminate the list of commands with the "end" keyword.  (gdb
will tell you this.)  You can attach commands to a breakpoint other
than the most recent by saying "commands N" where N is the breakpoint
number to attach commands to.

Hope this helps...

Kevin

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