From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59014 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PDjY0-0001dq-5h for qemu-devel@nongnu.org; Wed, 03 Nov 2010 16:03:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PDjXy-0006L9-Fo for qemu-devel@nongnu.org; Wed, 03 Nov 2010 16:03:03 -0400 Received: from mailout-de.gmx.net ([213.165.64.23]:44724 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PDjXy-0006Kf-53 for qemu-devel@nongnu.org; Wed, 03 Nov 2010 16:03:02 -0400 From: =?utf-8?b?TGx1w61z?= Date: Wed, 03 Nov 2010 21:03:05 +0100 Message-ID: <20101103200305.6599.37739.stgit@ginnungagap.bsc.es> In-Reply-To: <20101103200233.6599.50130.stgit@ginnungagap.bsc.es> References: <20101103200233.6599.50130.stgit@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v1 4/4] trace-gen: auto-generate wrappers to call TCG trace helpers List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Auto-generates file "trace-gen.h" with instrumentable wrappers to generate calls to TCG trace helpers. Such wrappers are named 'trace_gen_##name', also reachable as 'trace_gen_##name##_backend' when instrumented. Events with the "gen" property are also able to use TCG types on the trace event declaration, which are gracefully handled when generating trace functions. Only trace events with the 'gen' property are affected. Signed-off-by: LluĂ­s Vilanova --- Makefile | 8 +++- trace-events | 3 + tracetool | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 139 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5975926..2831dc3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile for QEMU. -GENERATED_HEADERS = config-host.h trace.h trace-helper.h trace-helper.c +GENERATED_HEADERS = config-host.h trace.h trace-helper.h trace-helper.c trace-gen.h ifneq ($(wildcard config-host.mak),) # Put the all: rule here so that config-host.mak can contain dependencies. @@ -130,6 +130,11 @@ trace-helper.c-timestamp: $(SRC_PATH)/trace-events config-host.mak trace-helper.o: trace-helper.c $(GENERATED_HEADERS) +trace-gen.h: trace-gen.h-timestamp +trace-gen.h-timestamp: $(SRC_PATH)/trace-events config-host.mak + $(call quiet-command,sh $(SRC_PATH)/tracetool $(TRACETOOL_EXTRA) --gen --$(TRACE_BACKEND) -h < $< > $@," GEN trace-gen.h") + @cmp -s $@ trace-gen.h || cp $@ trace-gen.h + simpletrace.o: simpletrace.c $(GENERATED_HEADERS) version.o: $(SRC_PATH)/version.rc config-host.mak @@ -167,6 +172,7 @@ clean: rm -f qemu-img-cmds.h rm -f trace.c trace.h trace.c-timestamp trace.h-timestamp rm -f trace-helper.c trace-helper.h trace-helper.h-timestamp trace-helper.c-timestamp + rm -f trace-gen.h-timestamp trace-gen.c-timestamp $(MAKE) -C tests clean for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser libdis libdis-user; do \ if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \ diff --git a/trace-events b/trace-events index 4a89d97..a54fa03 100644 --- a/trace-events +++ b/trace-events @@ -43,6 +43,9 @@ # Provide trace events suitable for using during TCG code generation. # Generates TCG function helpers reachable through 'helper_trace_gen_##name' # which proxy their calls onto 'trace_##name'. +# As an extra aid, functions named 'trace_gen_##name' are generated into +# "trace-gen.h", which can be reched through 'trace_gen_##name##_backend' when +# the event is instrumented. # qemu-malloc.c disable qemu_malloc(size_t size, void *ptr) "size %zu ptr %p" diff --git a/tracetool b/tracetool index 588f442..e99da0c 100755 --- a/tracetool +++ b/tracetool @@ -602,6 +602,134 @@ void helper_trace_proxy_$name($args) EOF } +### Gen - H +traceto_h_gen() +{ + cat <