diff options
author | sanine <sanine.not@pm.me> | 2022-10-12 12:03:23 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-10-12 12:03:23 -0500 |
commit | 530ffd0b7d3c39757b20f00716e486b5caf89aff (patch) | |
tree | 76b35fdf57317038acf6b828871f6ae25fce2ebe /libs/cairo-1.16.0/util/cairo-trace/cairo-trace.in | |
parent | 3dbe9332e47c143a237db12440f134caebd1cfbe (diff) |
add cairo
Diffstat (limited to 'libs/cairo-1.16.0/util/cairo-trace/cairo-trace.in')
-rw-r--r-- | libs/cairo-1.16.0/util/cairo-trace/cairo-trace.in | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/libs/cairo-1.16.0/util/cairo-trace/cairo-trace.in b/libs/cairo-1.16.0/util/cairo-trace/cairo-trace.in new file mode 100644 index 0000000..ece90d3 --- /dev/null +++ b/libs/cairo-1.16.0/util/cairo-trace/cairo-trace.in @@ -0,0 +1,136 @@ +#!/bin/sh + +prefix=@prefix@ +exec_prefix=@exec_prefix@ + +nofile= +flush= +nocallers= +nomarkdirty= +compress= + +usage() { +cat << EOF +usage: cairo-trace [--no-file] 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: + --flush - Flush the output trace after every call. + --no-file - Disable the creation of an output file. Outputs to the + terminal instead. + --no-callers - Do not lookup the caller address/symbol/line whilst tracing. + --mark-dirty - Record image data for cairo_mark_dirty() [default] + --no-mark-dirty - Do not record image data for cairo_mark_dirty() + --compress - Compress the output with LZMA + --profile - Combine --no-callers and --no-mark-dirty and --compress + +Environment variables understood by cairo-trace: + CAIRO_TRACE_FLUSH - flush the output after every function call. + CAIRO_TRACE_LINE_INFO - emit line information for most function calls. +EOF +exit +} + +skip=1 +while test $skip -eq 1; do + skip=0 + case $1 in + --flush) + skip=1 + flush=1 + ;; + --no-file) + skip=1 + nofile=1 + ;; + --no-callers) + skip=1 + nocallers=1 + ;; + --mark-dirty) + skip=1 + nomarkdirty= + ;; + --no-mark-dirty) + skip=1 + nomarkdirty=1 + ;; + --compress) + skip=1 + compress=1 + nofile=1 + ;; + --profile) + skip=1 + compress=1 + nomarkdirty=1 + nocallers=1 + nofile=1 + ;; + --version) + echo "cairo-trace, version @CAIRO_VERSION_MAJOR@.@CAIRO_VERSION_MINOR@.@CAIRO_VERSION_MICRO@." + exit + ;; + --help) + usage + ;; + esac + if test $skip -eq 1; then + shift + fi +done + +if test $# -eq 0; then + usage +fi + +CAIRO_TRACE_PROG_NAME="$1" +export CAIRO_TRACE_PROG_NAME + +if test "x$CAIRO_TRACE_SO" = "x"; then + CAIRO_TRACE_SO="" + for lib in @libdir@/cairo/libcairo-trace.@SHLIB_EXT@ @libdir@/cairo/libcairo-trace.@SHLIB_EXT@* @libdir@/cairo/libcairo-trace.*.@SHLIB_EXT@ ; do + if test -h "$lib" -o -f "$lib"; then + CAIRO_TRACE_SO="$lib" + break + fi + done +fi +if test "x$CAIRO_TRACE_SO" = "x"; then + echo "Could not find the cairo-trace shared library in @libdir@/cairo/." >&2 + echo "Set the CAIRO_TRACE_SO environment variable to the full path of the library." >&2 + exit 15 +fi + +LD_PRELOAD="$CAIRO_TRACE_SO" +DYLD_INSERT_LIBRARIES="$CAIRO_TRACE_SO" +DYLD_FORCE_FLAT_NAMESPACE=1 +export LD_PRELOAD +export DYLD_INSERT_LIBRARIES +export DYLD_FORCE_FLAT_NAMESPACE + +if test -n "$nocallers"; then + CAIRO_TRACE_LINE_INFO=0 + export CAIRO_TRACE_LINE_INFO +fi + +if test -n "$nomarkdirty"; then + CAIRO_TRACE_MARK_DIRTY=0 + export CAIRO_TRACE_MARK_DIRTY +fi + +if test -n "$flush"; then + CAIRO_TRACE_FLUSH=1 + export CAIRO_TRACE_FLUSH +fi + +if test -z "$nofile"; then + CAIRO_TRACE_OUTDIR=`pwd` "$@" +elif test -n "$compress"; then + name=`basename $1` + echo Generating compressed trace file $name.$$.lzma + CAIRO_TRACE_FD=3 "$@" 3>&1 >/dev/null | lzma -cz9 > $name.$$.lzma +else + CAIRO_TRACE_FD=3 "$@" 3>&1 >/dev/null +fi |