Is there are simple tool, which can be used to determine from where a function is called, which other function the function calls ...?
Edit: I'm using Mac OS X (10.6) and just want to do static analysis.
Thanks!
gtags is a tool you can use for doing tagging, but for call tracing as well.
http://www.gnu.org/software/global/
This supports C, C++, Yacc, Java and PHP4. But it can't handle C++ templates or other complex stuffs properly.
Using this tagging parser, I've made a script to get a call tree from
user's selection through bash completion like the following,
which is displaying a calltree in google profiler code:
% global-calltree -x prof_handler Add Evict ProfileData Stop DisableHandler RAW_CHECK WRITE_TO_STDERR
prof_handler:414 => Add:441 |profiler.cc |instance_.collector_.Add(depth, stack);
Add:241 => Evict:290 |profiledata.cc |Evict(*e);
Evict:61 => ProfileData:75 |profiledata.cc |ProfileData::ProfileData()
ProfileData:124 => Stop:125 |profiledata.cc |Stop();
Stop:261 => DisableHandler:273 |profiler.cc |DisableHandler();
DisableHandler:400 => RAW_CHECK:405 |profiler.cc |RAW_CHECK(sigaction(SIGPROF, &sa, NULL) == 0, "sigaction failed");
RAW_CHECK:83 => WRITE_TO_STDERR:86 |base/logging.h |WRITE_TO_STDERR("Check failed: " #condition ": " message "\n", \
WRITE_TO_STDERR:59 => DECLARE_int32:65 |base/logging.h |DECLARE_int32(verbose);
How about cscope? Check out 3rd & 4th bullet items on the page:
It's been a while since I used cscope on C++, I seem to remember it being rock-solid on C code, but not as strong with C++.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With