diff options
author | Tom Tromey <tromey@redhat.com> | 2013-10-14 19:53:29 -0600 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-02-26 12:11:17 -0700 |
commit | 3b7344d5ab495cd82b6c72ec5e00d018549837fb (patch) | |
tree | 8e65c5643f90252376345c8deed27dda11b133e7 /gdb/solib-som.c | |
parent | 40c1a0073715c1e3f93afc83edac8396eb362a98 (diff) | |
download | gdb-3b7344d5ab495cd82b6c72ec5e00d018549837fb.zip gdb-3b7344d5ab495cd82b6c72ec5e00d018549837fb.tar.gz gdb-3b7344d5ab495cd82b6c72ec5e00d018549837fb.tar.bz2 |
use bound_minsym as result for lookup_minimal_symbol et al
This patch changes a few minimal symbol lookup functions to return a
bound_minimal_symbol rather than a pointer to the minsym. This change
helps prepare gdb for computing a minimal symbol's address at the
point of use.
Note that this changes even those functions that ostensibly search a
single objfile. That was necessary because, in fact, those functions
can search an objfile and its separate debug objfiles; and it is
important for the caller to know in which objfile the minimal symbol
was actually found.
The bulk of this patch is mechanical.
2014-02-26 Tom Tromey <tromey@redhat.com>
* ada-lang.c (ada_update_initial_language): Update.
(ada_main_name, ada_has_this_exception_support): Update.
* ada-tasks.c (ada_tasks_inferior_data_sniffer): Update.
* aix-thread.c (pdc_symbol_addrs, pd_enable): Update.
* arm-tdep.c (arm_skip_stub): Update.
* auxv.c (ld_so_xfer_auxv): Update.
* avr-tdep.c (avr_scan_prologue): Update.
* ax-gdb.c (gen_var_ref): Update.
* breakpoint.c (struct breakpoint_objfile_data)
<overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change
type to bound_minimal_symbol.
(create_overlay_event_breakpoint)
(create_longjmp_master_breakpoint)
(create_std_terminate_master_breakpoint)
(create_exception_master_breakpoint): Update.
* bsd-uthread.c (bsd_uthread_lookup_address): Update.
* c-exp.y (classify_name): Update.
* coffread.c (coff_symfile_read): Update.
* common/agent.c (agent_look_up_symbols): Update.
* d-lang.c (d_main_name): Update.
* dbxread.c (find_stab_function_addr, end_psymtab): Update.
* dec-thread.c (enable_dec_thread): Update.
* dwarf2loc.c (call_site_to_target_addr): Update.
* elfread.c (elf_gnu_ifunc_resolve_by_got): Update.
* eval.c (evaluate_subexp_standard): Update.
* findvar.c (struct minsym_lookup_data) <result>: Change type
to bound_minimal_symbol.
<objfile>: Remove.
(minsym_lookup_iterator_cb, default_read_var_value): Update.
* frame.c (inside_main_func): Update.
* frv-tdep.c (frv_frame_this_id): Update.
* gcore.c (call_target_sbrk): Update.
* glibc-tdep.c (glibc_skip_solib_resolver): Update.
* gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline):
Update.
* go-lang.c (go_main_name): Update.
* hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code)
(hppa_hpux_find_import_stub_for_addr): Update.
* hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol):
Update. Change return type.
* hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return
type.
* jit.c (jit_breakpoint_re_set_internal): Update.
* linux-fork.c (inferior_call_waitpid, checkpoint_command):
Update.
* linux-nat.c (get_signo): Update.
* linux-thread-db.c (inferior_has_bug): Update
* m32c-tdep.c (m32c_return_value)
(m32c_m16c_address_to_pointer): Update.
* m32r-tdep.c (m32r_frame_this_id): Update.
* m68hc11-tdep.c (m68hc11_get_register_info): Update.
* machoread.c (macho_resolve_oso_sym_with_minsym): Update.
* minsyms.c (lookup_minimal_symbol_internal): Rename to
lookup_minimal_symbol. Change return type.
(lookup_minimal_symbol): Remove.
(lookup_bound_minimal_symbol): Update.
(lookup_minimal_symbol_text): Change return type.
(lookup_minimal_symbol_solib_trampoline): Change return type.
* minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text)
(lookup_minimal_symbol_solib_trampoline): Change return type.
* mips-linux-tdep.c (mips_linux_skip_resolver): Update.
* objc-lang.c (lookup_objc_class, lookup_child_selector)
(value_nsstring, find_imps): Update.
* obsd-tdep.c (obsd_skip_solib_resolver): Update.
* p-lang.c (pascal_main_name): Update.
* ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update.
* ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update.
* proc-service.c (ps_pglobal_lookup): Update.
* ravenscar-thread.c (get_running_thread_msymbol): Change
return type.
(has_ravenscar_runtime, get_running_thread_id): Update.
* remote.c (remote_check_symbols): Update.
* sol-thread.c (ps_pglobal_lookup): Update.
* sol2-tdep.c (sol2_skip_solib_resolver): Update.
* solib-dsbt.c (lm_base): Update.
* solib-frv.c (lm_base, frv_relocate_section_addresses):
Update.
* solib-irix.c (locate_base): Update.
* solib-som.c (som_solib_create_inferior_hook)
(som_solib_desire_dynamic_linker_symbols, link_map_start):
Update.
* solib-spu.c (spu_enable_break): Update.
* solib-svr4.c (elf_locate_base, enable_break): Update.
* spu-tdep.c (spu_get_overlay_table, spu_catch_start)
(flush_ea_cache): Update.
* stabsread.c (define_symbol): Update.
* symfile.c (simple_read_overlay_table): Update.
* symtab.c (find_pc_sect_line): Update.
* tracepoint.c (scope_info): Update.
* tui-disasm.c (tui_get_begin_asm_address): Update.
* value.c (value_static_field): Update.
Diffstat (limited to 'gdb/solib-som.c')
-rw-r--r-- | gdb/solib-som.c | 79 |
1 files changed, 41 insertions, 38 deletions
diff --git a/gdb/solib-som.c b/gdb/solib-som.c index dd2d8f7..d9e4119 100644 --- a/gdb/solib-som.c +++ b/gdb/solib-som.c @@ -186,7 +186,7 @@ static void som_solib_create_inferior_hook (int from_tty) { enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - struct minimal_symbol *msymbol; + struct bound_minimal_symbol msymbol; unsigned int dld_flags, status, have_endo; asection *shlib_info; gdb_byte buf[4]; @@ -216,10 +216,10 @@ som_solib_create_inferior_hook (int from_tty) annoyance to users of modern systems and foul up the testsuite as well. As a result, the warnings have been disabled. */ msymbol = lookup_minimal_symbol ("__d_pid", NULL, symfile_objfile); - if (msymbol == NULL) + if (msymbol.minsym == NULL) goto keep_going; - anaddr = MSYMBOL_VALUE_ADDRESS (msymbol); + anaddr = MSYMBOL_VALUE_ADDRESS (msymbol.minsym); store_unsigned_integer (buf, 4, byte_order, ptid_get_pid (inferior_ptid)); status = target_write_memory (anaddr, buf, 4); if (status != 0) @@ -241,9 +241,9 @@ GDB will be unable to track shl_load/shl_unload calls")); We'll look first for the old flavor and then the new. */ msymbol = lookup_minimal_symbol ("_DLD_HOOK", NULL, symfile_objfile); - if (msymbol == NULL) + if (msymbol.minsym == NULL) msymbol = lookup_minimal_symbol ("__d_trap", NULL, symfile_objfile); - if (msymbol == NULL) + if (msymbol.minsym == NULL) { warning (_("\ Unable to find _DLD_HOOK symbol in object file.\n\ @@ -251,22 +251,23 @@ Suggest linking with /opt/langtools/lib/end.o.\n\ GDB will be unable to track shl_load/shl_unload calls")); goto keep_going; } - anaddr = MSYMBOL_VALUE_ADDRESS (msymbol); + anaddr = MSYMBOL_VALUE_ADDRESS (msymbol.minsym); dld_cache.hook.address = anaddr; /* Grrr, this might not be an export symbol! We have to find the export stub. */ - msymbol = hppa_lookup_stub_minimal_symbol (MSYMBOL_LINKAGE_NAME (msymbol), - EXPORT); - if (msymbol != NULL) + msymbol + = hppa_lookup_stub_minimal_symbol (MSYMBOL_LINKAGE_NAME (msymbol.minsym), + EXPORT); + if (msymbol.minsym != NULL) { - anaddr = MSYMBOL_VALUE (msymbol); + anaddr = MSYMBOL_VALUE (msymbol.minsym); dld_cache.hook_stub.address = anaddr; } store_unsigned_integer (buf, 4, byte_order, anaddr); msymbol = lookup_minimal_symbol ("__dld_hook", NULL, symfile_objfile); - if (msymbol == NULL) + if (msymbol.minsym == NULL) { warning (_("\ Unable to find __dld_hook symbol in object file.\n\ @@ -274,13 +275,13 @@ Suggest linking with /opt/langtools/lib/end.o.\n\ GDB will be unable to track shl_load/shl_unload calls")); goto keep_going; } - anaddr = MSYMBOL_VALUE_ADDRESS (msymbol); + anaddr = MSYMBOL_VALUE_ADDRESS (msymbol.minsym); status = target_write_memory (anaddr, buf, 4); /* Now set a shlib_event breakpoint at __d_trap so we can track significant shared library events. */ msymbol = lookup_minimal_symbol ("__d_trap", NULL, symfile_objfile); - if (msymbol == NULL) + if (msymbol.minsym == NULL) { warning (_("\ Unable to find __dld_d_trap symbol in object file.\n\ @@ -289,7 +290,7 @@ GDB will be unable to track shl_load/shl_unload calls")); goto keep_going; } create_solib_event_breakpoint (target_gdbarch (), - MSYMBOL_VALUE_ADDRESS (msymbol)); + MSYMBOL_VALUE_ADDRESS (msymbol.minsym)); /* We have all the support usually found in end.o, so we can track shl_load and shl_unload calls. */ @@ -300,12 +301,12 @@ keep_going: /* Get the address of __dld_flags, if no such symbol exists, then we can not debug the shared code. */ msymbol = lookup_minimal_symbol ("__dld_flags", NULL, NULL); - if (msymbol == NULL) + if (msymbol.minsym == NULL) { error (_("Unable to find __dld_flags symbol in object file.")); } - anaddr = MSYMBOL_VALUE_ADDRESS (msymbol); + anaddr = MSYMBOL_VALUE_ADDRESS (msymbol.minsym); /* Read the current contents. */ status = target_read_memory (anaddr, buf, 4); @@ -347,10 +348,10 @@ manpage for methods to privately map shared library text.")); loaded at startup time (what a crock). */ msymbol = lookup_minimal_symbol ("_start", NULL, symfile_objfile); - if (msymbol == NULL) + if (msymbol.minsym == NULL) error (_("Unable to find _start symbol in object file.")); - anaddr = MSYMBOL_VALUE_ADDRESS (msymbol); + anaddr = MSYMBOL_VALUE_ADDRESS (msymbol.minsym); /* Make the breakpoint at "_start" a shared library event breakpoint. */ create_solib_event_breakpoint (target_gdbarch (), anaddr); @@ -368,7 +369,7 @@ som_solib_desire_dynamic_linker_symbols (void) { struct objfile *objfile; struct unwind_table_entry *u; - struct minimal_symbol *dld_msymbol; + struct bound_minimal_symbol dld_msymbol; /* Do we already know the value of these symbols? If so, then we've no work to do. @@ -382,31 +383,32 @@ som_solib_desire_dynamic_linker_symbols (void) ALL_OBJFILES (objfile) { dld_msymbol = lookup_minimal_symbol ("shl_load", NULL, objfile); - if (dld_msymbol != NULL) + if (dld_msymbol.minsym != NULL) { - dld_cache.load.address = MSYMBOL_VALUE (dld_msymbol); + dld_cache.load.address = MSYMBOL_VALUE (dld_msymbol.minsym); dld_cache.load.unwind = find_unwind_entry (dld_cache.load.address); } dld_msymbol = lookup_minimal_symbol_solib_trampoline ("shl_load", objfile); - if (dld_msymbol != NULL) + if (dld_msymbol.minsym != NULL) { - if (MSYMBOL_TYPE (dld_msymbol) == mst_solib_trampoline) + if (MSYMBOL_TYPE (dld_msymbol.minsym) == mst_solib_trampoline) { - u = find_unwind_entry (MSYMBOL_VALUE (dld_msymbol)); + u = find_unwind_entry (MSYMBOL_VALUE (dld_msymbol.minsym)); if ((u != NULL) && (u->stub_unwind.stub_type == EXPORT)) { - dld_cache.load_stub.address = MSYMBOL_VALUE (dld_msymbol); + dld_cache.load_stub.address + = MSYMBOL_VALUE (dld_msymbol.minsym); dld_cache.load_stub.unwind = u; } } } dld_msymbol = lookup_minimal_symbol ("shl_unload", NULL, objfile); - if (dld_msymbol != NULL) + if (dld_msymbol.minsym != NULL) { - dld_cache.unload.address = MSYMBOL_VALUE (dld_msymbol); + dld_cache.unload.address = MSYMBOL_VALUE (dld_msymbol.minsym); dld_cache.unload.unwind = find_unwind_entry (dld_cache.unload.address); /* ??rehrauer: I'm not sure exactly what this is, but it appears @@ -429,14 +431,15 @@ som_solib_desire_dynamic_linker_symbols (void) dld_msymbol = lookup_minimal_symbol_solib_trampoline ("shl_unload", objfile); - if (dld_msymbol != NULL) + if (dld_msymbol.minsym != NULL) { - if (MSYMBOL_TYPE (dld_msymbol) == mst_solib_trampoline) + if (MSYMBOL_TYPE (dld_msymbol.minsym) == mst_solib_trampoline) { - u = find_unwind_entry (MSYMBOL_VALUE (dld_msymbol)); + u = find_unwind_entry (MSYMBOL_VALUE (dld_msymbol.minsym)); if ((u != NULL) && (u->stub_unwind.stub_type == EXPORT)) { - dld_cache.unload_stub.address = MSYMBOL_VALUE (dld_msymbol); + dld_cache.unload_stub.address + = MSYMBOL_VALUE (dld_msymbol.minsym); dld_cache.unload_stub.unwind = u; } } @@ -526,35 +529,35 @@ static CORE_ADDR link_map_start (void) { enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - struct minimal_symbol *sym; + struct bound_minimal_symbol sym; CORE_ADDR addr; gdb_byte buf[4]; unsigned int dld_flags; sym = lookup_minimal_symbol ("__dld_flags", NULL, NULL); - if (!sym) + if (!sym.minsym) error (_("Unable to find __dld_flags symbol in object file.")); - addr = MSYMBOL_VALUE_ADDRESS (sym); + addr = MSYMBOL_VALUE_ADDRESS (sym.minsym); read_memory (addr, buf, 4); dld_flags = extract_unsigned_integer (buf, 4, byte_order); if ((dld_flags & DLD_FLAGS_LISTVALID) == 0) error (_("__dld_list is not valid according to __dld_flags.")); sym = lookup_minimal_symbol ("__dld_list", NULL, NULL); - if (!sym) + if (!sym.minsym) { /* Older crt0.o files (hpux8) don't have __dld_list as a symbol, but the data is still available if you know where to look. */ sym = lookup_minimal_symbol ("__dld_flags", NULL, NULL); - if (!sym) + if (!sym.minsym) { error (_("Unable to find dynamic library list.")); return 0; } - addr = MSYMBOL_VALUE_ADDRESS (sym) - 8; + addr = MSYMBOL_VALUE_ADDRESS (sym.minsym) - 8; } else - addr = MSYMBOL_VALUE_ADDRESS (sym); + addr = MSYMBOL_VALUE_ADDRESS (sym.minsym); read_memory (addr, buf, 4); addr = extract_unsigned_integer (buf, 4, byte_order); |