From b3e02cac3fd47e978181f701e6ea2458c1cd1262 Mon Sep 17 00:00:00 2001 From: Moncef Mechri Date: Wed, 2 Apr 2014 14:37:55 +0200 Subject: [PATCH] Predicate the call to trace_mem() The pin sampler inserts a call to trace_mem() and a predicated call to trace_update_access_counter() that is NOT called if the current instruction is a predicate (cmov, ...) and the condition is false. This could lead to the situation where the access counter is not updated but the memory access is recorded by the sampler, and thus to the situation where two samples accessing the same memory location have the same timestamp. This causes the current model to exit with this error: File "/home/moncef/coding/uart/util/python/util/analysis_orig/utils.py", line 50, in usf_read_events assert(event.begin.time < event.end.time) AssertionError This patch makes the call to trace_mem() predicated too so that if the current instruction is a predicate and the condition is false, the memory access is not passed to the sampler --- pin/pin_sampler.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pin/pin_sampler.cc b/pin/pin_sampler.cc index 5ad2394..55bba4a 100644 --- a/pin/pin_sampler.cc +++ b/pin/pin_sampler.cc @@ -108,7 +108,7 @@ instrument(INS ins, VOID *v) is_rd && is_wr ? USF_ATYPE_RW : (is_wr ? USF_ATYPE_WR : USF_ATYPE_RD); - INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR)trace_mem, + INS_InsertPredicatedCall(ins, IPOINT_BEFORE, (AFUNPTR)trace_mem, IARG_INST_PTR, IARG_MEMORYOP_EA, op, IARG_UINT32, size,