diff options
author | Lluís Vilanova | 2016-02-25 17:43:38 +0100 |
---|---|---|
committer | Stefan Hajnoczi | 2016-03-01 14:27:10 +0100 |
commit | 3d211d9f4dbee7483f092c287ef20d8336100445 (patch) | |
tree | 5e547d1b9a2383adb71e275b13f287b4639bf01b /docs | |
parent | typedefs: Add CPUState (diff) | |
download | qemu-3d211d9f4dbee7483f092c287ef20d8336100445.tar.gz qemu-3d211d9f4dbee7483f092c287ef20d8336100445.tar.xz qemu-3d211d9f4dbee7483f092c287ef20d8336100445.zip |
trace: Add 'vcpu' event property to trace guest vCPU
This property identifies events that trace vCPU-specific information.
It adds a "CPUState*" argument to events with the property, identifying
the vCPU raising the event. TCG translation events also have a
"TCGv_env" implicit argument that is later used as the "CPUState*"
argument at execution time.
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 145641861797.30295.6991314023181842105.stgit@localhost
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/tracing.txt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/docs/tracing.txt b/docs/tracing.txt index f2f553bd4c..3182ee82ad 100644 --- a/docs/tracing.txt +++ b/docs/tracing.txt @@ -344,3 +344,44 @@ This will immediately call: and will generate the TCG code to call: void trace_foo(uint8_t a1, uint32_t a2); + +=== "vcpu" === + +Identifies events that trace vCPU-specific information. It implicitly adds a +"CPUState*" argument, and extends the tracing print format to show the vCPU +information. If used together with the "tcg" property, it adds a second +"TCGv_env" argument that must point to the per-target global TCG register that +points to the vCPU when guest code is executed (usually the "cpu_env" variable). + +The following example events: + + foo(uint32_t a) "a=%x" + vcpu bar(uint32_t a) "a=%x" + tcg vcpu baz(uint32_t a) "a=%x", "a=%x" + +Can be used as: + + #include "trace-tcg.h" + + CPUArchState *env; + TCGv_ptr cpu_env; + + void some_disassembly_func(...) + { + /* trace emitted at this point */ + trace_foo(0xd1); + /* trace emitted at this point */ + trace_bar(ENV_GET_CPU(env), 0xd2); + /* trace emitted at this point (env) and when guest code is executed (cpu_env) */ + trace_baz_tcg(ENV_GET_CPU(env), cpu_env, 0xd3); + } + +If the translating vCPU has address 0xc1 and code is later executed by vCPU +0xc2, this would be an example output: + + // at guest code translation + foo a=0xd1 + bar cpu=0xc1 a=0xd2 + baz_trans cpu=0xc1 a=0xd3 + // at guest code execution + baz_exec cpu=0xc2 a=0xd3 |