|
From: <sv...@va...> - 2005-07-06 19:42:25
|
Author: sewardj
Date: 2005-07-06 20:42:23 +0100 (Wed, 06 Jul 2005)
New Revision: 4117
Log:
Scan the entire BB looking for "bogus literals"* before instrumenting
any of it, so as to avoid any problems arising from switching from one
scheme to the other half-way through.
Modified:
trunk/memcheck/mc_translate.c
Modified: trunk/memcheck/mc_translate.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/mc_translate.c 2005-07-06 19:01:53 UTC (rev 4116)
+++ trunk/memcheck/mc_translate.c 2005-07-06 19:42:23 UTC (rev 4117)
@@ -2636,8 +2636,8 @@
IRBB* MC_(instrument) ( IRBB* bb_in, VexGuestLayout* layout,=20
IRType gWordTy, IRType hWordTy )
{
- Bool verboze =3D False; //True;=20
-
+ Bool verboze =3D False; //True;=20
+ Bool bogus;
Int i, j, first_stmt;
IRStmt* st;
MCEnv mce;
@@ -2673,23 +2673,38 @@
for (i =3D 0; i < mce.n_originalTmps; i++)
mce.tmpMap[i] =3D IRTemp_INVALID;
=20
- /* Iterate over the stmts. */
+ /* Make a preliminary inspection of the statements, to see if there
+ are any dodgy-looking literals. If there are, we generate
+ extra-detailed (hence extra-expensive) instrumentation in
+ places. Scan the whole bb even if dodgyness is found earlier,
+ so that the flatness assertion is applied to all stmts. */
=20
+ bogus =3D False;
+
for (i =3D 0; i < bb_in->stmts_used; i++) {
+
st =3D bb_in->stmts[i];
tl_assert(st);
-
tl_assert(isFlatIRStmt(st));
=20
- if (!mce.bogusLiterals) {
- mce.bogusLiterals =3D checkForBogusLiterals(st);
- if (0&& mce.bogusLiterals) {
+ if (!bogus) {
+ bogus =3D checkForBogusLiterals(st);
+ if (0 && bogus) {
VG_(printf)("bogus: ");
ppIRStmt(st);
VG_(printf)("\n");
}
}
=20
+ }
+
+ mce.bogusLiterals =3D bogus;
+
+ /* Iterate over the stmts to generate instrumentation. */
+
+ for (i =3D 0; i < bb_in->stmts_used; i++) {
+
+ st =3D bb_in->stmts[i];
first_stmt =3D bb->stmts_used;
=20
if (verboze) {
|