Connecting Tech Pros Worldwide Help | Site Map

print all the functions invoked in a C program

 
LinkBack Thread Tools Search this Thread
  #1  
Old October 31st, 2007, 01:05 PM
call_me_anything
Guest
 
Posts: n/a
Default print all the functions invoked in a C program

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, 01:45 PM
Victor Bazarov
Guest
 
Posts: n/a
Default 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, 02:05 PM
call_me_anything
Guest
 
Posts: n/a
Default 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, 02:05 PM
Victor Bazarov
Guest
 
Posts: n/a
Default 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, 05:05 PM
Sherman Pendley
Guest
 
Posts: n/a
Default 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, 05:55 PM
Laurent D.A.M. MENTEN
Guest
 
Posts: n/a
Default 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, 08:45 PM
call_me_anything
Guest
 
Posts: n/a
Default 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, 09:55 PM
=?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.