Connecting Tech Pros Worldwide Help | Site Map

print all the functions invoked in a C program

  #1  
Old October 31st, 2007, 02:05 PM
call_me_anything
Guest
 
Posts: n/a
How do I get a log of all the functions invoked in a huge C program ?
Does GDB (or ddd) have any such option ?
I mean the simplest possible scenario (please do not go for non-
debuggable object files or other such stuff)

This is required to compare the behaviour of two options which modify
two global variables and the
program runs differently for the two cases but this is not expected.
So we want to get a diff of the "functions invoked logs" in the two
cases.

  #2  
Old October 31st, 2007, 02:45 PM
Victor Bazarov
Guest
 
Posts: n/a

re: print all the functions invoked in a C program


call_me_anything wrote:
Quote:
How do I get a log of all the functions invoked in a huge C program ?
The tool to use is "a profiler".
Quote:
Does GDB (or ddd) have any such option ?
You need to ask in the newsgroup that deals with GDB or ddd. I would
think that 'gprof' is what you need.
Quote:
I mean the simplest possible scenario (please do not go for non-
debuggable object files or other such stuff)
Huh?
Quote:
[..]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


  #3  
Old October 31st, 2007, 03:05 PM
call_me_anything
Guest
 
Posts: n/a

re: print all the functions invoked in a C program


Shouldn't GDB have such an option ?
I mean all it needs to do is print the function name when it is about
to evaluate any function name.

  #4  
Old October 31st, 2007, 03:05 PM
Victor Bazarov
Guest
 
Posts: n/a

re: print all the functions invoked in a C program


call_me_anything wrote:
Quote:
Shouldn't GDB have such an option ?
I mean all it needs to do is print the function name when it is about
to evaluate any function name.
Please ask in the newsgroup where GDB is on topic. Like in 'gnu.*'
hierarchy.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


  #5  
Old October 31st, 2007, 06:05 PM
Sherman Pendley
Guest
 
Posts: n/a

re: print all the functions invoked in a C program


call_me_anything <sgiitnewid@gmail.comwrites:
Quote:
Shouldn't GDB have such an option ?
GDB is a debugger, not a profiler. GProf is the GNU profiler.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
  #6  
Old October 31st, 2007, 06:55 PM
Laurent D.A.M. MENTEN
Guest
 
Posts: n/a

re: print all the functions invoked in a C program


If you have access to the source code and are able to recompile it, you
may use the "-finstrument-functions" option of GCC, you may also have a
look there: http://freshmeat.net/projects/etrace/ for a ready-to-use
tool that prints the call tree of an execution.

call_me_anything a écrit :
Quote:
How do I get a log of all the functions invoked in a huge C program ?
Does GDB (or ddd) have any such option ?
I mean the simplest possible scenario (please do not go for non-
debuggable object files or other such stuff)
>
This is required to compare the behaviour of two options which modify
two global variables and the
program runs differently for the two cases but this is not expected.
So we want to get a diff of the "functions invoked logs" in the two
cases.
>
  #7  
Old October 31st, 2007, 09:45 PM
call_me_anything
Guest
 
Posts: n/a

re: print all the functions invoked in a C program


Shouldn't GDB have such an option ?
I mean all it needs to do is print the function name when it is about
to evaluate any function name.

  #8  
Old October 31st, 2007, 10:55 PM
=?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=
Guest
 
Posts: n/a

re: print all the functions invoked in a C program


On 2007-10-31 21:37, call_me_anything wrote:
Quote:
Shouldn't GDB have such an option ?
I mean all it needs to do is print the function name when it is about
to evaluate any function name.
1) Please quote the text you are replying to.

2) Posting the same question twice generally does not give you a better
answer, but it can annoy some people reducing the chances of getting an
answer.

3) Questions about gdb should be asked in a group discussing gbd.

An finally, yes you can probably make gdb print the names of functions
as you enter them with some fancy scripting or such (see 3. above
though). However profilers also do that and they are designed to do it
so it would be better to use one (and no profilers are not discussed in
here).

--
Erik Wikström
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
2D-array of pointers, set all to null? WP answers 12 July 15th, 2008 09:35 AM
How to replace a method in an instance. Steven W. Orr answers 10 August 24th, 2007 08:45 PM
Using C++ in C#, best suggestion in this situation? Andrew S. Giles answers 5 November 16th, 2005 03:03 PM
Best Way to Print Nature of Signal Martin McCormick answers 3 November 13th, 2005 09:33 PM