]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Observe the rule that requires all instrumenters to copy verbatim any
authorJulian Seward <jseward@acm.org>
Wed, 18 Oct 2006 12:41:55 +0000 (12:41 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 18 Oct 2006 12:41:55 +0000 (12:41 +0000)
IR preamble preceding the first IMark.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6319

memcheck/mc_translate.c

index 1193c8a535b97f4e3291ca0626e1a17a3e7e877a..2470f2b7136ba6a4f8313574f925949f0c2fe6ef 100644 (file)
@@ -3300,9 +3300,27 @@ IRBB* MC_(instrument) ( VgCallbackClosure* closure,
 
    mce.bogusLiterals = bogus;
 
-   /* Iterate over the stmts to generate instrumentation. */
+   /* Copy verbatim any IR preamble preceding the first IMark */
 
-   for (i = 0; i <  bb_in->stmts_used; i++) {
+   i = 0;
+   while (i < bb_in->stmts_used && bb_in->stmts[i]->tag != Ist_IMark) {
+
+      st = bb_in->stmts[i];
+      tl_assert(st);
+      tl_assert(isFlatIRStmt(st));
+
+      addStmtToIRBB( bb, bb_in->stmts[i] );
+      i++;
+   }
+
+   /* Iterate over the remaining stmts to generate instrumentation. */
+
+   tl_assert(bb_in->stmts_used > 0);
+   tl_assert(i >= 0);
+   tl_assert(i < bb_in->stmts_used);
+   tl_assert(bb_in->stmts[i]->tag == Ist_IMark);
+
+   for (/* use current i*/; i <  bb_in->stmts_used; i++) {
 
       st = bb_in->stmts[i];
       first_stmt = bb->stmts_used;