From: Bart Van Assche Date: Sat, 10 May 2008 08:22:20 +0000 (+0000) Subject: Bug fix: bm_equal() now also works if the first argument contains one or more bitmap... X-Git-Tag: svn/VALGRIND_3_4_0~613 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=446364b77485db4044227b0fd81283ca35636a5e;p=thirdparty%2Fvalgrind.git Bug fix: bm_equal() now also works if the first argument contains one or more bitmap structures that are entirely zero. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8025 --- diff --git a/exp-drd/drd_bitmap.c b/exp-drd/drd_bitmap.c index 0927ea2f54..031337e1ab 100644 --- a/exp-drd/drd_bitmap.c +++ b/exp-drd/drd_bitmap.c @@ -231,6 +231,12 @@ void bm_access_load_8(struct bitmap* const bm, const Addr a1) bm_access_range(bm, a1, a1 + 8, eLoad); } +void bm_access_range_store(struct bitmap* const bm, + const Addr a1, const Addr a2) +{ + bm_access_range(bm, a1, a2, eStore); +} + void bm_access_store_1(struct bitmap* const bm, const Addr a1) { bm_access_aligned_store(bm, a1, 1); @@ -265,12 +271,6 @@ void bm_access_store_8(struct bitmap* const bm, const Addr a1) bm_access_range(bm, a1, a1 + 8, eStore); } -void bm_access_range_store(struct bitmap* const bm, - const Addr a1, const Addr a2) -{ - bm_access_range(bm, a1, a2, eStore); -} - Bool bm_has(const struct bitmap* const bm, const Addr a1, const Addr a2, const BmAccessTypeT access_type) { @@ -769,11 +769,18 @@ Bool bm_equal(struct bitmap* const lhs, const struct bitmap* const rhs) for ( ; (bm2l_ref = VG_(OSetGen_Next)(lhs->oset)) != 0; ) { - bm2l = bm2l_ref->bm2; + while (bm2l_ref + && (bm2l = bm2l_ref->bm2) + && bm2l + && ! bm_has_any_access(lhs, + bm2l->addr << ADDR0_BITS, + (bm2l->addr + 1) << ADDR0_BITS)) + { + bm2l_ref = VG_(OSetGen_Next)(lhs->oset); + } + if (bm2l_ref == 0) + break; tl_assert(bm2l); - tl_assert(bm_has_any_access(lhs, - bm2l->addr << ADDR0_BITS, - (bm2l->addr + 1) << ADDR0_BITS)); #if 0 VG_(message)(Vg_DebugMsg, "bm_equal: at 0x%lx", bm2l->addr << ADDR0_BITS); #endif