print all the functions invoked in a C program

C

call_me_anything

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.
 
V

Victor Bazarov

call_me_anything said:
How do I get a log of all the functions invoked in a huge C program ?

The tool to use is "a profiler".
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.
I mean the simplest possible scenario (please do not go for non-
debuggable object files or other such stuff)
Huh?

[..]

V
 
C

call_me_anything

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.
 
V

Victor Bazarov

call_me_anything said:
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
 
L

Laurent D.A.M. MENTEN

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 :
 
C

call_me_anything

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.
 
G

Guest

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,197
Messages
2,571,040
Members
47,635
Latest member
SkyePurves

Latest Threads

Top