From: Bart Van Assche Date: Thu, 13 Mar 2008 19:10:06 +0000 (+0000) Subject: Made arguments of bitmap manipulating functions more uniform. X-Git-Tag: svn/VALGRIND_3_4_0~882 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ca789fe1928eab190b160b3f6b431e5215228de5;p=thirdparty%2Fvalgrind.git Made arguments of bitmap manipulating functions more uniform. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7674 --- diff --git a/exp-drd/drd_bitmap.c b/exp-drd/drd_bitmap.c index d0160e7350..61aca85267 100644 --- a/exp-drd/drd_bitmap.c +++ b/exp-drd/drd_bitmap.c @@ -147,25 +147,24 @@ void bm_access_4(struct bitmap* const bm, } /** - * Record an access of type access_type at addresses a .. a + size - 1 in + * Record an access of type access_type at addresses a1 .. a2 - 1 in * bitmap bm. */ void bm_access_range(struct bitmap* const bm, - const Addr a, - const SizeT size, + const Addr a1, const Addr a2, const BmAccessTypeT access_type) { tl_assert(bm); - tl_assert(size > 0); + tl_assert(a1 < a2); - if (size == 4) - bm_access_4(bm, a, access_type); - else if (size == 1) - bm_access_1(bm, a, access_type); + if (a2 - a1 == 4) + bm_access_4(bm, a1, access_type); + else if (a2 - a1 == 1) + bm_access_1(bm, a1, access_type); else { Addr b; - for (b = a; b != a + size; b++) + for (b = a1; b != a2; b++) { bm_access_1(bm, b, access_type); } @@ -614,8 +613,10 @@ void bm_test(void) for (i = 0; i < sizeof(s_args)/sizeof(s_args[0]); i++) { - bm_access_range(bm, s_args[i].address, - s_args[i].size, s_args[i].access_type); + bm_access_range(bm, + s_args[i].address, + s_args[i].address + s_args[i].size, + s_args[i].access_type); } VG_(printf)("Map contents -- should contain 10 addresses:\n"); diff --git a/exp-drd/drd_main.c b/exp-drd/drd_main.c index 8ad045f355..79d6aa4ef0 100644 --- a/exp-drd/drd_main.c +++ b/exp-drd/drd_main.c @@ -180,7 +180,7 @@ VG_REGPARM(2) void drd_trace_load(Addr addr, SizeT size) } #endif sg = thread_get_segment(thread_get_running_tid()); - bm_access_range(sg->bm, addr, size, eLoad); + bm_access_range(sg->bm, addr, addr + size, eLoad); if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eLoad) && ! drd_is_suppressed(addr, addr + size)) { @@ -230,7 +230,7 @@ VG_REGPARM(2) void drd_trace_store(Addr addr, SizeT size) } #endif sg = thread_get_segment(thread_get_running_tid()); - bm_access_range(sg->bm, addr, size, eStore); + bm_access_range(sg->bm, addr, addr + size, eStore); if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eStore) && ! drd_is_suppressed(addr, addr + size)) { diff --git a/exp-drd/drd_suppression.c b/exp-drd/drd_suppression.c index 71a4c608e7..6aab43aac2 100644 --- a/exp-drd/drd_suppression.c +++ b/exp-drd/drd_suppression.c @@ -62,7 +62,7 @@ void drd_start_suppression(const Addr a1, const Addr a2, tl_assert(a1 < a2); tl_assert(! drd_is_any_suppressed(a1, a2)); - bm_access_range(s_suppressed, a1, a2 - a1, eStore); + bm_access_range(s_suppressed, a1, a2, eStore); } void drd_finish_suppression(const Addr a1, const Addr a2) diff --git a/exp-drd/pub_drd_bitmap.h b/exp-drd/pub_drd_bitmap.h index b706657c32..2ac1c3772d 100644 --- a/exp-drd/pub_drd_bitmap.h +++ b/exp-drd/pub_drd_bitmap.h @@ -57,8 +57,7 @@ typedef enum { eLoad, eStore } BmAccessTypeT; struct bitmap* bm_new(void); void bm_delete(struct bitmap* const bm); void bm_access_range(struct bitmap* const bm, - const Addr address, - const SizeT size, + const Addr a1, const Addr a2, const BmAccessTypeT access_type); void bm_access_4(struct bitmap* const bm, const Addr address, @@ -96,8 +95,6 @@ void bm_report_races(ThreadId const tid1, ThreadId const tid2, void bm_print(const struct bitmap* bm); ULong bm_get_bitmap_creation_count(void); ULong bm_get_bitmap2_creation_count(void); -void bm_test(void); - #endif /* __DRD_BITMAP_H */