* addrmap.c (force_transition): Add new argument start. (addrmap_mutable_set_empty): Establish the end transition before the start transition. Index: addrmap.c =================================================================== RCS file: /cvs/src/src/gdb/addrmap.c,v retrieving revision 1.4 diff -u -p -r1.4 addrmap.c --- addrmap.c 1 Jan 2008 22:53:09 -0000 1.4 +++ addrmap.c 21 Oct 2008 03:42:19 -0000 @@ -291,18 +291,27 @@ addrmap_splay_tree_insert (struct addrma /* Without changing the mapping of any address, ensure that there is a tree node at ADDR, even if it would represent a "transition" from - one value to the same value. */ + one value to the same value. If START is non-zero, this is the + start transition of the address range. Otherwise, it's the end + transition. */ static void -force_transition (struct addrmap_mutable *this, CORE_ADDR addr) +force_transition (struct addrmap_mutable *this, CORE_ADDR addr, int start) { splay_tree_node n = addrmap_splay_tree_lookup (this, addr); if (! n) { - n = addrmap_splay_tree_predecessor (this, addr); - addrmap_splay_tree_insert (this, addr, - n ? addrmap_node_value (n) : NULL); + void *value; + + if (start) + value = NULL; + else + { + n = addrmap_splay_tree_predecessor (this, addr); + value = n ? addrmap_node_value (n) : NULL; + } + addrmap_splay_tree_insert (this, addr, value); } } @@ -328,10 +337,16 @@ addrmap_mutable_set_empty (struct addrma - First pass: change all NULL regions to OBJ. - Second pass: remove any unnecessary transitions. */ - /* Establish transitions at the start and end. */ - force_transition (map, start); + /* Establish transitions at the start and end. The end transition + is established first such that its value will be initialized as + same as the value of its predecessor. The value of the start + transition will always be initialized to NULL. With this + establishing order, the value of these transitions will be set + properly later even if the given address range is embedded in + another address range. */ if (end_inclusive < CORE_ADDR_MAX) - force_transition (map, end_inclusive + 1); + force_transition (map, end_inclusive + 1, 0); + force_transition (map, start, 1); /* Walk the area, changing all NULL regions to OBJ. */ for (n = addrmap_splay_tree_lookup (map, start), gdb_assert (n);