commit 9860888f568e593da2f67c6db00c0d8c01e785de parent b77fcc211f1305a837ec7ed8423d3cfef8a696fe Author: lostd <lostd@2f30.org> Date: Thu, 14 Nov 2013 21:47:49 +0200 Drop LD_PRELOAD, link directly with -lcallgraph Diffstat:
M | README | | | 18 | +++++++++++------- |
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/README b/README @@ -1,22 +1,26 @@ Runtime callgraph generator =========================== -First type make to create callgraph.so. +First type make to create libcallgraph.so. To generate a runtime callgraph of any program, compile it by adding the --finstrument-functions flag in CFLAGS. +-finstrument-functions flag and linking against libcallgraph.so. For +example, modify its Makefile to include: - ./configure # if needed - . # other crap - make CFLAGS+=-finstrument-functions + CFLAGS += -finstrument-functions + LDFLAGS += -L${PWD} + LDLIBS += -lcallgraph + + make Set the environment variable CGRAPH_OUT to the name of the .dot file. export CGRAPH_OUT=callgraph.dot -At this point you can use LD_PRELOAD to create the callgraph of the program. +At this point you just run the program taking care for the library file +to be in the library path. - LD_PRELOAD=./callgraph.so ./prog [ARGS] + LD_LIBRARY_PATH=$PWD ./prog [ARGS] Once the program terminates, you have to feed it to the symbolizer.