From 8dd6f988eb3e47b383e0d8978c2158041c10ffb9 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Date: Thu, 17 Feb 2011 12:51:58 -0200
Subject: [PATCH 3/4] tracetool: Add optional argument to specify dtrace probe names

RH-Author: Jes Sorensen <Jes.Sorensen@redhat.com>
Message-id: <1297947119-18943-2-git-send-email-Jes.Sorensen@redhat.com>
Patchwork-id: 18397
O-Subject: [PATCH 1/2] tracetool: Add optional argument to specify dtrace probe
	names
Bugzilla: 672441
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Optional feature allowing a user to generate the probe list to match
the name of the binary, in case they wish to install qemu under a
different name than qemu-{system,user},<arch>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 tracetool |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 tracetool |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/tracetool b/tracetool
index 89ad479..da05df7 100644
--- a/tracetool
+++ b/tracetool
@@ -27,9 +27,11 @@ Output formats:
   --stap Generate .stp file (DTrace with SystemTAP only)
 
 Options:
-  --binary      [path]  Full path to QEMU binary
-  --target-arch [arch]  QEMU emulator target arch
-  --target-type [type]  QEMU emulator target type ('system' or 'user')
+  --binary       [path]    Full path to QEMU binary
+  --target-arch  [arch]    QEMU emulator target arch
+  --target-type  [type]    QEMU emulator target type ('system' or 'user')
+  --probe-prefix [prefix]  Prefix for dtrace probe names
+                           (default: qemu-\$targettype-\$targetarch)
 
 EOF
     exit 1
@@ -244,7 +246,7 @@ linetostap_dtrace()
 
     # Define prototype for probe arguments
     cat <<EOF
-probe qemu.$targettype.$targetarch.$name = process("$binary").mark("$name")
+probe $probeprefix.$name = process("$binary").mark("$name")
 {
 EOF
 
@@ -346,14 +348,17 @@ tracetostap()
        echo "--binary is required for SystemTAP tapset generator"
        exit 1
     fi
-    if [ -z "$targettype" ]; then
+    if [ -z "$probeprefix" -a -z "$targettype" ]; then
        echo "--target-type is required for SystemTAP tapset generator"
        exit 1
     fi
-    if [ -z "$targetarch" ]; then
+    if [ -z "$probeprefix" -a -z "$targetarch" ]; then
        echo "--target-arch is required for SystemTAP tapset generator"
        exit 1
     fi
+    if [ -z "$probeprefix" ]; then
+	probeprefix="qemu.$targettype.$targetarch";
+    fi
     echo "/* This file is autogenerated by tracetool, do not edit. */"
     convert stap
 }
@@ -364,6 +369,7 @@ output=
 binary=
 targettype=
 targetarch=
+probeprefix=
 
 
 until [ -z "$1" ]
@@ -374,6 +380,7 @@ do
     "--binary") shift ; binary="$1" ;;
     "--target-arch") shift ; targetarch="$1" ;;
     "--target-type") shift ; targettype="$1" ;;
+    "--probe-prefix") shift ; probeprefix="$1" ;;
 
     "-h" | "-c" | "-d") output="${1#-}" ;;
     "--stap") output="${1#--}" ;;
-- 
1.7.4.rc1.16.gd2f15e

