aboutsummaryrefslogtreecommitdiff
path: root/gdb/addrmap.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-04-16 09:30:53 -0600
committerTom Tromey <tom@tromey.com>2022-06-12 10:49:48 -0600
commit769520b7e5c3a6a941969b3b3c52fa04edf73295 (patch)
tree9e86b7d6c019e902852c089f5ca25cf42dfe8bdf /gdb/addrmap.c
parent1b3261edfb7b0c66f538c778a07f0bf2547c906d (diff)
downloadgdb-769520b7e5c3a6a941969b3b3c52fa04edf73295.zip
gdb-769520b7e5c3a6a941969b3b3c52fa04edf73295.tar.gz
gdb-769520b7e5c3a6a941969b3b3c52fa04edf73295.tar.bz2
Remove addrmap wrapper functions
This removes the various addrmap wrapper functions in favor of simple method calls on the objects themselves.
Diffstat (limited to 'gdb/addrmap.c')
-rw-r--r--gdb/addrmap.c60
1 files changed, 10 insertions, 50 deletions
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index eddf084..b9a7871 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -28,44 +28,6 @@ gdb_static_assert (sizeof (splay_tree_key) >= sizeof (CORE_ADDR *));
gdb_static_assert (sizeof (splay_tree_value) >= sizeof (void *));
-void
-addrmap_set_empty (struct addrmap *map,
- CORE_ADDR start, CORE_ADDR end_inclusive,
- void *obj)
-{
- map->set_empty (start, end_inclusive, obj);
-}
-
-
-void *
-addrmap_find (const addrmap *map, CORE_ADDR addr)
-{
- return map->find (addr);
-}
-
-
-struct addrmap *
-addrmap_create_fixed (struct addrmap *original, struct obstack *obstack)
-{
- return original->create_fixed (obstack);
-}
-
-
-/* Relocate all the addresses in MAP by OFFSET. (This can be applied
- to either mutable or immutable maps.) */
-void
-addrmap_relocate (struct addrmap *map, CORE_ADDR offset)
-{
- map->relocate (offset);
-}
-
-
-int
-addrmap_foreach (struct addrmap *map, addrmap_foreach_fn fn)
-{
- return map->foreach (fn);
-}
-
/* Fixed address maps. */
void
@@ -313,7 +275,7 @@ addrmap_fixed::addrmap_fixed (struct obstack *obstack, addrmap_mutable *mut)
size_t transition_count = 0;
/* Count the number of transitions in the tree. */
- addrmap_foreach (mut, [&] (CORE_ADDR start, void *obj)
+ mut->foreach ([&] (CORE_ADDR start, void *obj)
{
++transition_count;
return 0;
@@ -331,7 +293,7 @@ addrmap_fixed::addrmap_fixed (struct obstack *obstack, addrmap_mutable *mut)
/* Copy all entries from the splay tree to the array, in order
of increasing address. */
- addrmap_foreach (mut, [&] (CORE_ADDR start, void *obj)
+ mut->foreach ([&] (CORE_ADDR start, void *obj)
{
transitions[num_transitions].addr = start;
transitions[num_transitions].value = obj;
@@ -482,7 +444,7 @@ addrmap_dump (struct addrmap *map, struct ui_file *outfile, void *payload)
return 0;
};
- addrmap_foreach (map, callback);
+ map->foreach (callback);
}
#if GDB_SELF_TEST
@@ -502,7 +464,7 @@ core_addr (void *p)
do \
{ \
for (unsigned i = LOW; i <= HIGH; ++i) \
- SELF_CHECK (addrmap_find (MAP, core_addr (&ARRAY[i])) == VAL); \
+ SELF_CHECK (MAP->find (core_addr (&ARRAY[i])) == VAL); \
} \
while (0)
@@ -528,14 +490,13 @@ test_addrmap ()
CHECK_ADDRMAP_FIND (map, array, 0, 19, nullptr);
/* Insert address range into mutable addrmap. */
- addrmap_set_empty (map, core_addr (&array[10]), core_addr (&array[12]),
- val1);
+ map->set_empty (core_addr (&array[10]), core_addr (&array[12]), val1);
CHECK_ADDRMAP_FIND (map, array, 0, 9, nullptr);
CHECK_ADDRMAP_FIND (map, array, 10, 12, val1);
CHECK_ADDRMAP_FIND (map, array, 13, 19, nullptr);
/* Create corresponding fixed addrmap. */
- struct addrmap *map2 = addrmap_create_fixed (map, &temp_obstack);
+ struct addrmap *map2 = map->create_fixed (&temp_obstack);
SELF_CHECK (map2 != nullptr);
CHECK_ADDRMAP_FIND (map2, array, 0, 9, nullptr);
CHECK_ADDRMAP_FIND (map2, array, 10, 12, val1);
@@ -554,18 +515,17 @@ test_addrmap ()
SELF_CHECK (false);
return 0;
};
- SELF_CHECK (addrmap_foreach (map, callback) == 0);
- SELF_CHECK (addrmap_foreach (map2, callback) == 0);
+ SELF_CHECK (map->foreach (callback) == 0);
+ SELF_CHECK (map2->foreach (callback) == 0);
/* Relocate fixed addrmap. */
- addrmap_relocate (map2, 1);
+ map2->relocate (1);
CHECK_ADDRMAP_FIND (map2, array, 0, 10, nullptr);
CHECK_ADDRMAP_FIND (map2, array, 11, 13, val1);
CHECK_ADDRMAP_FIND (map2, array, 14, 19, nullptr);
/* Insert partially overlapping address range into mutable addrmap. */
- addrmap_set_empty (map, core_addr (&array[11]), core_addr (&array[13]),
- val2);
+ map->set_empty (core_addr (&array[11]), core_addr (&array[13]), val2);
CHECK_ADDRMAP_FIND (map, array, 0, 9, nullptr);
CHECK_ADDRMAP_FIND (map, array, 10, 12, val1);
CHECK_ADDRMAP_FIND (map, array, 13, 13, val2);