Reinstate Addrcheck. Some of the tests fail -- some of the leak ones
because the added VG_(find_root_memory)() is just a stub. And there's a
problem with overlap checking that I haven't worked out yet. Still it's a
start. The commit also brings Memcheck back into the build process,
although mc_main.c is entirely commented out at the moment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3352 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_memory.c b/coregrind/vg_memory.c
index f4a0a4d..2a05966 100644
--- a/coregrind/vg_memory.c
+++ b/coregrind/vg_memory.c
@@ -1173,6 +1173,33 @@
VG_(munmap)((void *)s->addr, s->len);
}
+/* We'll call any RW mmaped memory segment, within the client address
+ range, which isn't SF_CORE, a root. */
+void VG_(find_root_memory)(void (*add_rootrange)(Addr a, SizeT sz))
+{
+ //VG_(message)(Vg_UserMsg, "Warning: VG_(find_root_memory) -- doing nothing");
+ //VG_(message)(Vg_UserMsg, "leak checking probably won't work as a result");
+#if 0
+ Segment *s;
+
+ for(s = VG_(first_segment)(); s != NULL; s = VG_(next_segment)(s)) {
+ UInt flags = s->flags & (SF_SHARED|SF_MMAP|SF_VALGRIND|SF_CORE|SF_STACK|SF
+_DEVICE);
+ if (flags != SF_MMAP && flags != SF_STACK)
+ continue;
+ if ((s->prot & (VKI_PROT_READ|VKI_PROT_WRITE)) != (VKI_PROT_READ|VKI_PROT_
+WRITE))
+ continue;
+ if (!VG_(is_client_addr)(s->addr) ||
+ !VG_(is_client_addr)(s->addr+s->len))
+ continue;
+
+ (*add_rootrange)(s->addr, s->len);
+ }
+#endif
+}
+
+
/*--------------------------------------------------------------------*/
/*--- Querying memory layout ---*/
/*--------------------------------------------------------------------*/
@@ -1184,7 +1211,6 @@
Bool VG_(is_shadow_addr)(Addr a)
{
-vg_assert(0);
return a >= VG_(shadow_base) && a < VG_(shadow_end);
}