From: Andi Kleen <a...@linux.intel.com>

When a PTWRITE sample is synthesized the PT decoder already
ran ahead and sample->insn contains the next branch instruction,
not the PTWRITE.

Clear it for PTWRITE samples to avoid confusion.

Signed-off-by: Andi Kleen <a...@linux.intel.com>
---
 tools/perf/util/intel-pt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 23f9ba676df0..485c8040484e 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -1262,6 +1262,12 @@ static void intel_pt_prep_p_sample(struct intel_pt *pt,
         */
        if (!sample->ip)
                sample->flags = 0;
+
+       /*
+        * Don't have valid instructions because decoder already ran ahead.
+        */
+       sample->insn_len = 0;
+       memset(sample->insn, 0, INTEL_PT_INSN_BUF_SZ);
 }
 
 static int intel_pt_synth_ptwrite_sample(struct intel_pt_queue *ptq)
-- 
2.13.6

Reply via email to