callgraph

runtime callgraph generator
git clone git://git.2f30.org/callgraph
Log | Files | Refs | README | LICENSE

README (910B)


      1 Runtime callgraph generator
      2 ===========================
      3 
      4 First type make to create libcallgraph.so.
      5 
      6 To generate a runtime callgraph of any program, compile it by adding the
      7 -finstrument-functions flag and linking against libcallgraph.so.  For
      8 example, modify its Makefile to include:
      9 
     10 	CFLAGS += -finstrument-functions
     11 	LDFLAGS += -L${PWD}
     12 	LDLIBS += -lcallgraph
     13 
     14 	make
     15 
     16 At this point you just run the program taking care for the library file
     17 to be in the library path.
     18 
     19 	LD_LIBRARY_PATH=$PWD ./prog [ARGS]
     20 
     21 This generates a callgraph.dot file by default.  If you want another
     22 output filename just set the CGRAPH_OUT environment variable.
     23 
     24 	CGRAPH_OUT=prog.dot
     25 
     26 Once the program terminates, you may want to replace addresses in the
     27 generated .dot file with function names, using the symbolizer.
     28 
     29 	./symbolize.sh ./prog
     30 
     31 Generate a jpeg of the callgraph.
     32 
     33 	dot -Tjpg callgraph.dot -o callgraph.jpg
     34 
     35 That's it!