summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFabien Chouteau <chouteau@adacore.com>2011-01-27 10:24:41 +0100
committerBlue Swirl <blauwirbel@gmail.com>2011-01-29 22:52:00 +0000
commit320fba2a1f384e17db150d74540a2cf005eb47b5 (patch)
tree1d87da9f4471ae7ae892daffc7b0439759a9ffcb /scripts
parent491e2a338fdf8310c84f6ebaed1683a871a0700e (diff)
New trace-event backend: stderr
This backend sends trace events to standard error output during the emulation. Also add a "--list-backends" option to tracetool, so configure script can display the list of available backends. Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/tracetool60
1 files changed, 58 insertions, 2 deletions
diff --git a/scripts/tracetool b/scripts/tracetool
index fce491c50..e04668322 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -13,12 +13,13 @@ set -f
usage()
{
cat >&2 <<EOF
-usage: $0 [--nop | --simple | --ust] [-h | -c]
+usage: $0 [--nop | --simple | --stderr | --ust | --dtrace] [-h | -c]
Generate tracing code for a file on stdin.
Backends:
--nop Tracing disabled
--simple Simple built-in backend
+ --stderr Stderr built-in backend
--ust LTTng User Space Tracing backend
--dtrace DTrace/SystemTAP backend
@@ -236,6 +237,56 @@ linetoc_end_simple()
EOF
}
+#STDERR
+linetoh_begin_stderr()
+{
+ cat <<EOF
+#include <stdio.h>
+EOF
+}
+
+linetoh_stderr()
+{
+ local name args argnames argc fmt
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ argnames=$(get_argnames "$1" ",")
+ argc=$(get_argc "$1")
+ fmt=$(get_fmt "$1")
+
+ if [ "$argc" -gt 0 ]; then
+ argnames=", $argnames"
+ fi
+
+ cat <<EOF
+static inline void trace_$name($args)
+{
+ fprintf(stderr, "$name $fmt\n" $argnames);
+}
+EOF
+}
+
+linetoh_end_stderr()
+{
+return
+}
+
+linetoc_begin_stderr()
+{
+return
+}
+
+linetoc_stderr()
+{
+return
+}
+
+linetoc_end_stderr()
+{
+return
+}
+#END OF STDERR
+
# Clean up after UST headers which pollute the namespace
ust_clean_namespace() {
cat <<EOF
@@ -546,7 +597,7 @@ targetarch=
until [ -z "$1" ]
do
case "$1" in
- "--nop" | "--simple" | "--ust" | "--dtrace") backend="${1#--}" ;;
+ "--nop" | "--simple" | "--stderr" | "--ust" | "--dtrace") backend="${1#--}" ;;
"--binary") shift ; binary="$1" ;;
"--target-arch") shift ; targetarch="$1" ;;
@@ -557,6 +608,11 @@ do
"--check-backend") exit 0 ;; # used by ./configure to test for backend
+ "--list-backends") # used by ./configure to list available backends
+ echo "nop simple stderr ust dtrace"
+ exit 0
+ ;;
+
*)
usage;;
esac