diff mbox

[01/12] trace: [tcg] Add documentation

Message ID 20140131160908.32741.6227.stgit@fimbulvetr.bsc.es
State New
Headers show

Commit Message

Lluís Vilanova Jan. 31, 2014, 4:09 p.m. UTC
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 docs/tracing.txt |   36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
diff mbox

Patch

diff --git a/docs/tracing.txt b/docs/tracing.txt
index bfc261b..9bf7073 100644
--- a/docs/tracing.txt
+++ b/docs/tracing.txt
@@ -271,3 +271,39 @@  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.
+
+In addition to the regular "trace_<eventname>" routine in the "trace.h" header,
+events with the "tcg" property also provide the routine "trace_<eventname>_tcg"
+in the "trace-tcg.h" header. This routine can be called during TCG code
+generation to automatically generate TCG code to call "trace_<eventname>" during
+TCG code execution.
+
+Events with the "tcg" property can be declared in the "trace-events" file with a
+mix of basic and TCG types. The "trace_<eventname>_tcg" routine will
+transparently take care of turning any non-TCG argument into a TCG value, and
+the "trace_<eventname>" routine will automatically receive non-TCG values.
+
+For example, the event (as would be declared in "trace-events"):
+
+    tcg foo(uint8_t a1, TCGv_i32 a2) "a1=%d a2=%d"
+
+Can be invoked as:
+
+    #include "helper.h"
+    
+    void bar ()
+    {
+        uint8_t a1 = ...;
+        TCGv_i32 a2 = ...;
+        trace_foo_tcg(a1, a2);
+    }
+
+And the intermediate boilerplate code will take care of generating the TCG code
+to call (as would be declared in "trace.h"):
+
+    void trace_foo(uint8_t a1, uint32_t a2);