From: Julian Seward Date: Wed, 18 Oct 2006 12:41:55 +0000 (+0000) Subject: Observe the rule that requires all instrumenters to copy verbatim any X-Git-Tag: svn/VALGRIND_3_3_0~557 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9a0bafb2701bd15ee9bb0bdabd0ef8048b4eeee;p=thirdparty%2Fvalgrind.git Observe the rule that requires all instrumenters to copy verbatim any IR preamble preceding the first IMark. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6319 --- diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c index 1193c8a535..2470f2b713 100644 --- a/memcheck/mc_translate.c +++ b/memcheck/mc_translate.c @@ -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;