When found, TCG types are translated into the host native types when declaring
and defining the tracing routines in "trace.h" and "trace.c".
---
 scripts/tracetool |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/scripts/tracetool b/scripts/tracetool
index 853f1bd..1d8a637 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -210,6 +210,21 @@ nil_type()
     echo "$1"
 }
 
+# Native type translator for get_argtypes
+# (e.g., TCGv_i32 -> uint32_t)
+host_type()
+{
+    case "$1" in
+        "TCGv_i32") echo "uint32_t" ;;
+        "TCGv_i64") echo "uint64_t" ;;
+        "TCGv_ptr") echo "void *"   ;;
+        # force a fixed-size type in trace.{h,c}
+        # (ideally would use a host-specific type)
+        "TCGv")     echo "uint64_t" ;;
+        *)          echo "$1"       ;;
+    esac
+}
+
 
 # Get the argument name list of a trace event
 get_argnames()
@@ -263,7 +278,7 @@ linetoh_nop()
 {
     local api args
     api=$(get_api_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
 
     # Define an empty function for the trace event
     cat <<EOF
@@ -315,7 +330,7 @@ linetoh_simple()
 {
     local api args argc trace_args
     api=$(get_api_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     argc=$(get_argc "$1")
 
     trace_args="$simple_event_num"
@@ -388,7 +403,7 @@ linetoh_stderr()
     local name api args argnames argc fmt
     name=$(get_name "$1")
     api=$(get_api_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     argnames=$(get_argnames "$1" ",")
     argc=$(get_argc "$1")
     fmt=$(get_fmt "$1")
@@ -465,7 +480,7 @@ linetoh_ust()
     local name api args argnames
     name=$(get_name "$1")
     api=$(get_api_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     argnames=$(get_argnames "$1", ",")
 
     cat <<EOF
@@ -492,7 +507,7 @@ linetoc_ust()
 {
     local name args argnames fmt
     name=$(get_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     argnames=$(get_argnames "$1", ",")
     [ -z "$argnames" ] || argnames=", $argnames"
     fmt=$(get_fmt "$1")
@@ -538,7 +553,7 @@ linetoh_dtrace()
     local name api args argnames nameupper
     name=$(get_name "$1")
     api=$(get_api_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     argnames=$(get_argnames "$1", ",")
 
     nameupper=`echo $name | tr '[:lower:]' '[:upper:]'`
@@ -585,7 +600,7 @@ linetod_dtrace()
 {
     local name args
     name=$(get_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
 
     # DTrace provider syntax expects foo() for empty
     # params, not foo(void)
@@ -615,7 +630,7 @@ linetostap_dtrace()
 {
     local i arg name args arglist
     name=$(get_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     arglist=$(get_argnames "$1", "")
 
     # Define prototype for probe arguments


Reply via email to