From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHCHO-0000YI-PB for qemu-devel@nongnu.org; Tue, 12 Aug 2014 09:38:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHCHH-00081k-MK for qemu-devel@nongnu.org; Tue, 12 Aug 2014 09:38:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHCHH-00081X-Dx for qemu-devel@nongnu.org; Tue, 12 Aug 2014 09:38:15 -0400 From: Stefan Hajnoczi Date: Tue, 12 Aug 2014 14:37:42 +0100 Message-Id: <1407850675-11890-6-git-send-email-stefanha@redhat.com> In-Reply-To: <1407850675-11890-1-git-send-email-stefanha@redhat.com> References: <1407850675-11890-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 05/18] trace: [tcg] Add documentation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Stefan Hajnoczi From: Llu=C3=ADs Vilanova Signed-off-by: Llu=C3=ADs Vilanova Signed-off-by: Stefan Hajnoczi --- 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 wh= en the event is disabled: You can check both if the event has been disabled and is dynamically ena= bled at the same time using the 'trace_event_get_state' routine (see header "trace/control.h" for more information). + +=3D=3D=3D "tcg" =3D=3D=3D + +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 f= unction +will automatically call "trace__trans", and will generate the +necessary TCG code to call "trace__exec" during guest code ex= ecution. + +Events with the "tcg" property can be declared in the "trace-events" fil= e 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 p= rinting +formats (separated by a comma): + + tcg foo(uint8_t a1, TCGv_i32 a2) "a1=3D%d", "a1=3D%d a2=3D%d" + +For example: + + #include "trace-tcg.h" + =20 + void some_disassembly_func (...) + { + uint8_t a1 =3D ...; + TCGv_i32 a2 =3D ...; + 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); --=20 1.9.3