-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This tool can be used to trace all the cairo function calls made by an applications. This is useful for either extracting a test case triggering a bug from an application, or simply to get a general idea of how an application is using cairo. After make install, cairo-trace program arguments, will print out all the cairo calls to the terminal and also capture theme in ./program.$pid.trace The format of the output is CairoScript, watch this space for more cairo-script tools!
- Loading branch information
Chris Wilson
committed
Oct 31, 2008
1 parent
992f74d
commit c554f18
Showing
9 changed files
with
3,763 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
bin_SCRIPTS = cairo-trace | ||
lib_LTLIBRARIES = cairo-trace.la | ||
|
||
AM_CPPFLAGS = -I$(top_srcdir)/src \ | ||
-I$(top_builddir)/src | ||
|
||
cairo_trace_la_SOURCES = \ | ||
lookup-symbol.c \ | ||
lookup-symbol.h \ | ||
trace.c | ||
cairo_trace_la_CFLAGS = @FREETYPE_CFLAGS@ @CAIRO_CFLAGS@ | ||
cairo_trace_la_LDFLAGS = -module -no-undefined | ||
cairo_trace_la_LIBADD = -ldl -lz -lbfd | ||
|
||
system-install: | ||
grep -sq @libdir@/cairo-trace.so /etc/ld.so.preload || echo @libdir@/cairo-trace.so >> /etc/ld.so.preload | ||
|
||
system-uninstall: | ||
sed -e '/\/usr\/local\/lib\/cairo-trace.so/d' < /etc/ld.so.preload > /tmp/ld.so.preload && mv /tmp/ld.so.preload /etc/ld.so.preload; | ||
|
||
EXTRA_DIST = cairo-trace.in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/sh | ||
|
||
prefix=@prefix@ | ||
exec_prefix=@exec_prefix@ | ||
|
||
nofile= | ||
silent= | ||
|
||
skip=1 | ||
while test $skip -eq 1; do | ||
skip=0 | ||
case $1 in | ||
--silent) | ||
skip=1 | ||
silent=1 | ||
;; | ||
--no-file) | ||
skip=1 | ||
nofile=1 | ||
;; | ||
esac | ||
if test $skip -eq 1; then | ||
shift | ||
fi | ||
done | ||
|
||
if test $# -eq 0; then | ||
cat << EOF | ||
usage: cairo-trace [--no-file|--silent] command | ||
cairo-trace will generate a log of all calls made by command to | ||
cairo. This log will be stored in a file in the local directory | ||
called command.pid.trace. | ||
Whatever else happens is driven by its argument: | ||
--silent - disables the overriding of stdout by cairo-trace. | ||
The trace file is still generated, but your application | ||
is free to continue to use stdout. | ||
--no-file - disables the generation of an output file | ||
Enviroment variables understood by cairo-trace: | ||
CAIRO_TRACE_FLUSH - flush the output after every function call. | ||
EOF | ||
exit | ||
fi | ||
|
||
#echo $* | ||
|
||
filename="" | ||
if test -z "$nofile"; then | ||
filename=`basename $1`.$$.trace | ||
fi | ||
|
||
if test -z "$filename"; then | ||
LD_PRELOAD=@libdir@/cairo-trace.so CAIRO_TRACE_FD=3 LC_ALL=C $* 3>&1 >/dev/null | ||
elif test -n "$silent"; then | ||
LD_PRELOAD=@libdir@/cairo-trace.so LC_ALL=C CAIRO_TRACE_OUTFILE_EXACT=$filename $* | ||
else | ||
LD_PRELOAD=@libdir@/cairo-trace.so CAIRO_TRACE_FD=3 LC_ALL=C $* 3>&1 >/dev/null | tee $filename | ||
fi |
Oops, something went wrong.