A simple tool for callgraph in C ++

Is there a simple tool that can be used to determine where the function is called from, what other function the function calls ...?

Change . I am using Mac OS X (10.6) and just want to do a static analysis.

Thanks!

+5
source share
4 answers

What about cscope ? Complete bullet points 3 and 4 on the page:

  • functions called by function
  • functions calling the function

It has been a while since I used cscope in C ++, I seem to remember that it is robust in C code, but not as strong with C ++.

+4
source

gtags - , , .

http://www.gnu.org/software/global/

C, ++, Yacc, Java PHP4. ++ .

-, script,
bash , ,
calltree google:

% 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);
+6

, , codeviz ( , ). : , - .

+1

Since you are using mac os, clang is a new compiler with a static analysis function.

YouTube example: Searching for errors with clang

0
source

All Articles