diff options
Diffstat (limited to 'gdb/solib-darwin.c')
-rw-r--r-- | gdb/solib-darwin.c | 51 |
1 files changed, 10 insertions, 41 deletions
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index 6c7d906..4003c77 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -1,6 +1,6 @@ /* Handle Darwin shared libraries for GDB, the GNU Debugger. - Copyright (C) 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2009-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -27,7 +27,7 @@ #include "regcache.h" #include "gdb_bfd.h" -#include "solist.h" +#include "solib.h" #include "solib-darwin.h" #include "mach-o.h" @@ -133,7 +133,7 @@ darwin_load_image_infos (struct darwin_info *info) (buf + 8 + ptr_type->length (), ptr_type); } -/* Link map info to include in an allocated so_list entry. */ +/* Link map info to include in an allocated solib entry. */ struct lm_info_darwin final : public lm_info { @@ -146,24 +146,13 @@ struct lm_info_darwin final : public lm_info static CORE_ADDR lookup_symbol_from_bfd (bfd *abfd, const char *symname) { - long storage_needed; - asymbol **symbol_table; - unsigned int number_of_symbols; - unsigned int i; CORE_ADDR symaddr = 0; - storage_needed = bfd_get_symtab_upper_bound (abfd); + gdb::array_view<asymbol *> symbol_table + = gdb_bfd_canonicalize_symtab (abfd, false); - if (storage_needed <= 0) - return 0; - - symbol_table = (asymbol **) xmalloc (storage_needed); - number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table); - - for (i = 0; i < number_of_symbols; i++) + for (const asymbol *sym : symbol_table) { - asymbol *sym = symbol_table[i]; - if (strcmp (sym->name, symname) == 0 && (sym->section->flags & (SEC_CODE | SEC_DATA)) != 0) { @@ -172,7 +161,6 @@ lookup_symbol_from_bfd (bfd *abfd, const char *symname) break; } } - xfree (symbol_table); return symaddr; } @@ -200,16 +188,6 @@ find_program_interpreter (void) return buf; } -/* Not used. I don't see how the main symbol file can be found: the - interpreter name is needed and it is known from the executable file. - Note that darwin-nat.c implements pid_to_exec_file. */ - -static int -open_symbol_file_object (int from_tty) -{ - return 0; -} - /* Build a list of currently loaded shared objects. See solib-svr4.c. */ static owning_intrusive_list<solib> @@ -276,8 +254,8 @@ darwin_current_sos () auto li = std::make_unique<lm_info_darwin> (); - newobj.so_name = file_path.get (); - newobj.so_original_name = newobj.so_name; + newobj.name = file_path.get (); + newobj.original_name = newobj.name; li->lm_addr = load_addr; newobj.lm_info = std::move (li); @@ -375,15 +353,6 @@ darwin_read_exec_load_addr_at_init (struct darwin_info *info) return darwin_validate_exec_header (load_addr); } -/* Return 1 if PC lies in the dynamic symbol resolution code of the - run time loader. */ - -static int -darwin_in_dynsym_resolve_code (CORE_ADDR pc) -{ - return 0; -} - /* A wrapper for bfd_mach_o_fat_extract that handles reference counting properly. This will either return NULL, or return a new reference to a BFD. */ @@ -661,8 +630,8 @@ const solib_ops darwin_so_ops = darwin_clear_solib, darwin_solib_create_inferior_hook, darwin_current_sos, - open_symbol_file_object, - darwin_in_dynsym_resolve_code, + nullptr, + nullptr, darwin_bfd_open, nullptr, nullptr, |