From 328d42d87e97c75d6e52800bfd4bc1bfdfb745d2 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 24 Mar 2021 18:08:12 -0400 Subject: gdb: remove current_top_target function The current_top_target function is a hidden dependency on the current inferior. Since I'd like to slowly move towards reducing our dependency on the global current state, remove this function and make callers use current_inferior ()->top_target () There is no expected change in behavior, but this one step towards making those callers use the inferior from their context, rather than refer to the global current inferior. gdb/ChangeLog: * target.h (current_top_target): Remove, make callers use the current inferior instead. * target.c (current_top_target): Remove. Change-Id: Iccd457036f84466cdaa3865aa3f9339a24ea001d --- gdb/elfread.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gdb/elfread.c') diff --git a/gdb/elfread.c b/gdb/elfread.c index 8510087..49bbbec 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -863,8 +863,8 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p) if (target_read_memory (pointer_address, buf, ptr_size) != 0) continue; addr = extract_typed_address (buf, ptr_type); - addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, - current_top_target ()); + addr = gdbarch_convert_from_func_ptr_addr + (gdbarch, addr, current_inferior ()->top_target ()); addr = gdbarch_addr_bits_remove (gdbarch, addr); if (elf_gnu_ifunc_record_cache (name, addr)) @@ -931,12 +931,13 @@ elf_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc) parameter. FUNCTION is the function entry address. ADDRESS may be a function descriptor. */ - target_auxv_search (current_top_target (), AT_HWCAP, &hwcap); + target_auxv_search (current_inferior ()->top_target (), AT_HWCAP, &hwcap); hwcap_val = value_from_longest (builtin_type (gdbarch) ->builtin_unsigned_long, hwcap); address_val = call_function_by_hand (function, NULL, hwcap_val); address = value_as_address (address_val); - address = gdbarch_convert_from_func_ptr_addr (gdbarch, address, current_top_target ()); + address = gdbarch_convert_from_func_ptr_addr + (gdbarch, address, current_inferior ()->top_target ()); address = gdbarch_addr_bits_remove (gdbarch, address); if (name_at_pc) @@ -1042,9 +1043,8 @@ elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b) gdbarch_return_value (gdbarch, func_func, value_type, regcache, value_contents_raw (value), NULL); resolved_address = value_as_address (value); - resolved_pc = gdbarch_convert_from_func_ptr_addr (gdbarch, - resolved_address, - current_top_target ()); + resolved_pc = gdbarch_convert_from_func_ptr_addr + (gdbarch, resolved_address, current_inferior ()->top_target ()); resolved_pc = gdbarch_addr_bits_remove (gdbarch, resolved_pc); gdb_assert (current_program_space == b->pspace || b->pspace == NULL); -- cgit v1.1