From patchwork Fri May 30 12:11:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 354105 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 554C914009A for ; Fri, 30 May 2014 22:12:54 +1000 (EST) Received: from localhost ([::1]:53733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqLg3-0000To-T8 for incoming@patchwork.ozlabs.org; Fri, 30 May 2014 08:12:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqLfJ-0007W4-4u for qemu-devel@nongnu.org; Fri, 30 May 2014 08:12:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WqLfB-0003O1-Ce for qemu-devel@nongnu.org; Fri, 30 May 2014 08:12:05 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:53037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqLfB-0003Nh-1n for qemu-devel@nongnu.org; Fri, 30 May 2014 08:11:57 -0400 Received: from gw-2.ac.upc.es (gw-2.ac.upc.es [147.83.30.8]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id s4UCBQ2Z003654; Fri, 30 May 2014 14:11:26 +0200 Received: from localhost (unknown [84.88.51.85]) by gw-2.ac.upc.es (Postfix) with ESMTPSA id BA6FBBA; Fri, 30 May 2014 14:11:26 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Fri, 30 May 2014 14:11:26 +0200 Message-Id: <20140530121126.6581.29235.stgit@fimbulvetr.bsc.es> X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: <20140530121117.6581.71271.stgit@fimbulvetr.bsc.es> References: <20140530121117.6581.71271.stgit@fimbulvetr.bsc.es> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id s4UCBQ2Z003654 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Cc: Peter Maydell , Stefan Hajnoczi , Richard Henderson Subject: [Qemu-devel] [PATCH v5 01/11] trace: [tcg] Add documentation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: LluĂ­s Vilanova --- docs/tracing.txt | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/docs/tracing.txt b/docs/tracing.txt index c6ab1c1..2e035a5 100644 --- a/docs/tracing.txt +++ b/docs/tracing.txt @@ -307,3 +307,43 @@ guard such computations and avoid its compilation when the event is disabled: You can check both if the event has been disabled and is dynamically enabled at the same time using the 'trace_event_get_state' routine (see header "trace/control.h" for more information). + +=== "tcg" === + +Guest code generated by TCG can be traced by defining an event with the "tcg" +event property. Internally, this property generates two events: +"_trans" to trace the event at translation time, and +"_exec" to trace the event at execution time. + +Instead of using these two events, you should instead use the function +"trace__tcg" during translation (TCG code generation). This function +will automatically call "trace__trans", and will generate the +necessary TCG code to call "trace__exec" during guest code execution. + +Events with the "tcg" property can be declared in the "trace-events" file with a +mix of native and TCG types, and "trace__tcg" will gracefully forward +them to the "_trans" and "_exec" events. Since TCG values +are not known at translation time, these are ignored by the "_trans" +event. Because of this, the entry in the "trace-events" file needs two printing +formats (separated by a comma): + + tcg foo(uint8_t a1, TCGv_i32 a2) "a1=%d", "a1=%d a2=%d" + +For example: + + #include "trace-tcg.h" + + void some_disassembly_func (...) + { + uint8_t a1 = ...; + TCGv_i32 a2 = ...; + trace_foo_tcg(a1, a2); + } + +This will immediately call: + + void trace_foo_trans(uint8_t a1); + +and will generate the TCG code to call: + + void trace_foo(uint8_t a1, uint32_t a2);