|
From: <sv...@va...> - 2009-06-04 09:59:32
|
Author: bart
Date: 2009-06-04 10:59:28 +0100 (Thu, 04 Jun 2009)
New Revision: 10243
Log:
Merged r10191 and r10242 from trunk: fixed a bug in DRD's malloc wrappers that caused 'start' messages to be printed for unrelated memory allocations with address tracing enabled.
Modified:
branches/VALGRIND_3_4_BRANCH/drd/drd_main.c
branches/VALGRIND_3_4_BRANCH/drd/drd_malloc_wrappers.c
branches/VALGRIND_3_4_BRANCH/drd/drd_malloc_wrappers.h
Modified: branches/VALGRIND_3_4_BRANCH/drd/drd_main.c
===================================================================
--- branches/VALGRIND_3_4_BRANCH/drd/drd_main.c 2009-06-04 09:57:54 UTC (rev 10242)
+++ branches/VALGRIND_3_4_BRANCH/drd/drd_main.c 2009-06-04 09:59:28 UTC (rev 10243)
@@ -452,7 +452,7 @@
static __inline__
void drd_start_using_mem(const Addr a1, const SizeT len)
{
- tl_assert(a1 < a1 + len);
+ tl_assert(a1 <= a1 + len);
if (UNLIKELY(drd_any_address_is_traced()))
{
Modified: branches/VALGRIND_3_4_BRANCH/drd/drd_malloc_wrappers.c
===================================================================
--- branches/VALGRIND_3_4_BRANCH/drd/drd_malloc_wrappers.c 2009-06-04 09:57:54 UTC (rev 10242)
+++ branches/VALGRIND_3_4_BRANCH/drd/drd_malloc_wrappers.c 2009-06-04 09:59:28 UTC (rev 10243)
@@ -100,8 +100,10 @@
return NULL;
}
if (is_zeroed) VG_(memset)((void*)p, 0, size);
- s_start_using_mem_callback(p, p + size, 0/*ec_uniq*/);
+ tl_assert(p <= p + size);
+ s_start_using_mem_callback(p, size, 0/*ec_uniq*/);
+
// Only update this stat if allocation succeeded.
cmalloc_bs_mallocd += size;
@@ -211,7 +213,7 @@
// Allocate a new chunk.
mc = create_DRD_Chunk(tid, a_new, new_size);
- s_start_using_mem_callback(a_new, a_new + new_size, 0/*ec_uniq*/);
+ s_start_using_mem_callback(a_new, new_size, 0/*ec_uniq*/);
}
else
{
Modified: branches/VALGRIND_3_4_BRANCH/drd/drd_malloc_wrappers.h
===================================================================
--- branches/VALGRIND_3_4_BRANCH/drd/drd_malloc_wrappers.h 2009-06-04 09:57:54 UTC (rev 10242)
+++ branches/VALGRIND_3_4_BRANCH/drd/drd_malloc_wrappers.h 2009-06-04 09:59:28 UTC (rev 10243)
@@ -30,8 +30,8 @@
#include "pub_tool_execontext.h" // ExeContext
-typedef void (*StartUsingMem)(const Addr a1, const Addr a2, UInt ec_uniq);
-typedef void (*StopUsingMem)(const Addr a1, const Addr a2);
+typedef void (*StartUsingMem)(const Addr a1, const SizeT len, UInt ec_uniq);
+typedef void (*StopUsingMem)(const Addr a1, const SizeT len);
void drd_register_malloc_wrappers(const StartUsingMem start_using_mem_callback,
|