Major rewrite of the machinery which keeps track of segments:

* remove initialisation-time circularities by not using the
  skiplist mechanism and therefore not using any dynamically
  allocated memory in support of this mechanism

* Add comments about how it works (it is pretty opaque) so as
  to help future maintainers/bug-fixers

It only just works and many things are still broken.  That should
improve rapidly however.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3242 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/core.h b/coregrind/core.h
index ad0ecc0..a389f90 100644
--- a/coregrind/core.h
+++ b/coregrind/core.h
@@ -1300,7 +1300,17 @@
 extern void VG_(mprotect_range)(Addr addr, SizeT len, UInt prot);
 extern Addr VG_(find_map_space)(Addr base, SizeT len, Bool for_client);
 
+/* Find the segment containing a, or NULL if none. */
 extern Segment *VG_(find_segment)(Addr a);
+
+/* a is an unmapped address (is checked).  Find the next segment 
+   along in the address space, or NULL if none. */
+extern Segment *VG_(find_segment_above_unmapped)(Addr a);
+
+/* a is a mapped address (in a segment, is checked).  Find the
+   next segment along. */
+extern Segment *VG_(find_segment_above_mapped)(Addr a);
+
 extern Segment *VG_(first_segment)(void);
 extern Segment *VG_(next_segment)(Segment *);