|
@@ -1,6 +1,6 @@
|
|
|
/* cu_main.c - execution profiler under valgrind
|
|
|
|
|
|
- Copyright (C) 2013,2015-2017,2021 Matthew R. Wette
|
|
|
+ Copyright (C) 2013,2015-2017,2021,2023 Matthew Wette
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
modify it under the terms of the GNU General Public License as
|
|
@@ -33,7 +33,7 @@
|
|
|
#include "pub_tool_threadstate.h"
|
|
|
#include "cputildefs.h"
|
|
|
|
|
|
-static const HChar cu_version[] = "v210627a";
|
|
|
+static const HChar cu_version[] = "v231209a";
|
|
|
|
|
|
/*------------------------------------------------------------*/
|
|
|
/*--- Instrumentation ---*/
|
|
@@ -375,30 +375,29 @@ static UShort cu_op_counts[] = {
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
|
1, 2, 2, 2, 31, 1, 1, 1, 17, 2, 2, 3, 31, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1,
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
|
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 8, 64, 99, 99, 99, 99, 4, 4, 2, 1,
|
|
|
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 99, 1, 1, 99, 99, 99, 99, 99, 99, 99,
|
|
|
- 99, 99, 99, 31, 31, 31, 31, 1, 1, 99, 99, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
|
|
|
- 5, 2, 2, 2, 2, 2, 2, 5, 5, 99, 99, 99, 99, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
|
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 8, 64, 1, 1, 1, 1, 4, 4, 2, 1, 1,
|
|
|
+ 1, 1, 1, 1, 1, 1, 1, 1, 1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5, 1, 1, 1, 1, 1, 1, 1, 1, 0,
|
|
|
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 31, 1, 1, 1, 17, 1, 1, 1,
|
|
|
+ 1, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 0,
|
|
|
};
|
|
|
|
|
|
#define NUM_LD 16
|
|
@@ -445,6 +445,7 @@ static Int cu_expr_cnt(IRExpr *expr)
|
|
|
IROp op;
|
|
|
IRType ty;
|
|
|
|
|
|
+ op = Iop_INVALID;
|
|
|
switch (expr->tag) {
|
|
|
case Iex_Binder: return 0;
|
|
|
case Iex_Get: return 0;
|
|
@@ -475,6 +476,7 @@ static Int cu_expr_cnt(IRExpr *expr)
|
|
|
VG_(printf)("bogus count for op: ~%s\n", cu_op_names[op - Iop_INVALID]);
|
|
|
return 0;
|
|
|
} else {
|
|
|
+ //VG_(printf)("op: %s\n", cu_op_names[op - Iop_INVALID]);
|
|
|
return cu_op_counts[op - Iop_INVALID];
|
|
|
}
|
|
|
}
|
|
@@ -623,6 +625,7 @@ IRSB* cu_instrument ( VgCallbackClosure* closure,
|
|
|
* remove the small number of clock cycles to implement clientrequest.
|
|
|
*/
|
|
|
lclkcnt = cu_divisor; /* Count the clocks to branch here. */
|
|
|
+ lastst = Ist_Exit;
|
|
|
for (/*use current i*/; i < sbIn->stmts_used; i++) {
|
|
|
IRStmt* st = sbIn->stmts[i];
|
|
|
if (!st || st->tag == Ist_NoOp) continue;
|
|
@@ -741,7 +744,7 @@ IRSB* cu_instrument ( VgCallbackClosure* closure,
|
|
|
addStmtToIRSB( sbOut, st );
|
|
|
break;
|
|
|
default:
|
|
|
- VG_(printf)("cu_main: st->tag=%d\n", st->tag);
|
|
|
+ VG_(printf)("cu_main: st->tag=%u\n", st->tag);
|
|
|
tl_assert(0);
|
|
|
}
|
|
|
lastst = st->tag;
|
|
@@ -978,7 +981,7 @@ static Bool cu_load_op_table(const HChar *filename)
|
|
|
if (0 <= cval && cval <= 1999) { /* arbitrary max clock count */
|
|
|
cu_ld_counts[ix] = cval;
|
|
|
} else {
|
|
|
- VG_(umsg)("invalid clock count: %d, line %d\n", cval, ln);
|
|
|
+ VG_(umsg)("invalid clock count: %u, line %d\n", cval, ln);
|
|
|
VG_(umsg)(" expect in: [0,1999]\n");
|
|
|
return False;
|
|
|
}
|
|
@@ -1006,7 +1009,7 @@ static Bool cu_load_op_table(const HChar *filename)
|
|
|
if (0 <= cval && cval <= 1999) { /* arbitrary max clock count */
|
|
|
cu_op_counts[ix] = cval;
|
|
|
} else {
|
|
|
- VG_(umsg)("invalid clock count: %d, line %d\n", cval, ln);
|
|
|
+ VG_(umsg)("invalid clock count: %u, line %d\n", cval, ln);
|
|
|
VG_(umsg)(" expect in: [0,1999]\n");
|
|
|
return False;
|
|
|
}
|