xfree ((void *) key);
}
-void
+bool
addrmap_mutable::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
void *obj)
{
+ bool full_range = true;
splay_tree_node n, next;
void *prior_value;
n && addrmap_node_key (n) <= end_inclusive;
n = splay_tree_successor (addrmap_node_key (n)))
{
- if (! addrmap_node_value (n))
+ if (addrmap_node_value (n))
+ {
+ /* Already mapped. */
+ full_range = false;
+ }
+ else
addrmap_node_set_value (n, obj);
}
else
prior_value = addrmap_node_value (n);
}
+
+ return full_range;
}
check_addrmap_find (map, array, 0, 19, nullptr);
/* Insert address range into mutable addrmap. */
- map.set_empty (core_addr (&array[10]), core_addr (&array[12]), val1);
+ bool full_range_p
+ = map.set_empty (core_addr (&array[10]), core_addr (&array[12]), val1);
+ SELF_CHECK (full_range_p);
check_addrmap_find (map, array, 0, 9, nullptr);
check_addrmap_find (map, array, 10, 12, val1);
check_addrmap_find (map, array, 13, 19, nullptr);
check_addrmap_find (*map2, array, 14, 19, nullptr);
/* Insert partially overlapping address range into mutable addrmap. */
- map.set_empty (core_addr (&array[11]), core_addr (&array[13]), val2);
+ full_range_p
+ = map.set_empty (core_addr (&array[11]), core_addr (&array[13]), val2);
+ SELF_CHECK (!full_range_p);
check_addrmap_find (map, array, 0, 9, nullptr);
check_addrmap_find (map, array, 10, 12, val1);
check_addrmap_find (map, array, 13, 13, val2);
/* In the mutable address map MAP, associate the addresses from START
to END_INCLUSIVE that are currently associated with NULL with OBJ
instead. Addresses mapped to an object other than NULL are left
- unchanged.
+ unchanged. Return true if the full range is mapped to OBJ.
As the name suggests, END_INCLUSIVE is also mapped to OBJ. This
convention is unusual, but it allows callers to accurately specify
semantics than to provide an interface which allows it to be
implemented efficiently, but doesn't reveal too much of the
representation. */
- void set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
+ bool set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
void *obj);
/* Clear this addrmap. */