[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/10] trace-tcg: [tracetool] Define TCG tracing hel
From: |
Lluís Vilanova |
Subject: |
[Qemu-devel] [PATCH 09/10] trace-tcg: [tracetool] Define TCG tracing helper routines |
Date: |
Thu, 08 Dec 2011 23:50:09 +0100 |
User-agent: |
StGit/0.15 |
Generate the necessary TCG helper routines for tracing events in guest code.
Signed-off-by: Lluís Vilanova <address@hidden>
---
.gitignore | 1 +
Makefile | 2 +-
Makefile.objs | 8 +++++++
Makefile.target | 2 ++
scripts/tracetool | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 77 insertions(+), 1 deletions(-)
diff --git a/.gitignore b/.gitignore
index d47b586..1a6de79 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ trace.c
trace-dtrace.h
trace-dtrace.dtrace
trace-tcg-helper.h
+trace-tcg-helper.c
*-timestamp
*-softmmu
*-darwin-user
diff --git a/Makefile b/Makefile
index 516622a..b1d1249 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ GENERATED_HEADERS += trace.h trace-tcg-helper.h
ifeq ($(TRACE_BACKEND),dtrace)
GENERATED_HEADERS += trace-dtrace.h
endif
-GENERATED_SOURCES += trace.c
+GENERATED_SOURCES += trace.c trace-tcg-helper.c
GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h
GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c
diff --git a/Makefile.objs b/Makefile.objs
index 8f97709..f153fa5 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -406,6 +406,14 @@ trace-tcg-helper.h-timestamp: $(SRC_PATH)/trace-events
$(BUILD_DIR)/config-host.
trace-tcg-helper.h: trace-tcg-helper.h-timestamp
+trace-tcg-helper.c-timestamp: $(SRC_PATH)/trace-events
$(BUILD_DIR)/config-host.mak
+ $(call quiet-command,sh $(SRC_PATH)/scripts/tracetool
$(TRACETOOL_EXTRA) --tcg --tcg-c < $< > $@," GEN
$(TARGET_DIR)trace-tcg-helper.c")
+ @cmp -s $@ trace-tcg-helper.c || cp $@ trace-tcg-helper.c
+
+trace-tcg-helper.c: trace-tcg-helper.c-timestamp
+
+trace-tcg-helper.o: trace-tcg-helper.c $(GENERATED_HEADERS)
+
######################################################################
# smartcard
diff --git a/Makefile.target b/Makefile.target
index a111521..8b3ffd6 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -90,6 +90,8 @@ libobj-$(CONFIG_TCI_DIS) += tci-dis.o
tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
+libobj-y += trace-tcg-helper.o
+
$(libobj-y): $(GENERATED_HEADERS)
# libqemu
diff --git a/scripts/tracetool b/scripts/tracetool
index 5431f2d..197739a 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -30,6 +30,7 @@ Output formats:
-d Generate .d file (DTrace only)
--stap Generate .stp file (DTrace with SystemTAP only)
--tcg-h Generate trace-tcg-helper.h file (tcg only)
+ --tcg-c Generate trace-tcg-helper.c file (tcg only)
Options:
--binary [path] Full path to QEMU binary
@@ -241,6 +242,13 @@ tcg_compat_type()
esac
}
+host_tcg_compat_type()
+{
+ local tcg_compat_type
+ tcg_compat_type=`tcg_compat_type "$1"`
+ host_type "$tcg_compat_type"
+}
+
tcg_type()
{
local tcg_compat_type
@@ -829,6 +837,53 @@ linetotcg_h_end_tcg()
return
}
+linetotcg_c_nop()
+{
+ return
+}
+
+linetotcg_c_tcg()
+{
+ local has_tcg has_tcg_vcpu
+ has_property "$1" "tcg" && has_tcg=1
+ has_property "$1" "tcg-vcpu" && has_tcg_vcpu=1
+ if [ "$has_tcg" != "1" -a "$has_tcg_vcpu" != "1" ]; then
+ return
+ fi
+
+ # TCG-compatible to actual type conversion bridge
+ local api args argtypes argnames values
+ api=$(get_api_name "$1")
+ args=$(get_args "$1" host_tcg_compat_type)
+ argnames=$(get_argnames "$1" ",")
+ argtypes=$(get_argtypes "$1" host_type)
+ values=$(zip_lists "$argtypes" "$argnames" "(%s)%s, ")
+ values=${values%, }
+
+ cat <<EOF
+void helper_${api}_proxy($args)
+{
+ ${api}($values);
+}
+EOF
+}
+
+linetotcg_c_begin_tcg()
+{
+ cat <<EOF
+/* This file is autogenerated by tracetool, do not edit. */
+
+#define TRACE_TCG_HELPER
+#include "trace.h"
+#include "helper.h"
+EOF
+}
+
+linetotcg_c_end_tcg()
+{
+ return
+}
+
# Process stdin by calling begin, line, and end functions for the backend
convert()
{
@@ -925,6 +980,15 @@ tracetotcg_h()
EOF
}
+tracetotcg_c()
+{
+ if [ $backend != "tcg" ]; then
+ echo "TCG helper generator not applicable to $backend backend" >&2
+ exit 1
+ fi
+ convert tcg_c
+}
+
backend=
output=
@@ -949,6 +1013,7 @@ do
"-h" | "-c" | "-d") output="${1#-}" ;;
"--stap") output="${1#--}" ;;
"--tcg-h") output="tcg_h" ;;
+ "--tcg-c") output="tcg_c" ;;
"--check-backend") exit 0 ;; # used by ./configure to test for backend
- [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 01/10] trace: [doc] Document event properties on a separate section, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 02/10] trace-tcg: Add documentation, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 03/10] Trivial changes to eliminate auto-generated files, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 04/10] [m68k, s390, xtensa] Move helpers.h to helper.h, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 05/10] trace: [tracetool] Common functions to manage event arguments, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 06/10] trace: [tracetool] Add 'get_api_name' to construct the name of tracing routines, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 07/10] trace-tcg: [tracetool] Allow TCG types in trace event declarations, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 08/10] trace-tcg: [tracetool] Declare TCG tracing helper routines, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 09/10] trace-tcg: [tracetool] Define TCG tracing helper routines,
Lluís Vilanova <=
- [Qemu-devel] [PATCH 10/10] trace-tcg: [all] Include TCG-tracing helpers, Lluís Vilanova, 2011/12/08