From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYmnE-00083U-ET for qemu-devel@nongnu.org; Thu, 08 Dec 2011 17:50:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RYmnC-0008T8-Pz for qemu-devel@nongnu.org; Thu, 08 Dec 2011 17:50:20 -0500 Received: from gw.ac.upc.edu ([147.83.30.3]:37260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYmnC-0008Sw-CE for qemu-devel@nongnu.org; Thu, 08 Dec 2011 17:50:18 -0500 Received: from localhost (unknown [84.88.53.92]) by gw.ac.upc.edu (Postfix) with ESMTP id 45F6A6B02C9 for ; Thu, 8 Dec 2011 23:50:17 +0100 (CET) From: =?utf-8?b?TGx1w61z?= Vilanova Date: Thu, 08 Dec 2011 23:50:09 +0100 Message-ID: <20111208225009.21668.10341.stgit@ginnungagap.bsc.es> In-Reply-To: <20111208224750.21668.26153.stgit@ginnungagap.bsc.es> References: <20111208224750.21668.26153.stgit@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 09/10] trace-tcg: [tracetool] Define TCG tracing helper routines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Generate the necessary TCG helper routines for tracing events in guest co= de. Signed-off-by: Llu=C3=ADs Vilanova --- .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 +=3D trace.h trace-tcg-helper.h ifeq ($(TRACE_BACKEND),dtrace) GENERATED_HEADERS +=3D trace-dtrace.h endif -GENERATED_SOURCES +=3D trace.c +GENERATED_SOURCES +=3D trace.c trace-tcg-helper.c =20 GENERATED_HEADERS +=3D qmp-commands.h qapi-types.h qapi-visit.h GENERATED_SOURCES +=3D 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-even= ts $(BUILD_DIR)/config-host. =20 trace-tcg-helper.h: trace-tcg-helper.h-timestamp =20 +trace-tcg-helper.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/conf= ig-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 =20 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) +=3D tci-dis.o =20 tci-dis.o: QEMU_CFLAGS +=3D -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci =20 +libobj-y +=3D trace-tcg-helper.o + $(libobj-y): $(GENERATED_HEADERS) =20 # 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) =20 Options: --binary [path] Full path to QEMU binary @@ -241,6 +242,13 @@ tcg_compat_type() esac } =20 +host_tcg_compat_type() +{ + local tcg_compat_type + tcg_compat_type=3D`tcg_compat_type "$1"` + host_type "$tcg_compat_type" +} + tcg_type() { local tcg_compat_type @@ -829,6 +837,53 @@ linetotcg_h_end_tcg() return } =20 +linetotcg_c_nop() +{ + return +} + +linetotcg_c_tcg() +{ + local has_tcg has_tcg_vcpu + has_property "$1" "tcg" && has_tcg=3D1 + has_property "$1" "tcg-vcpu" && has_tcg_vcpu=3D1 + if [ "$has_tcg" !=3D "1" -a "$has_tcg_vcpu" !=3D "1" ]; then + return + fi + + # TCG-compatible to actual type conversion bridge + local api args argtypes argnames values + api=3D$(get_api_name "$1") + args=3D$(get_args "$1" host_tcg_compat_type) + argnames=3D$(get_argnames "$1" ",") + argtypes=3D$(get_argtypes "$1" host_type) + values=3D$(zip_lists "$argtypes" "$argnames" "(%s)%s, ") + values=3D${values%, } + + cat <= &2 + exit 1 + fi + convert tcg_c +} + =20 backend=3D output=3D @@ -949,6 +1013,7 @@ do "-h" | "-c" | "-d") output=3D"${1#-}" ;; "--stap") output=3D"${1#--}" ;; "--tcg-h") output=3D"tcg_h" ;; + "--tcg-c") output=3D"tcg_c" ;; =20 "--check-backend") exit 0 ;; # used by ./configure to test for backe= nd =20