diff options
63 files changed, 484 insertions, 375 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0f44e5c..40b819b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,99 @@ 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. + +2014-02-26 Tom Tromey <tromey@redhat.com> + * minsyms.c (prim_record_minimal_symbol_full): Use SET_MSYMBOL_VALUE_ADDRESS. * objfiles.c (objfile_relocate1): Use SET_MSYMBOL_VALUE_ADDRESS. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 3751869..baa5d8c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -894,7 +894,7 @@ enum language ada_update_initial_language (enum language lang) { if (lookup_minimal_symbol ("adainit", (const char *) NULL, - (struct objfile *) NULL) != NULL) + (struct objfile *) NULL).minsym != NULL) return language_ada; return lang; @@ -907,7 +907,7 @@ ada_update_initial_language (enum language lang) char * ada_main_name (void) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; static char *main_program_name = NULL; /* For Ada, the name of the main procedure is stored in a specific @@ -917,12 +917,12 @@ ada_main_name (void) in Ada. */ msym = lookup_minimal_symbol (ADA_MAIN_PROGRAM_SYMBOL_NAME, NULL, NULL); - if (msym != NULL) + if (msym.minsym != NULL) { CORE_ADDR main_program_name_addr; int err_code; - main_program_name_addr = MSYMBOL_VALUE_ADDRESS (msym); + main_program_name_addr = MSYMBOL_VALUE_ADDRESS (msym.minsym); if (main_program_name_addr == 0) error (_("Invalid address for Ada main program name.")); @@ -11317,10 +11317,10 @@ ada_has_this_exception_support (const struct exception_support_info *einfo) the name of the exception being raised (this name is printed in the catchpoint message, and is also used when trying to catch a specific exception). We do not handle this case for now. */ - struct minimal_symbol *msym + struct bound_minimal_symbol msym = lookup_minimal_symbol (einfo->catch_exception_sym, NULL, NULL); - if (msym && MSYMBOL_TYPE (msym) != mst_solib_trampoline) + if (msym.minsym && MSYMBOL_TYPE (msym.minsym) != mst_solib_trampoline) error (_("Your Ada runtime appears to be missing some debugging " "information.\nCannot insert Ada exception catchpoint " "in this configuration.")); diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index fc562e7..89bdac8 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -846,7 +846,7 @@ read_known_tasks_list (struct ada_tasks_inferior_data *data) static void ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; struct symbol *sym; /* Return now if already set. */ @@ -856,10 +856,10 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) /* Try array. */ msym = lookup_minimal_symbol (KNOWN_TASKS_NAME, NULL, NULL); - if (msym != NULL) + if (msym.minsym != NULL) { data->known_tasks_kind = ADA_TASKS_ARRAY; - data->known_tasks_addr = MSYMBOL_VALUE_ADDRESS (msym); + data->known_tasks_addr = MSYMBOL_VALUE_ADDRESS (msym.minsym); /* Try to get pointer type and array length from the symtab. */ sym = lookup_symbol_in_language (KNOWN_TASKS_NAME, NULL, VAR_DOMAIN, @@ -901,10 +901,10 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) /* Try list. */ msym = lookup_minimal_symbol (KNOWN_TASKS_LIST, NULL, NULL); - if (msym != NULL) + if (msym.minsym != NULL) { data->known_tasks_kind = ADA_TASKS_LIST; - data->known_tasks_addr = MSYMBOL_VALUE_ADDRESS (msym); + data->known_tasks_addr = MSYMBOL_VALUE_ADDRESS (msym.minsym); data->known_tasks_length = 1; sym = lookup_symbol_in_language (KNOWN_TASKS_LIST, NULL, VAR_DOMAIN, diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index d1194bc..0202a24 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -286,7 +286,7 @@ pid_to_prc (ptid_t *ptidp) static int pdc_symbol_addrs (pthdb_user_t user, pthdb_symbol_t *symbols, int count) { - struct minimal_symbol *ms; + struct bound_minimal_symbol ms; int i; char *name; @@ -306,13 +306,14 @@ pdc_symbol_addrs (pthdb_user_t user, pthdb_symbol_t *symbols, int count) symbols[i].addr = 0; else { - if (!(ms = lookup_minimal_symbol (name, NULL, NULL))) + ms = lookup_minimal_symbol (name, NULL, NULL); + if (ms.minsym == NULL) { if (debug_aix_thread) fprintf_unfiltered (gdb_stdlog, " returning PDC_FAILURE\n"); return PDC_FAILURE; } - symbols[i].addr = MSYMBOL_VALUE_ADDRESS (ms); + symbols[i].addr = MSYMBOL_VALUE_ADDRESS (ms.minsym); } if (debug_aix_thread) fprintf_unfiltered (gdb_stdlog, " symbols[%d].addr = %s\n", @@ -890,7 +891,7 @@ pd_enable (void) { int status; char *stub_name; - struct minimal_symbol *ms; + struct bound_minimal_symbol ms; /* Don't initialize twice. */ if (pd_able) @@ -908,9 +909,10 @@ pd_enable (void) return; /* Set a breakpoint on the returned stub function. */ - if (!(ms = lookup_minimal_symbol (stub_name, NULL, NULL))) + ms = lookup_minimal_symbol (stub_name, NULL, NULL); + if (ms.minsym == NULL) return; - pd_brk_addr = MSYMBOL_VALUE_ADDRESS (ms); + pd_brk_addr = MSYMBOL_VALUE_ADDRESS (ms.minsym); if (!create_thread_event_breakpoint (target_gdbarch (), pd_brk_addr)) return; diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 558388d..4df2846 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9263,7 +9263,7 @@ arm_skip_stub (struct frame_info *frame, CORE_ADDR pc) { char *target_name; int target_len = namelen - 2; - struct minimal_symbol *minsym; + struct bound_minimal_symbol minsym; struct objfile *objfile; struct obj_section *sec; @@ -9279,8 +9279,8 @@ arm_skip_stub (struct frame_info *frame, CORE_ADDR pc) sec = find_pc_section (pc); objfile = (sec == NULL) ? NULL : sec->objfile; minsym = lookup_minimal_symbol (target_name, NULL, objfile); - if (minsym != NULL) - return MSYMBOL_VALUE_ADDRESS (minsym); + if (minsym.minsym != NULL) + return MSYMBOL_VALUE_ADDRESS (minsym.minsym); else return 0; } @@ -85,7 +85,7 @@ ld_so_xfer_auxv (gdb_byte *readbuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; CORE_ADDR data_address, pointer_address; struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr; size_t ptr_size = TYPE_LENGTH (ptr_type); @@ -95,17 +95,17 @@ ld_so_xfer_auxv (gdb_byte *readbuf, size_t block; msym = lookup_minimal_symbol ("_dl_auxv", NULL, NULL); - if (msym == NULL) + if (msym.minsym == NULL) return TARGET_XFER_E_IO; - if (MSYMBOL_SIZE (msym) != ptr_size) + if (MSYMBOL_SIZE (msym.minsym) != ptr_size) return TARGET_XFER_E_IO; /* POINTER_ADDRESS is a location where the `_dl_auxv' variable resides. DATA_ADDRESS is the inferior value present in `_dl_auxv', therefore the real inferior AUXV address. */ - pointer_address = MSYMBOL_VALUE_ADDRESS (msym); + pointer_address = MSYMBOL_VALUE_ADDRESS (msym.minsym); /* The location of the _dl_auxv symbol may no longer be correct if ld.so runs at a different address than the one present in the diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index da6b765..a637cf8 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -492,7 +492,7 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end, int i; unsigned short insn; int scan_stage = 0; - struct minimal_symbol *msymbol; + struct bound_minimal_symbol msymbol; unsigned char prologue[AVR_MAX_PROLOGUE_SIZE]; int vpc = 0; int len; @@ -586,7 +586,7 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end, pc_offset += 2; msymbol = lookup_minimal_symbol ("__prologue_saves__", NULL, NULL); - if (!msymbol) + if (!msymbol.minsym) break; insn = extract_unsigned_integer (&prologue[vpc + 8], 2, byte_order); @@ -624,7 +624,8 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end, /* Resolve offset (in words) from __prologue_saves__ symbol. Which is a pushes count in `-mcall-prologues' mode */ - num_pushes = AVR_MAX_PUSHES - (i - MSYMBOL_VALUE_ADDRESS (msymbol)) / 2; + num_pushes = (AVR_MAX_PUSHES + - (i - MSYMBOL_VALUE_ADDRESS (msymbol.minsym)) / 2); if (num_pushes > AVR_MAX_PUSHES) { diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index a57d573..f2bcefa 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -712,14 +712,14 @@ gen_var_ref (struct gdbarch *gdbarch, struct agent_expr *ax, case LOC_UNRESOLVED: { - struct minimal_symbol *msym + struct bound_minimal_symbol msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL); - if (!msym) + if (!msym.minsym) error (_("Couldn't resolve symbol `%s'."), SYMBOL_PRINT_NAME (var)); /* Push the address of the variable. */ - ax_const_l (ax, MSYMBOL_VALUE_ADDRESS (msym)); + ax_const_l (ax, MSYMBOL_VALUE_ADDRESS (msym.minsym)); value->kind = axs_lvalue_memory; } break; diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 51309b0..7006beb 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3146,10 +3146,10 @@ static const char *const longjmp_names[] = struct breakpoint_objfile_data { /* Minimal symbol for "_ovly_debug_event" (if any). */ - struct minimal_symbol *overlay_msym; + struct bound_minimal_symbol overlay_msym; /* Minimal symbol(s) for "longjmp", "siglongjmp", etc. (if any). */ - struct minimal_symbol *longjmp_msym[NUM_LONGJMP_NAMES]; + struct bound_minimal_symbol longjmp_msym[NUM_LONGJMP_NAMES]; /* True if we have looked for longjmp probes. */ int longjmp_searched; @@ -3158,10 +3158,10 @@ struct breakpoint_objfile_data VEC (probe_p) *longjmp_probes; /* Minimal symbol for "std::terminate()" (if any). */ - struct minimal_symbol *terminate_msym; + struct bound_minimal_symbol terminate_msym; /* Minimal symbol for "_Unwind_DebugHook" (if any). */ - struct minimal_symbol *exception_msym; + struct bound_minimal_symbol exception_msym; /* True if we have looked for exception probes. */ int exception_searched; @@ -3226,24 +3226,24 @@ create_overlay_event_breakpoint (void) bp_objfile_data = get_breakpoint_objfile_data (objfile); - if (msym_not_found_p (bp_objfile_data->overlay_msym)) + if (msym_not_found_p (bp_objfile_data->overlay_msym.minsym)) continue; - if (bp_objfile_data->overlay_msym == NULL) + if (bp_objfile_data->overlay_msym.minsym == NULL) { - struct minimal_symbol *m; + struct bound_minimal_symbol m; m = lookup_minimal_symbol_text (func_name, objfile); - if (m == NULL) + if (m.minsym == NULL) { /* Avoid future lookups in this objfile. */ - bp_objfile_data->overlay_msym = &msym_not_found; + bp_objfile_data->overlay_msym.minsym = &msym_not_found; continue; } bp_objfile_data->overlay_msym = m; } - addr = MSYMBOL_VALUE_ADDRESS (bp_objfile_data->overlay_msym); + addr = MSYMBOL_VALUE_ADDRESS (bp_objfile_data->overlay_msym.minsym); b = create_internal_breakpoint (get_objfile_arch (objfile), addr, bp_overlay_event, &internal_breakpoint_ops); @@ -3342,25 +3342,25 @@ create_longjmp_master_breakpoint (void) const char *func_name; CORE_ADDR addr; - if (msym_not_found_p (bp_objfile_data->longjmp_msym[i])) + if (msym_not_found_p (bp_objfile_data->longjmp_msym[i].minsym)) continue; func_name = longjmp_names[i]; - if (bp_objfile_data->longjmp_msym[i] == NULL) + if (bp_objfile_data->longjmp_msym[i].minsym == NULL) { - struct minimal_symbol *m; + struct bound_minimal_symbol m; m = lookup_minimal_symbol_text (func_name, objfile); - if (m == NULL) + if (m.minsym == NULL) { /* Prevent future lookups in this objfile. */ - bp_objfile_data->longjmp_msym[i] = &msym_not_found; + bp_objfile_data->longjmp_msym[i].minsym = &msym_not_found; continue; } bp_objfile_data->longjmp_msym[i] = m; } - addr = MSYMBOL_VALUE_ADDRESS (bp_objfile_data->longjmp_msym[i]); + addr = MSYMBOL_VALUE_ADDRESS (bp_objfile_data->longjmp_msym[i].minsym); b = create_internal_breakpoint (gdbarch, addr, bp_longjmp_master, &internal_breakpoint_ops); b->addr_string = xstrdup (func_name); @@ -3397,25 +3397,25 @@ create_std_terminate_master_breakpoint (void) bp_objfile_data = get_breakpoint_objfile_data (objfile); - if (msym_not_found_p (bp_objfile_data->terminate_msym)) + if (msym_not_found_p (bp_objfile_data->terminate_msym.minsym)) continue; - if (bp_objfile_data->terminate_msym == NULL) + if (bp_objfile_data->terminate_msym.minsym == NULL) { - struct minimal_symbol *m; + struct bound_minimal_symbol m; m = lookup_minimal_symbol (func_name, NULL, objfile); - if (m == NULL || (MSYMBOL_TYPE (m) != mst_text - && MSYMBOL_TYPE (m) != mst_file_text)) + if (m.minsym == NULL || (MSYMBOL_TYPE (m.minsym) != mst_text + && MSYMBOL_TYPE (m.minsym) != mst_file_text)) { /* Prevent future lookups in this objfile. */ - bp_objfile_data->terminate_msym = &msym_not_found; + bp_objfile_data->terminate_msym.minsym = &msym_not_found; continue; } bp_objfile_data->terminate_msym = m; } - addr = MSYMBOL_VALUE_ADDRESS (bp_objfile_data->terminate_msym); + addr = MSYMBOL_VALUE_ADDRESS (bp_objfile_data->terminate_msym.minsym); b = create_internal_breakpoint (get_objfile_arch (objfile), addr, bp_std_terminate_master, &internal_breakpoint_ops); @@ -3496,26 +3496,26 @@ create_exception_master_breakpoint (void) /* Otherwise, try the hook function. */ - if (msym_not_found_p (bp_objfile_data->exception_msym)) + if (msym_not_found_p (bp_objfile_data->exception_msym.minsym)) continue; gdbarch = get_objfile_arch (objfile); - if (bp_objfile_data->exception_msym == NULL) + if (bp_objfile_data->exception_msym.minsym == NULL) { - struct minimal_symbol *debug_hook; + struct bound_minimal_symbol debug_hook; debug_hook = lookup_minimal_symbol (func_name, NULL, objfile); - if (debug_hook == NULL) + if (debug_hook.minsym == NULL) { - bp_objfile_data->exception_msym = &msym_not_found; + bp_objfile_data->exception_msym.minsym = &msym_not_found; continue; } bp_objfile_data->exception_msym = debug_hook; } - addr = MSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym); + addr = MSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym.minsym); addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, ¤t_target); b = create_internal_breakpoint (gdbarch, addr, bp_exception_master, diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index d10c5d4..473acba 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -125,11 +125,11 @@ static int bsd_uthread_active; static CORE_ADDR bsd_uthread_lookup_address (const char *name, struct objfile *objfile) { - struct minimal_symbol *sym; + struct bound_minimal_symbol sym; sym = lookup_minimal_symbol (name, NULL, objfile); - if (sym) - return MSYMBOL_VALUE_ADDRESS (sym); + if (sym.minsym) + return MSYMBOL_VALUE_ADDRESS (sym.minsym); return 0; } diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 4704845..11631ba 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -2935,7 +2935,7 @@ classify_name (const struct block *block, int is_quoted_name) if (sym == NULL && parse_language->la_language == language_cplus && is_a_field_of_this.type == NULL - && !lookup_minimal_symbol (copy, NULL, NULL)) + && lookup_minimal_symbol (copy, NULL, NULL).minsym == NULL) return UNKNOWN_CPP_NAME; return NAME; diff --git a/gdb/coffread.c b/gdb/coffread.c index d2891c3..c5ad60c 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -680,14 +680,15 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags) || strncmp (name, "_imp_", 5) == 0)) { const char *name1 = (name[1] == '_' ? &name[7] : &name[6]); - struct minimal_symbol *found; + struct bound_minimal_symbol found; found = lookup_minimal_symbol (name1, NULL, objfile); /* If found, there are symbols named "_imp_foo" and "foo" respectively in OBJFILE. Set the type of symbol "foo" as 'mst_solib_trampoline'. */ - if (found != NULL && MSYMBOL_TYPE (found) == mst_text) - MSYMBOL_TYPE (found) = mst_solib_trampoline; + if (found.minsym != NULL + && MSYMBOL_TYPE (found.minsym) == mst_text) + MSYMBOL_TYPE (found.minsym) = mst_solib_trampoline; } } } diff --git a/gdb/common/agent.c b/gdb/common/agent.c index c23d7dd..fdede74 100644 --- a/gdb/common/agent.c +++ b/gdb/common/agent.c @@ -98,12 +98,12 @@ agent_look_up_symbols (void *arg) if (look_up_one_symbol (symbol_list[i].name, addrp, 1) == 0) #else - struct minimal_symbol *sym = + struct bound_minimal_symbol sym = lookup_minimal_symbol (symbol_list[i].name, NULL, (struct objfile *) arg); - if (sym != NULL) - *addrp = MSYMBOL_VALUE_ADDRESS (sym); + if (sym.minsym != NULL) + *addrp = MSYMBOL_VALUE_ADDRESS (sym.minsym); else #endif { diff --git a/gdb/d-lang.c b/gdb/d-lang.c index b724b96..434f30a 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -37,10 +37,10 @@ static const char D_MAIN[] = "D main"; const char * d_main_name (void) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; msym = lookup_minimal_symbol (D_MAIN, NULL, NULL); - if (msym != NULL) + if (msym.minsym != NULL) return D_MAIN; /* No known entry procedure found, the main program is probably not D. */ diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 60cf0a8..ba8616f 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1133,7 +1133,7 @@ static CORE_ADDR find_stab_function_addr (char *namestring, const char *filename, struct objfile *objfile) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; char *p; int n; @@ -1146,7 +1146,7 @@ find_stab_function_addr (char *namestring, const char *filename, p[n] = 0; msym = lookup_minimal_symbol (p, filename, objfile); - if (msym == NULL) + if (msym.minsym == NULL) { /* Sun Fortran appends an underscore to the minimal symbol name, try again with an appended underscore if the minimal symbol @@ -1156,13 +1156,13 @@ find_stab_function_addr (char *namestring, const char *filename, msym = lookup_minimal_symbol (p, filename, objfile); } - if (msym == NULL && filename != NULL) + if (msym.minsym == NULL && filename != NULL) { /* Try again without the filename. */ p[n] = 0; msym = lookup_minimal_symbol (p, NULL, objfile); } - if (msym == NULL && filename != NULL) + if (msym.minsym == NULL && filename != NULL) { /* And try again for Sun Fortran, but without the filename. */ p[n] = '_'; @@ -1170,7 +1170,7 @@ find_stab_function_addr (char *namestring, const char *filename, msym = lookup_minimal_symbol (p, NULL, objfile); } - return msym == NULL ? 0 : MSYMBOL_VALUE_ADDRESS (msym); + return msym.minsym == NULL ? 0 : MSYMBOL_VALUE_ADDRESS (msym.minsym); } static void @@ -2256,7 +2256,7 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst, { char *p; int n; - struct minimal_symbol *minsym; + struct bound_minimal_symbol minsym; p = strchr (last_function_name, ':'); if (p == NULL) @@ -2267,7 +2267,7 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst, p[n] = 0; minsym = lookup_minimal_symbol (p, pst->filename, objfile); - if (minsym == NULL) + if (minsym.minsym == NULL) { /* Sun Fortran appends an underscore to the minimal symbol name, try again with an appended underscore if the minimal symbol @@ -2277,8 +2277,9 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst, minsym = lookup_minimal_symbol (p, pst->filename, objfile); } - if (minsym) - pst->texthigh = MSYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym); + if (minsym.minsym) + pst->texthigh = (MSYMBOL_VALUE_ADDRESS (minsym.minsym) + + MSYMBOL_SIZE (minsym.minsym)); last_function_name = NULL; } diff --git a/gdb/dec-thread.c b/gdb/dec-thread.c index 1057cfb..080640d 100644 --- a/gdb/dec-thread.c +++ b/gdb/dec-thread.c @@ -225,7 +225,7 @@ static pthreadDebugCallbacks_t debug_callbacks = static void enable_dec_thread (void) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; void* caller_context; int status; @@ -234,14 +234,14 @@ enable_dec_thread (void) return; msym = lookup_minimal_symbol ("__pthread_dbg_symtable", NULL, NULL); - if (msym == NULL) + if (msym.minsym == NULL) { debug ("enable_dec_thread: No __pthread_dbg_symtable"); return; } status = pthreadDebugContextInit (&caller_context, &debug_callbacks, - (void *) SYMBOL_VALUE_ADDRESS (msym), + (void *) SYMBOL_VALUE_ADDRESS (msym.minsym), &debug_context); if (status != ESUCCESS) { diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 430e749..e109ff6 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -588,23 +588,24 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, case FIELD_LOC_KIND_PHYSNAME: { const char *physname; - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; physname = FIELD_STATIC_PHYSNAME (call_site->target); /* Handle both the mangled and demangled PHYSNAME. */ msym = lookup_minimal_symbol (physname, NULL, NULL); - if (msym == NULL) + if (msym.minsym == NULL) { - msym = lookup_minimal_symbol_by_pc (call_site->pc - 1).minsym; + msym = lookup_minimal_symbol_by_pc (call_site->pc - 1); throw_error (NO_ENTRY_VALUE_ERROR, _("Cannot find function \"%s\" for a call site target " "at %s in %s"), physname, paddress (call_site_gdbarch, call_site->pc), - msym == NULL ? "???" : MSYMBOL_PRINT_NAME (msym)); + (msym.minsym == NULL ? "???" + : MSYMBOL_PRINT_NAME (msym.minsym))); } - return MSYMBOL_VALUE_ADDRESS (msym); + return MSYMBOL_VALUE_ADDRESS (msym.minsym); } case FIELD_LOC_KIND_PHYSADDR: diff --git a/gdb/elfread.c b/gdb/elfread.c index 9ecd328..4d2e290 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -884,20 +884,20 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p) CORE_ADDR pointer_address, addr; asection *plt; gdb_byte *buf = alloca (ptr_size); - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; msym = lookup_minimal_symbol (name_got_plt, NULL, objfile); - if (msym == NULL) + if (msym.minsym == NULL) continue; - if (MSYMBOL_TYPE (msym) != mst_slot_got_plt) + if (MSYMBOL_TYPE (msym.minsym) != mst_slot_got_plt) continue; - pointer_address = MSYMBOL_VALUE_ADDRESS (msym); + pointer_address = MSYMBOL_VALUE_ADDRESS (msym.minsym); plt = bfd_get_section_by_name (obfd, ".plt"); if (plt == NULL) continue; - if (MSYMBOL_SIZE (msym) != ptr_size) + if (MSYMBOL_SIZE (msym.minsym) != ptr_size) continue; if (target_read_memory (pointer_address, buf, ptr_size) != 0) continue; @@ -1113,7 +1113,7 @@ evaluate_subexp_standard (struct type *expect_type, if (value_as_long (target) == 0) return value_from_longest (long_type, 0); - if (lookup_minimal_symbol ("objc_msg_lookup", 0, 0)) + if (lookup_minimal_symbol ("objc_msg_lookup", 0, 0).minsym) gnu_runtime = 1; /* Find the method dispatch (Apple runtime) or method lookup diff --git a/gdb/findvar.c b/gdb/findvar.c index 3e8bd08..56cbb2c 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -390,10 +390,7 @@ struct minsym_lookup_data /* The field where the callback should store the minimal symbol if found. It should be initialized to NULL before the search is started. */ - struct minimal_symbol *result; - - /* The objfile in which the symbol was found. */ - struct objfile *objfile; + struct bound_minimal_symbol result; }; /* A callback function for gdbarch_iterate_over_objfiles_in_search_order. @@ -406,13 +403,12 @@ minsym_lookup_iterator_cb (struct objfile *objfile, void *cb_data) { struct minsym_lookup_data *data = (struct minsym_lookup_data *) cb_data; - gdb_assert (data->result == NULL); + gdb_assert (data->result.minsym == NULL); data->result = lookup_minimal_symbol (data->name, NULL, objfile); - data->objfile = objfile; /* The iterator should stop iff a match was found. */ - return (data->result != NULL); + return (data->result.minsym != NULL); } /* A default implementation for the "la_read_var_value" hook in @@ -572,18 +568,18 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) (get_objfile_arch (SYMBOL_SYMTAB (var)->objfile), minsym_lookup_iterator_cb, &lookup_data, SYMBOL_SYMTAB (var)->objfile); - msym = lookup_data.result; + msym = lookup_data.result.minsym; if (msym == NULL) error (_("No global symbol \"%s\"."), SYMBOL_LINKAGE_NAME (var)); if (overlay_debugging) addr = symbol_overlayed_address (MSYMBOL_VALUE_ADDRESS (msym), - MSYMBOL_OBJ_SECTION (lookup_data.objfile, + MSYMBOL_OBJ_SECTION (lookup_data.result.objfile, msym)); else addr = MSYMBOL_VALUE_ADDRESS (msym); - obj_section = MSYMBOL_OBJ_SECTION (lookup_data.objfile, msym); + obj_section = MSYMBOL_OBJ_SECTION (lookup_data.result.objfile, msym); if (obj_section && (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) addr = target_translate_tls_address (obj_section->objfile, addr); diff --git a/gdb/frame.c b/gdb/frame.c index a2645b5..40dc1d5 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2007,18 +2007,18 @@ frame_debug_got_null_frame (struct frame_info *this_frame, static int inside_main_func (struct frame_info *this_frame) { - struct minimal_symbol *msymbol; + struct bound_minimal_symbol msymbol; CORE_ADDR maddr; if (symfile_objfile == 0) return 0; msymbol = lookup_minimal_symbol (main_name (), NULL, symfile_objfile); - if (msymbol == NULL) + if (msymbol.minsym == NULL) return 0; /* Make certain that the code, and not descriptor, address is returned. */ maddr = gdbarch_convert_from_func_ptr_addr (get_frame_arch (this_frame), - MSYMBOL_VALUE_ADDRESS (msymbol), + MSYMBOL_VALUE_ADDRESS (msymbol.minsym), ¤t_target); return maddr == get_frame_func (this_frame); } diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 2437c9d..acb0ba3 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1391,7 +1391,7 @@ frv_frame_this_id (struct frame_info *this_frame, = frv_frame_unwind_cache (this_frame, this_prologue_cache); CORE_ADDR base; CORE_ADDR func; - struct minimal_symbol *msym_stack; + struct bound_minimal_symbol msym_stack; struct frame_id id; /* The FUNC is easy. */ @@ -1399,7 +1399,8 @@ frv_frame_this_id (struct frame_info *this_frame, /* Check if the stack is empty. */ msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL); - if (msym_stack && info->base == MSYMBOL_VALUE_ADDRESS (msym_stack)) + if (msym_stack.minsym + && info->base == MSYMBOL_VALUE_ADDRESS (msym_stack.minsym)) return; /* Hopefully the prologue analysis either correctly determined the diff --git a/gdb/gcore.c b/gdb/gcore.c index b80a97b..e225080 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -268,13 +268,13 @@ call_target_sbrk (int sbrk_arg) struct value *sbrk_fn, *ret; bfd_vma tmp; - if (lookup_minimal_symbol ("sbrk", NULL, NULL) != NULL) + if (lookup_minimal_symbol ("sbrk", NULL, NULL).minsym != NULL) { sbrk_fn = find_function_in_inferior ("sbrk", &sbrk_objf); if (sbrk_fn == NULL) return (bfd_vma) 0; } - else if (lookup_minimal_symbol ("_sbrk", NULL, NULL) != NULL) + else if (lookup_minimal_symbol ("_sbrk", NULL, NULL).minsym != NULL) { sbrk_fn = find_function_in_inferior ("_sbrk", &sbrk_objf); if (sbrk_fn == NULL) diff --git a/gdb/glibc-tdep.c b/gdb/glibc-tdep.c index 4dd2415..99b504f 100644 --- a/gdb/glibc-tdep.c +++ b/gdb/glibc-tdep.c @@ -59,14 +59,14 @@ glibc_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) if (resolver.minsym) { /* The dynamic linker began using this name in early 2005. */ - struct minimal_symbol *fixup + struct bound_minimal_symbol fixup = lookup_minimal_symbol ("_dl_fixup", NULL, resolver.objfile); /* This is the name used in older versions. */ - if (! fixup) + if (! fixup.minsym) fixup = lookup_minimal_symbol ("fixup", NULL, resolver.objfile); - if (fixup && MSYMBOL_VALUE_ADDRESS (fixup) == pc) + if (fixup.minsym && MSYMBOL_VALUE_ADDRESS (fixup.minsym) == pc) return frame_unwind_caller_pc (get_current_frame ()); } diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 6311f92..35f8e7b 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -1122,16 +1122,17 @@ gnuv3_get_typeid (struct value *value) else { char *sym_name; - struct minimal_symbol *minsym; + struct bound_minimal_symbol minsym; sym_name = concat ("typeinfo for ", typename, (char *) NULL); make_cleanup (xfree, sym_name); minsym = lookup_minimal_symbol (sym_name, NULL, NULL); - if (minsym == NULL) + if (minsym.minsym == NULL) error (_("could not find typeinfo symbol for '%s'"), typename); - result = value_at_lazy (typeinfo_type, MSYMBOL_VALUE_ADDRESS (minsym)); + result = value_at_lazy (typeinfo_type, + MSYMBOL_VALUE_ADDRESS (minsym.minsym)); } do_cleanups (cleanup); @@ -1209,7 +1210,7 @@ gnuv3_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc) { CORE_ADDR real_stop_pc, method_stop_pc, func_addr; struct gdbarch *gdbarch = get_frame_arch (frame); - struct minimal_symbol *thunk_sym, *fn_sym; + struct bound_minimal_symbol thunk_sym, fn_sym; struct obj_section *section; const char *thunk_name, *fn_name; @@ -1218,24 +1219,24 @@ gnuv3_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc) real_stop_pc = stop_pc; /* Find the linker symbol for this potential thunk. */ - thunk_sym = lookup_minimal_symbol_by_pc (real_stop_pc).minsym; + thunk_sym = lookup_minimal_symbol_by_pc (real_stop_pc); section = find_pc_section (real_stop_pc); - if (thunk_sym == NULL || section == NULL) + if (thunk_sym.minsym == NULL || section == NULL) return 0; /* The symbol's demangled name should be something like "virtual thunk to FUNCTION", where FUNCTION is the name of the function being thunked to. */ - thunk_name = MSYMBOL_DEMANGLED_NAME (thunk_sym); + thunk_name = MSYMBOL_DEMANGLED_NAME (thunk_sym.minsym); if (thunk_name == NULL || strstr (thunk_name, " thunk to ") == NULL) return 0; fn_name = strstr (thunk_name, " thunk to ") + strlen (" thunk to "); fn_sym = lookup_minimal_symbol (fn_name, NULL, section->objfile); - if (fn_sym == NULL) + if (fn_sym.minsym == NULL) return 0; - method_stop_pc = MSYMBOL_VALUE_ADDRESS (fn_sym); + method_stop_pc = MSYMBOL_VALUE_ADDRESS (fn_sym.minsym); /* Some targets have minimal symbols pointing to function descriptors (powerpc 64 for example). Make sure to retrieve the address diff --git a/gdb/go-lang.c b/gdb/go-lang.c index cbb0505..42535df 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -56,10 +56,10 @@ static const char GO_MAIN_MAIN[] = "main.main"; const char * go_main_name (void) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; msym = lookup_minimal_symbol (GO_MAIN_MAIN, NULL, NULL); - if (msym != NULL) + if (msym.minsym != NULL) return GO_MAIN_MAIN; /* No known entry procedure found, the main program is probably not Go. */ diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c index 31b557dc..e9f067d 100644 --- a/gdb/hppa-hpux-tdep.c +++ b/gdb/hppa-hpux-tdep.c @@ -460,7 +460,7 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) (curr_inst == 0xeaa0d002)) { struct bound_minimal_symbol stubsym; - struct minimal_symbol *libsym; + struct bound_minimal_symbol libsym; stubsym = lookup_minimal_symbol_by_pc (loc); if (stubsym.minsym == NULL) @@ -471,14 +471,14 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) libsym = lookup_minimal_symbol (MSYMBOL_LINKAGE_NAME (stubsym.minsym), NULL, NULL); - if (libsym == NULL) + if (libsym.minsym == NULL) { warning (_("Unable to find library symbol for %s."), MSYMBOL_PRINT_NAME (stubsym.minsym)); return orig_pc == pc ? 0 : pc & ~0x3; } - return MSYMBOL_VALUE (libsym); + return MSYMBOL_VALUE (libsym.minsym); } /* Does it look like bl X,%rp or bl X,%r0? Another way to do a @@ -1014,7 +1014,7 @@ hppa_hpux_find_import_stub_for_addr (CORE_ADDR funcaddr) { struct objfile *objfile; struct bound_minimal_symbol funsym; - struct minimal_symbol *stubsym; + struct bound_minimal_symbol stubsym; CORE_ADDR stubaddr; funsym = lookup_minimal_symbol_by_pc (funcaddr); @@ -1025,17 +1025,17 @@ hppa_hpux_find_import_stub_for_addr (CORE_ADDR funcaddr) stubsym = lookup_minimal_symbol_solib_trampoline (MSYMBOL_LINKAGE_NAME (funsym.minsym), objfile); - if (stubsym) + if (stubsym.minsym) { struct unwind_table_entry *u; - u = find_unwind_entry (MSYMBOL_VALUE (stubsym)); + u = find_unwind_entry (MSYMBOL_VALUE (stubsym.minsym)); if (u == NULL || (u->stub_unwind.stub_type != IMPORT && u->stub_unwind.stub_type != IMPORT_SHLIB)) continue; - stubaddr = MSYMBOL_VALUE (stubsym); + stubaddr = MSYMBOL_VALUE (stubsym.minsym); /* If we found an IMPORT stub, then we can stop searching; if we found an IMPORT_SHLIB, we want to continue the search diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index aaef5a1..05ca007 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -162,11 +162,11 @@ hppa_extract_17 (unsigned word) CORE_ADDR hppa_symbol_address(const char *sym) { - struct minimal_symbol *minsym; + struct bound_minimal_symbol minsym; minsym = lookup_minimal_symbol (sym, NULL, NULL); - if (minsym) - return MSYMBOL_VALUE_ADDRESS (minsym); + if (minsym.minsym) + return MSYMBOL_VALUE_ADDRESS (minsym.minsym); else return (CORE_ADDR)-1; } @@ -2463,12 +2463,13 @@ hppa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) /* Return the minimal symbol whose name is NAME and stub type is STUB_TYPE. Return NULL if no such symbol was found. */ -struct minimal_symbol * +struct bound_minimal_symbol hppa_lookup_stub_minimal_symbol (const char *name, enum unwind_stub_types stub_type) { struct objfile *objfile; struct minimal_symbol *msym; + struct bound_minimal_symbol result = { NULL, NULL }; ALL_MSYMBOLS (objfile, msym) { @@ -2478,11 +2479,15 @@ hppa_lookup_stub_minimal_symbol (const char *name, u = find_unwind_entry (MSYMBOL_VALUE (msym)); if (u != NULL && u->stub_unwind.stub_type == stub_type) - return msym; + { + result.objfile = objfile; + result.minsym = msym; + return result; + } } } - return NULL; + return result; } static void diff --git a/gdb/hppa-tdep.h b/gdb/hppa-tdep.h index 7c45ea8..0669ce3 100644 --- a/gdb/hppa-tdep.h +++ b/gdb/hppa-tdep.h @@ -240,7 +240,7 @@ extern void hppa_write_pc (struct regcache *regcache, CORE_ADDR pc); extern CORE_ADDR hppa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame); -extern struct minimal_symbol * +extern struct bound_minimal_symbol hppa_lookup_stub_minimal_symbol (const char *name, enum unwind_stub_types stub_type); @@ -1016,7 +1016,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, struct jit_program_space_data *ps_data) { struct bound_minimal_symbol reg_symbol; - struct minimal_symbol *desc_symbol; + struct bound_minimal_symbol desc_symbol; struct jit_objfile_data *objf_data; CORE_ADDR addr; @@ -1031,12 +1031,13 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, desc_symbol = lookup_minimal_symbol (jit_descriptor_name, NULL, reg_symbol.objfile); - if (desc_symbol == NULL || MSYMBOL_VALUE_ADDRESS (desc_symbol) == 0) + if (desc_symbol.minsym == NULL + || MSYMBOL_VALUE_ADDRESS (desc_symbol.minsym) == 0) return 1; objf_data = get_jit_objfile_data (reg_symbol.objfile); objf_data->register_code = reg_symbol.minsym; - objf_data->descriptor = desc_symbol; + objf_data->descriptor = desc_symbol.minsym; ps_data->objfile = reg_symbol.objfile; } diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index ed695d2..9aece37 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -455,9 +455,10 @@ inferior_call_waitpid (ptid_t pptid, int pid) old_cleanup = make_cleanup (inferior_call_waitpid_cleanup, oldfp); /* Get the waitpid_fn. */ - if (lookup_minimal_symbol ("waitpid", NULL, NULL) != NULL) + if (lookup_minimal_symbol ("waitpid", NULL, NULL).minsym != NULL) waitpid_fn = find_function_in_inferior ("waitpid", &waitpid_objf); - if (!waitpid_fn && lookup_minimal_symbol ("_waitpid", NULL, NULL) != NULL) + if (!waitpid_fn + && lookup_minimal_symbol ("_waitpid", NULL, NULL).minsym != NULL) waitpid_fn = find_function_in_inferior ("_waitpid", &waitpid_objf); if (!waitpid_fn) goto out; @@ -668,10 +669,10 @@ checkpoint_command (char *args, int from_tty) /* Make the inferior fork, record its (and gdb's) state. */ - if (lookup_minimal_symbol ("fork", NULL, NULL) != NULL) + if (lookup_minimal_symbol ("fork", NULL, NULL).minsym != NULL) fork_fn = find_function_in_inferior ("fork", &fork_objf); if (!fork_fn) - if (lookup_minimal_symbol ("_fork", NULL, NULL) != NULL) + if (lookup_minimal_symbol ("_fork", NULL, NULL).minsym != NULL) fork_fn = find_function_in_inferior ("fork", &fork_objf); if (!fork_fn) error (_("checkpoint: can't find fork function in inferior.")); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index aeb5582..4702bf5 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -5031,14 +5031,15 @@ Enables printf debugging output."), static int get_signo (const char *name) { - struct minimal_symbol *ms; + struct bound_minimal_symbol ms; int signo; ms = lookup_minimal_symbol (name, NULL, NULL); - if (ms == NULL) + if (ms.minsym == NULL) return 0; - if (target_read_memory (MSYMBOL_VALUE_ADDRESS (ms), (gdb_byte *) &signo, + if (target_read_memory (MSYMBOL_VALUE_ADDRESS (ms.minsym), + (gdb_byte *) &signo, sizeof (signo)) != 0) return 0; diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 7f23722..e1c5bce 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -565,16 +565,16 @@ enable_thread_event (int event, CORE_ADDR *bp) static int inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min) { - struct minimal_symbol *version_msym; + struct bound_minimal_symbol version_msym; CORE_ADDR version_addr; char *version; int err, got, retval = 0; version_msym = lookup_minimal_symbol (ver_symbol, NULL, NULL); - if (version_msym == NULL) + if (version_msym.minsym == NULL) return 0; - version_addr = MSYMBOL_VALUE_ADDRESS (version_msym); + version_addr = MSYMBOL_VALUE_ADDRESS (version_msym.minsym); got = target_read_string (version_addr, &version, 32, &err); if (err == 0 && memchr (version, 0, got) == &version[got -1]) { diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 899e45f..d6bc482 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -2240,14 +2240,15 @@ m32c_return_value (struct gdbarch *gdbarch, /* Everything else is passed in mem0, using as many bytes as needed. This is not what the Renesas tools do, but it's what GCC does at the moment. */ - struct minimal_symbol *mem0 + struct bound_minimal_symbol mem0 = lookup_minimal_symbol ("mem0", NULL, NULL); - if (! mem0) + if (! mem0.minsym) error (_("The return value is stored in memory at 'mem0', " "but GDB cannot find\n" "its address.")); - read_memory (MSYMBOL_VALUE_ADDRESS (mem0), readbuf, valtype_len); + read_memory (MSYMBOL_VALUE_ADDRESS (mem0.minsym), readbuf, + valtype_len); } } @@ -2272,14 +2273,15 @@ m32c_return_value (struct gdbarch *gdbarch, /* Everything else is passed in mem0, using as many bytes as needed. This is not what the Renesas tools do, but it's what GCC does at the moment. */ - struct minimal_symbol *mem0 + struct bound_minimal_symbol mem0 = lookup_minimal_symbol ("mem0", NULL, NULL); - if (! mem0) + if (! mem0.minsym) error (_("The return value is stored in memory at 'mem0', " "but GDB cannot find\n" " its address.")); - write_memory (MSYMBOL_VALUE_ADDRESS (mem0), writebuf, valtype_len); + write_memory (MSYMBOL_VALUE_ADDRESS (mem0.minsym), writebuf, + valtype_len); } } @@ -2450,7 +2452,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch, { const char *func_name; char *tramp_name; - struct minimal_symbol *tramp_msym; + struct bound_minimal_symbol tramp_msym; /* Try to find a linker symbol at this address. */ struct bound_minimal_symbol func_msym @@ -2473,7 +2475,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch, the name any more. */ xfree (tramp_name); - if (! tramp_msym) + if (! tramp_msym.minsym) { CORE_ADDR ptrval; @@ -2505,7 +2507,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch, else { /* The trampoline's address is our pointer. */ - addr = MSYMBOL_VALUE_ADDRESS (tramp_msym); + addr = MSYMBOL_VALUE_ADDRESS (tramp_msym.minsym); } } @@ -2542,7 +2544,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch, if (len > 4 && strcmp (ptr_msym_name + len - 4, ".plt") == 0) { - struct minimal_symbol *func_msym; + struct bound_minimal_symbol func_msym; /* We have a .plt symbol; try to find the symbol for the corresponding function. @@ -2557,8 +2559,8 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch, /* If we do have such a symbol, return its value as the function's true address. */ - if (func_msym) - ptr = MSYMBOL_VALUE_ADDRESS (func_msym); + if (func_msym.minsym) + ptr = MSYMBOL_VALUE_ADDRESS (func_msym.minsym); } } else diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 52a3170..2af5774 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -836,7 +836,7 @@ m32r_frame_this_id (struct frame_info *this_frame, = m32r_frame_unwind_cache (this_frame, this_prologue_cache); CORE_ADDR base; CORE_ADDR func; - struct minimal_symbol *msym_stack; + struct bound_minimal_symbol msym_stack; struct frame_id id; /* The FUNC is easy. */ @@ -844,7 +844,8 @@ m32r_frame_this_id (struct frame_info *this_frame, /* Check if the stack is empty. */ msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL); - if (msym_stack && info->base == MSYMBOL_VALUE_ADDRESS (msym_stack)) + if (msym_stack.minsym + && info->base == MSYMBOL_VALUE_ADDRESS (msym_stack.minsym)) return; /* Hopefully the prologue analysis either correctly determined the diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index e23747d..6f0092b 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -199,12 +199,12 @@ static int soft_reg_initialized = 0; static void m68hc11_get_register_info (struct m68hc11_soft_reg *reg, const char *name) { - struct minimal_symbol *msymbol; + struct bound_minimal_symbol msymbol; msymbol = lookup_minimal_symbol (name, NULL, NULL); - if (msymbol) + if (msymbol.minsym) { - reg->addr = MSYMBOL_VALUE_ADDRESS (msymbol); + reg->addr = MSYMBOL_VALUE_ADDRESS (msymbol.minsym); reg->name = xstrdup (name); /* Keep track of the address range for soft registers. */ diff --git a/gdb/machoread.c b/gdb/machoread.c index cb8f053..f189e99 100644 --- a/gdb/machoread.c +++ b/gdb/machoread.c @@ -429,19 +429,19 @@ static CORE_ADDR macho_resolve_oso_sym_with_minsym (struct objfile *main_objfile, asymbol *sym) { /* For common symbol and global symbols, use the min symtab. */ - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; const char *name = sym->name; if (name[0] == bfd_get_symbol_leading_char (main_objfile->obfd)) ++name; msym = lookup_minimal_symbol (name, NULL, main_objfile); - if (msym == NULL) + if (msym.minsym == NULL) { warning (_("can't find symbol '%s' in minsymtab"), name); return 0; } else - return MSYMBOL_VALUE_ADDRESS (msym); + return MSYMBOL_VALUE_ADDRESS (msym.minsym); } /* Add oso file OSO/ABFD as a symbol file. */ diff --git a/gdb/minsyms.c b/gdb/minsyms.c index dde7d90..8335d51 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -159,9 +159,9 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym, Obviously, there must be distinct mangled names for each of these, but the demangled names are all the same: S::S or S::~S. */ -static struct bound_minimal_symbol -lookup_minimal_symbol_internal (const char *name, const char *sfile, - struct objfile *objf) +struct bound_minimal_symbol +lookup_minimal_symbol (const char *name, const char *sfile, + struct objfile *objf) { struct objfile *objfile; struct bound_minimal_symbol found_symbol = { NULL, NULL }; @@ -294,23 +294,10 @@ lookup_minimal_symbol_internal (const char *name, const char *sfile, /* See minsyms.h. */ -struct minimal_symbol * -lookup_minimal_symbol (const char *name, const char *sfile, - struct objfile *objf) -{ - struct bound_minimal_symbol bms = lookup_minimal_symbol_internal (name, - sfile, - objf); - - return bms.minsym; -} - -/* See minsyms.h. */ - struct bound_minimal_symbol lookup_bound_minimal_symbol (const char *name) { - return lookup_minimal_symbol_internal (name, NULL, NULL); + return lookup_minimal_symbol (name, NULL, NULL); } /* See minsyms.h. */ @@ -349,25 +336,25 @@ iterate_over_minimal_symbols (struct objfile *objf, const char *name, /* See minsyms.h. */ -struct minimal_symbol * +struct bound_minimal_symbol lookup_minimal_symbol_text (const char *name, struct objfile *objf) { struct objfile *objfile; struct minimal_symbol *msymbol; - struct minimal_symbol *found_symbol = NULL; - struct minimal_symbol *found_file_symbol = NULL; + struct bound_minimal_symbol found_symbol = { NULL, NULL }; + struct bound_minimal_symbol found_file_symbol = { NULL, NULL }; unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE; for (objfile = object_files; - objfile != NULL && found_symbol == NULL; + objfile != NULL && found_symbol.minsym == NULL; objfile = objfile->next) { if (objf == NULL || objf == objfile || objf == objfile->separate_debug_objfile_backlink) { for (msymbol = objfile->msymbol_hash[hash]; - msymbol != NULL && found_symbol == NULL; + msymbol != NULL && found_symbol.minsym == NULL; msymbol = msymbol->hash_next) { if (strcmp (MSYMBOL_LINKAGE_NAME (msymbol), name) == 0 && @@ -378,10 +365,12 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf) switch (MSYMBOL_TYPE (msymbol)) { case mst_file_text: - found_file_symbol = msymbol; + found_file_symbol.minsym = msymbol; + found_file_symbol.objfile = objfile; break; default: - found_symbol = msymbol; + found_symbol.minsym = msymbol; + found_symbol.objfile = objfile; break; } } @@ -389,14 +378,11 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf) } } /* External symbols are best. */ - if (found_symbol) + if (found_symbol.minsym) return found_symbol; /* File-local symbols are next best. */ - if (found_file_symbol) - return found_file_symbol; - - return NULL; + return found_file_symbol; } /* See minsyms.h. */ @@ -433,35 +419,39 @@ lookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name, /* See minsyms.h. */ -struct minimal_symbol * +struct bound_minimal_symbol lookup_minimal_symbol_solib_trampoline (const char *name, struct objfile *objf) { struct objfile *objfile; struct minimal_symbol *msymbol; - struct minimal_symbol *found_symbol = NULL; + struct bound_minimal_symbol found_symbol = { NULL, NULL }; unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE; for (objfile = object_files; - objfile != NULL && found_symbol == NULL; + objfile != NULL; objfile = objfile->next) { if (objf == NULL || objf == objfile || objf == objfile->separate_debug_objfile_backlink) { for (msymbol = objfile->msymbol_hash[hash]; - msymbol != NULL && found_symbol == NULL; + msymbol != NULL; msymbol = msymbol->hash_next) { if (strcmp (MSYMBOL_LINKAGE_NAME (msymbol), name) == 0 && MSYMBOL_TYPE (msymbol) == mst_solib_trampoline) - return msymbol; + { + found_symbol.objfile = objfile; + found_symbol.minsym = msymbol; + return found_symbol; + } } } } - return NULL; + return found_symbol; } /* Search through the minimal symbol table for each objfile and find diff --git a/gdb/minsyms.h b/gdb/minsyms.h index f201a73..a11b5e8 100644 --- a/gdb/minsyms.h +++ b/gdb/minsyms.h @@ -164,17 +164,17 @@ unsigned int msymbol_hash_iw (const char *); /* Look through all the current minimal symbol tables and find the first minimal symbol that matches NAME. If OBJF is non-NULL, limit - the search to that objfile. If SFILE is non-NULL, the only file-scope - symbols considered will be from that source file (global symbols are - still preferred). Returns a pointer to the minimal symbol that - matches, or NULL if no match is found. */ + the search to that objfile. If SFILE is non-NULL, the only + file-scope symbols considered will be from that source file (global + symbols are still preferred). Returns a bound minimal symbol that + matches, or an empty bound minimal symbol if no match is found. */ -struct minimal_symbol *lookup_minimal_symbol (const char *, - const char *, - struct objfile *); +struct bound_minimal_symbol lookup_minimal_symbol (const char *, + const char *, + struct objfile *); -/* Like lookup_minimal_symbol, but searches all files and objfiles - and returns a bound minimal symbol. */ +/* Like lookup_minimal_symbol, but searches all files and + objfiles. */ struct bound_minimal_symbol lookup_bound_minimal_symbol (const char *); @@ -185,13 +185,14 @@ struct bound_minimal_symbol lookup_minimal_symbol_and_objfile (const char *); /* Look through all the current minimal symbol tables and find the first minimal symbol that matches NAME and has text type. If OBJF - is non-NULL, limit the search to that objfile. Returns a pointer - to the minimal symbol that matches, or NULL if no match is found. + is non-NULL, limit the search to that objfile. Returns a bound + minimal symbol that matches, or an "empty" bound minimal symbol + otherwise. This function only searches the mangled (linkage) names. */ -struct minimal_symbol *lookup_minimal_symbol_text (const char *, - struct objfile *); +struct bound_minimal_symbol lookup_minimal_symbol_text (const char *, + struct objfile *); /* Look through all the current minimal symbol tables and find the first minimal symbol that matches NAME and is a solib trampoline. @@ -201,7 +202,7 @@ struct minimal_symbol *lookup_minimal_symbol_text (const char *, This function only searches the mangled (linkage) names. */ -struct minimal_symbol *lookup_minimal_symbol_solib_trampoline +struct bound_minimal_symbol lookup_minimal_symbol_solib_trampoline (const char *, struct objfile *); diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 91ef012..89c578e 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -822,11 +822,11 @@ mips_linux_in_dynsym_resolve_code (CORE_ADDR pc) static CORE_ADDR mips_linux_skip_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) { - struct minimal_symbol *resolver; + struct bound_minimal_symbol resolver; resolver = lookup_minimal_symbol ("__dl_runtime_resolve", NULL, NULL); - if (resolver && MSYMBOL_VALUE_ADDRESS (resolver) == pc) + if (resolver.minsym && MSYMBOL_VALUE_ADDRESS (resolver.minsym) == pc) return frame_unwind_caller_pc (get_current_frame ()); return glibc_skip_solib_resolver (gdbarch, pc); diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index e1f2b14..54a5acf 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -120,9 +120,9 @@ lookup_objc_class (struct gdbarch *gdbarch, char *classname) return 0; } - if (lookup_minimal_symbol("objc_lookUpClass", 0, 0)) + if (lookup_minimal_symbol("objc_lookUpClass", 0, 0).minsym) function = find_function_in_inferior("objc_lookUpClass", NULL); - else if (lookup_minimal_symbol ("objc_lookup_class", 0, 0)) + else if (lookup_minimal_symbol ("objc_lookup_class", 0, 0).minsym) function = find_function_in_inferior("objc_lookup_class", NULL); else { @@ -149,9 +149,9 @@ lookup_child_selector (struct gdbarch *gdbarch, char *selname) return 0; } - if (lookup_minimal_symbol("sel_getUid", 0, 0)) + if (lookup_minimal_symbol("sel_getUid", 0, 0).minsym) function = find_function_in_inferior("sel_getUid", NULL); - else if (lookup_minimal_symbol ("sel_get_any_uid", 0, 0)) + else if (lookup_minimal_symbol ("sel_get_any_uid", 0, 0).minsym) function = find_function_in_inferior("sel_get_any_uid", NULL); else { @@ -181,17 +181,17 @@ value_nsstring (struct gdbarch *gdbarch, char *ptr, int len) stringValue[2] = value_string(ptr, len, char_type); stringValue[2] = value_coerce_array(stringValue[2]); /* _NSNewStringFromCString replaces "istr" after Lantern2A. */ - if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0)) + if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0).minsym) { function = find_function_in_inferior("_NSNewStringFromCString", NULL); nsstringValue = call_function_by_hand(function, 1, &stringValue[2]); } - else if (lookup_minimal_symbol("istr", 0, 0)) + else if (lookup_minimal_symbol("istr", 0, 0).minsym) { function = find_function_in_inferior("istr", NULL); nsstringValue = call_function_by_hand(function, 1, &stringValue[2]); } - else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0)) + else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0).minsym) { function = find_function_in_inferior("+[NSString stringWithCString:]", NULL); @@ -1152,11 +1152,12 @@ find_imps (const char *method, VEC (const_char_ptr) **symbol_names) SYMBOL_NATURAL_NAME (sym)); else { - struct minimal_symbol *msym = lookup_minimal_symbol (selector, 0, 0); + struct bound_minimal_symbol msym + = lookup_minimal_symbol (selector, 0, 0); - if (msym != NULL) + if (msym.minsym != NULL) VEC_safe_push (const_char_ptr, *symbol_names, - MSYMBOL_NATURAL_NAME (msym)); + MSYMBOL_NATURAL_NAME (msym.minsym)); } } diff --git a/gdb/obsd-tdep.c b/gdb/obsd-tdep.c index a0bf462..fc100e2 100644 --- a/gdb/obsd-tdep.c +++ b/gdb/obsd-tdep.c @@ -26,10 +26,10 @@ CORE_ADDR obsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; msym = lookup_minimal_symbol("_dl_bind", NULL, NULL); - if (msym && MSYMBOL_VALUE_ADDRESS (msym) == pc) + if (msym.minsym && MSYMBOL_VALUE_ADDRESS (msym.minsym) == pc) return frame_unwind_caller_pc (get_current_frame ()); else return find_solib_trampoline_target (get_current_frame (), pc); diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 27ea4ce..856beb3 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -59,23 +59,23 @@ static const char GPC_MAIN_PROGRAM_NAME_2[] = "pascal_main_program"; const char * pascal_main_name (void) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; msym = lookup_minimal_symbol (GPC_P_INITIALIZE, NULL, NULL); /* If '_p_initialize' was not found, the main program is likely not written in Pascal. */ - if (msym == NULL) + if (msym.minsym == NULL) return NULL; msym = lookup_minimal_symbol (GPC_MAIN_PROGRAM_NAME_1, NULL, NULL); - if (msym != NULL) + if (msym.minsym != NULL) { return GPC_MAIN_PROGRAM_NAME_1; } msym = lookup_minimal_symbol (GPC_MAIN_PROGRAM_NAME_2, NULL, NULL); - if (msym != NULL) + if (msym.minsym != NULL) { return GPC_MAIN_PROGRAM_NAME_2; } diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 66cbba3..dee6938 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1011,7 +1011,7 @@ static CORE_ADDR spe_context_cache_address; static void ppc_linux_spe_context_lookup (struct objfile *objfile) { - struct minimal_symbol *sym; + struct bound_minimal_symbol sym; if (!objfile) { @@ -1024,11 +1024,11 @@ ppc_linux_spe_context_lookup (struct objfile *objfile) } sym = lookup_minimal_symbol ("__spe_current_active_context", NULL, objfile); - if (sym) + if (sym.minsym) { spe_context_objfile = objfile; spe_context_lm_addr = svr4_fetch_objfile_link_map (objfile); - spe_context_offset = MSYMBOL_VALUE_ADDRESS (sym); + spe_context_offset = MSYMBOL_VALUE_ADDRESS (sym.minsym); spe_context_cache_ptid = minus_one_ptid; spe_context_cache_address = 0; return; diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 9cc9a43..124e4fa 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -1076,7 +1076,7 @@ convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr) { struct obj_section *dot_fn_section; struct bound_minimal_symbol dot_fn; - struct minimal_symbol *fn; + struct bound_minimal_symbol fn; /* Find the minimal symbol that corresponds to CODE_ADDR (should have a name of the form ".FN"). */ @@ -1094,10 +1094,10 @@ convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr) contain a minimal symbol with the same name. */ fn = lookup_minimal_symbol (MSYMBOL_LINKAGE_NAME (dot_fn.minsym) + 1, NULL, dot_fn_section->objfile); - if (fn == NULL) + if (fn.minsym == NULL) return 0; /* Found a descriptor. */ - (*desc_addr) = MSYMBOL_VALUE_ADDRESS (fn); + (*desc_addr) = MSYMBOL_VALUE_ADDRESS (fn.minsym); return 1; } diff --git a/gdb/proc-service.c b/gdb/proc-service.c index 2a21e78..96e4fe0 100644 --- a/gdb/proc-service.c +++ b/gdb/proc-service.c @@ -194,7 +194,7 @@ ps_err_e ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *obj, const char *name, psaddr_t *sym_addr) { - struct minimal_symbol *ms; + struct bound_minimal_symbol ms; struct cleanup *old_chain = save_current_program_space (); struct inferior *inf = find_inferior_pid (ptid_get_pid (ph->ptid)); ps_err_e result; @@ -203,11 +203,11 @@ ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *obj, /* FIXME: kettenis/2000-09-03: What should we do with OBJ? */ ms = lookup_minimal_symbol (name, NULL, NULL); - if (ms == NULL) + if (ms.minsym == NULL) result = PS_NOSYM; else { - *sym_addr = core_addr_to_ps_addr (MSYMBOL_VALUE_ADDRESS (ms)); + *sym_addr = core_addr_to_ps_addr (MSYMBOL_VALUE_ADDRESS (ms.minsym)); result = PS_OK; } diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 4ed007d..d150412 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -102,13 +102,13 @@ ravenscar_update_inferior_ptid (void) and return its associated minimal symbol. Return NULL if not found. */ -static struct minimal_symbol * +static struct bound_minimal_symbol get_running_thread_msymbol (void) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; msym = lookup_minimal_symbol (running_thread_name, NULL, NULL); - if (!msym) + if (!msym.minsym) /* Older versions of the GNAT runtime were using a different (less ideal) name for the symbol where the active thread ID is stored. If we couldn't find the symbol using the latest @@ -124,17 +124,18 @@ get_running_thread_msymbol (void) static int has_ravenscar_runtime (void) { - struct minimal_symbol *msym_ravenscar_runtime_initializer = + struct bound_minimal_symbol msym_ravenscar_runtime_initializer = lookup_minimal_symbol (ravenscar_runtime_initializer, NULL, NULL); - struct minimal_symbol *msym_known_tasks = + struct bound_minimal_symbol msym_known_tasks = lookup_minimal_symbol (known_tasks_name, NULL, NULL); - struct minimal_symbol *msym_first_task = + struct bound_minimal_symbol msym_first_task = lookup_minimal_symbol (first_task_name, NULL, NULL); - struct minimal_symbol *msym_running_thread = get_running_thread_msymbol (); + struct bound_minimal_symbol msym_running_thread + = get_running_thread_msymbol (); - return (msym_ravenscar_runtime_initializer - && (msym_known_tasks || msym_first_task) - && msym_running_thread); + return (msym_ravenscar_runtime_initializer.minsym + && (msym_known_tasks.minsym || msym_first_task.minsym) + && msym_running_thread.minsym); } /* Return True if the Ada Ravenscar run-time can be found in the @@ -152,7 +153,7 @@ ravenscar_runtime_initialized (void) static CORE_ADDR get_running_thread_id (void) { - const struct minimal_symbol *object_msym = get_running_thread_msymbol (); + struct bound_minimal_symbol object_msym = get_running_thread_msymbol (); int object_size; int buf_size; gdb_byte *buf; @@ -160,10 +161,10 @@ get_running_thread_id (void) struct type *builtin_type_void_data_ptr = builtin_type (target_gdbarch ())->builtin_data_ptr; - if (!object_msym) + if (!object_msym.minsym) return 0; - object_addr = MSYMBOL_VALUE_ADDRESS (object_msym); + object_addr = MSYMBOL_VALUE_ADDRESS (object_msym.minsym); object_size = TYPE_LENGTH (builtin_type_void_data_ptr); buf_size = object_size; buf = alloca (buf_size); diff --git a/gdb/remote.c b/gdb/remote.c index 9f9a1e4..8e9ef64 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -3670,7 +3670,7 @@ remote_check_symbols (void) { struct remote_state *rs = get_remote_state (); char *msg, *reply, *tmp; - struct minimal_symbol *sym; + struct bound_minimal_symbol sym; int end; /* The remote side has no concept of inferiors that aren't running @@ -3705,12 +3705,12 @@ remote_check_symbols (void) end = hex2bin (tmp, (gdb_byte *) msg, strlen (tmp) / 2); msg[end] = '\0'; sym = lookup_minimal_symbol (msg, NULL, NULL); - if (sym == NULL) + if (sym.minsym == NULL) xsnprintf (msg, get_remote_packet_size (), "qSymbol::%s", &reply[8]); else { int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8; - CORE_ADDR sym_addr = MSYMBOL_VALUE_ADDRESS (sym); + CORE_ADDR sym_addr = MSYMBOL_VALUE_ADDRESS (sym.minsym); /* If this is a function address, return the start of code instead of any data function descriptor. */ diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 56d023b..599ef64 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -762,13 +762,13 @@ ps_err_e ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *ld_object_name, const char *ld_symbol_name, gdb_ps_addr_t *ld_symbol_addr) { - struct minimal_symbol *ms; + struct bound_minimal_symbol ms; ms = lookup_minimal_symbol (ld_symbol_name, NULL, NULL); - if (!ms) + if (!ms.minsym) return PS_NOSYM; - *ld_symbol_addr = SYMBOL_VALUE_ADDRESS (ms); + *ld_symbol_addr = SYMBOL_VALUE_ADDRESS (ms.minsym); return PS_OK; } diff --git a/gdb/sol2-tdep.c b/gdb/sol2-tdep.c index 27108a5..a4efd42 100644 --- a/gdb/sol2-tdep.c +++ b/gdb/sol2-tdep.c @@ -27,10 +27,10 @@ CORE_ADDR sol2_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; msym = lookup_minimal_symbol("elf_bndr", NULL, NULL); - if (msym && MSYMBOL_VALUE_ADDRESS (msym) == pc) + if (msym.minsym && MSYMBOL_VALUE_ADDRESS (msym.minsym) == pc) return frame_unwind_caller_pc (get_current_frame ()); return 0; diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index a5ceb95..61ccc4a 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -550,7 +550,7 @@ static CORE_ADDR lm_base (void) { enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - struct minimal_symbol *got_sym; + struct bound_minimal_symbol got_sym; CORE_ADDR addr; gdb_byte buf[TIC6X_PTR_SIZE]; struct dsbt_info *info = get_dsbt_info (); @@ -570,9 +570,9 @@ lm_base (void) got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, symfile_objfile); - if (got_sym != 0) + if (got_sym.minsym != 0) { - addr = MSYMBOL_VALUE_ADDRESS (got_sym); + addr = MSYMBOL_VALUE_ADDRESS (got_sym.minsym); if (solib_dsbt_debug) fprintf_unfiltered (gdb_stdlog, "lm_base: get addr %x by _GLOBAL_OFFSET_TABLE_.\n", diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index acd46da..0b111bc 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -266,7 +266,7 @@ static CORE_ADDR lm_base (void) { enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - struct minimal_symbol *got_sym; + struct bound_minimal_symbol got_sym; CORE_ADDR addr; gdb_byte buf[FRV_PTR_SIZE]; @@ -284,7 +284,7 @@ lm_base (void) got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, symfile_objfile); - if (got_sym == 0) + if (got_sym.minsym == 0) { if (solib_frv_debug) fprintf_unfiltered (gdb_stdlog, @@ -292,7 +292,7 @@ lm_base (void) return 0; } - addr = MSYMBOL_VALUE_ADDRESS (got_sym) + 8; + addr = MSYMBOL_VALUE_ADDRESS (got_sym.minsym) + 8; if (solib_frv_debug) fprintf_unfiltered (gdb_stdlog, @@ -919,14 +919,14 @@ frv_relocate_section_addresses (struct so_list *so, static CORE_ADDR main_got (void) { - struct minimal_symbol *got_sym; + struct bound_minimal_symbol got_sym; got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, symfile_objfile); - if (got_sym == 0) + if (got_sym.minsym == 0) return 0; - return MSYMBOL_VALUE_ADDRESS (got_sym); + return MSYMBOL_VALUE_ADDRESS (got_sym.minsym); } /* Find the global pointer for the given function address ADDR. */ diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c index 8eda4d4..d6a4c69 100644 --- a/gdb/solib-irix.c +++ b/gdb/solib-irix.c @@ -281,13 +281,13 @@ static CORE_ADDR debug_base; /* Base of dynamic linker structures. */ static CORE_ADDR locate_base (void) { - struct minimal_symbol *msymbol; + struct bound_minimal_symbol msymbol; CORE_ADDR address = 0; msymbol = lookup_minimal_symbol (DEBUG_BASE, NULL, symfile_objfile); - if ((msymbol != NULL) && (MSYMBOL_VALUE_ADDRESS (msymbol) != 0)) + if ((msymbol.minsym != NULL) && (MSYMBOL_VALUE_ADDRESS (msymbol.minsym) != 0)) { - address = MSYMBOL_VALUE_ADDRESS (msymbol); + address = MSYMBOL_VALUE_ADDRESS (msymbol.minsym); } return (address); } 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); diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c index b4aa7a4..a4cefad 100644 --- a/gdb/solib-spu.c +++ b/gdb/solib-spu.c @@ -408,7 +408,7 @@ spu_lookup_lib_symbol (const struct objfile *objfile, static int spu_enable_break (struct objfile *objfile) { - struct minimal_symbol *spe_event_sym = NULL; + struct bound_minimal_symbol spe_event_sym; /* The libspe library will call __spe_context_update_event whenever any SPE context is allocated or destroyed. */ @@ -416,9 +416,9 @@ spu_enable_break (struct objfile *objfile) NULL, objfile); /* Place a solib_event breakpoint on the symbol. */ - if (spe_event_sym) + if (spe_event_sym.minsym) { - CORE_ADDR addr = MSYMBOL_VALUE_ADDRESS (spe_event_sym); + CORE_ADDR addr = MSYMBOL_VALUE_ADDRESS (spe_event_sym.minsym); addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), addr, ¤t_target); @@ -434,8 +434,8 @@ spu_enable_break (struct objfile *objfile) static void ocl_enable_break (struct objfile *objfile) { - struct minimal_symbol *event_sym = NULL; - struct minimal_symbol *addr_sym = NULL; + struct bound_minimal_symbol event_sym; + struct bound_minimal_symbol addr_sym; /* The OpenCL runtime on the SPU will call __opencl_program_update_event whenever an OpenCL program is loaded. */ @@ -445,10 +445,10 @@ ocl_enable_break (struct objfile *objfile) at opencl_elf_image_address. */ addr_sym = lookup_minimal_symbol ("opencl_elf_image_address", NULL, objfile); - if (event_sym && addr_sym) + if (event_sym.minsym && addr_sym.minsym) { /* Place a solib_event breakpoint on the symbol. */ - CORE_ADDR event_addr = MSYMBOL_VALUE_ADDRESS (event_sym); + CORE_ADDR event_addr = MSYMBOL_VALUE_ADDRESS (event_sym.minsym); create_solib_event_breakpoint (get_objfile_arch (objfile), event_addr); /* Store the address of the symbol that will point to OpenCL program @@ -459,7 +459,7 @@ ocl_enable_break (struct objfile *objfile) &objfile->objfile_obstack, objfile->sections_end - objfile->sections, CORE_ADDR); - *ocl_program_addr_base = MSYMBOL_VALUE_ADDRESS (addr_sym); + *ocl_program_addr_base = MSYMBOL_VALUE_ADDRESS (addr_sym.minsym); set_objfile_data (objfile, ocl_program_data_key, ocl_program_addr_base); } diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 3434e80..4be0807 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -787,7 +787,7 @@ scan_dyntag_auxv (int dyntag, CORE_ADDR *ptr) static CORE_ADDR elf_locate_base (void) { - struct minimal_symbol *msymbol; + struct bound_minimal_symbol msymbol; CORE_ADDR dyn_ptr; /* Look for DT_MIPS_RLD_MAP first. MIPS executables use this @@ -816,8 +816,8 @@ elf_locate_base (void) /* This may be a static executable. Look for the symbol conventionally named _r_debug, as a last resort. */ msymbol = lookup_minimal_symbol ("_r_debug", NULL, symfile_objfile); - if (msymbol != NULL) - return MSYMBOL_VALUE_ADDRESS (msymbol); + if (msymbol.minsym != NULL) + return MSYMBOL_VALUE_ADDRESS (msymbol.minsym); /* DT_DEBUG entry not found. */ return 0; @@ -2091,7 +2091,7 @@ cmp_name_and_sec_flags (asymbol *sym, void *data) static int enable_break (struct svr4_info *info, int from_tty) { - struct minimal_symbol *msymbol; + struct bound_minimal_symbol msymbol; const char * const *bkpt_namep; asection *interp_sect; char *interp_name; @@ -2348,9 +2348,10 @@ enable_break (struct svr4_info *info, int from_tty) for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++) { msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile); - if ((msymbol != NULL) && (MSYMBOL_VALUE_ADDRESS (msymbol) != 0)) + if ((msymbol.minsym != NULL) + && (MSYMBOL_VALUE_ADDRESS (msymbol.minsym) != 0)) { - sym_addr = MSYMBOL_VALUE_ADDRESS (msymbol); + sym_addr = MSYMBOL_VALUE_ADDRESS (msymbol.minsym); sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), sym_addr, ¤t_target); @@ -2364,9 +2365,10 @@ enable_break (struct svr4_info *info, int from_tty) for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++) { msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile); - if ((msymbol != NULL) && (MSYMBOL_VALUE_ADDRESS (msymbol) != 0)) + if ((msymbol.minsym != NULL) + && (MSYMBOL_VALUE_ADDRESS (msymbol.minsym) != 0)) { - sym_addr = MSYMBOL_VALUE_ADDRESS (msymbol); + sym_addr = MSYMBOL_VALUE_ADDRESS (msymbol.minsym); sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), sym_addr, ¤t_target); diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index e4244ee..157f37b 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -1747,7 +1747,7 @@ spu_get_overlay_table (struct objfile *objfile) { enum bfd_endian byte_order = bfd_big_endian (objfile->obfd)? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE; - struct minimal_symbol *ovly_table_msym, *ovly_buf_table_msym; + struct bound_minimal_symbol ovly_table_msym, ovly_buf_table_msym; CORE_ADDR ovly_table_base, ovly_buf_table_base; unsigned ovly_table_size, ovly_buf_table_size; struct spu_overlay_table *tbl; @@ -1760,19 +1760,19 @@ spu_get_overlay_table (struct objfile *objfile) return tbl; ovly_table_msym = lookup_minimal_symbol ("_ovly_table", NULL, objfile); - if (!ovly_table_msym) + if (!ovly_table_msym.minsym) return NULL; ovly_buf_table_msym = lookup_minimal_symbol ("_ovly_buf_table", NULL, objfile); - if (!ovly_buf_table_msym) + if (!ovly_buf_table_msym.minsym) return NULL; - ovly_table_base = MSYMBOL_VALUE_ADDRESS (ovly_table_msym); - ovly_table_size = MSYMBOL_SIZE (ovly_table_msym); + ovly_table_base = MSYMBOL_VALUE_ADDRESS (ovly_table_msym.minsym); + ovly_table_size = MSYMBOL_SIZE (ovly_table_msym.minsym); - ovly_buf_table_base = MSYMBOL_VALUE_ADDRESS (ovly_buf_table_msym); - ovly_buf_table_size = MSYMBOL_SIZE (ovly_buf_table_msym); + ovly_buf_table_base = MSYMBOL_VALUE_ADDRESS (ovly_buf_table_msym.minsym); + ovly_buf_table_size = MSYMBOL_SIZE (ovly_buf_table_msym.minsym); ovly_table = xmalloc (ovly_table_size); read_memory (ovly_table_base, ovly_table, ovly_table_size); @@ -1898,7 +1898,7 @@ spu_overlay_new_objfile (struct objfile *objfile) static void spu_catch_start (struct objfile *objfile) { - struct minimal_symbol *minsym; + struct bound_minimal_symbol minsym; struct symtab *symtab; CORE_ADDR pc; char buf[32]; @@ -1918,13 +1918,14 @@ spu_catch_start (struct objfile *objfile) /* There can be multiple symbols named "main". Search for the "main" in *this* objfile. */ minsym = lookup_minimal_symbol ("main", NULL, objfile); - if (!minsym) + if (!minsym.minsym) return; /* If we have debugging information, try to use it -- this will allow us to properly skip the prologue. */ - pc = MSYMBOL_VALUE_ADDRESS (minsym); - symtab = find_pc_sect_symtab (pc, MSYMBOL_OBJ_SECTION (objfile, minsym)); + pc = MSYMBOL_VALUE_ADDRESS (minsym.minsym); + symtab = find_pc_sect_symtab (pc, MSYMBOL_OBJ_SECTION (minsym.objfile, + minsym.minsym)); if (symtab != NULL) { struct blockvector *bv = BLOCKVECTOR (symtab); @@ -1981,7 +1982,7 @@ spu_objfile_from_frame (struct frame_info *frame) static void flush_ea_cache (void) { - struct minimal_symbol *msymbol; + struct bound_minimal_symbol msymbol; struct objfile *obj; if (!has_stack_frames ()) @@ -1993,7 +1994,7 @@ flush_ea_cache (void) /* Lookup inferior function __cache_flush. */ msymbol = lookup_minimal_symbol ("__cache_flush", NULL, obj); - if (msymbol != NULL) + if (msymbol.minsym != NULL) { struct type *type; CORE_ADDR addr; @@ -2001,7 +2002,7 @@ flush_ea_cache (void) type = objfile_type (obj)->builtin_void; type = lookup_function_type (type); type = lookup_pointer_type (type); - addr = MSYMBOL_VALUE_ADDRESS (msymbol); + addr = MSYMBOL_VALUE_ADDRESS (msymbol.minsym); call_function_by_hand (value_from_pointer (type, addr), 0, NULL); } diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 78766c0..b5bec10 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1168,17 +1168,17 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_LINKAGE_NAME (sym)) != SYMBOL_LINKAGE_NAME (sym)) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, objfile); - if (msym != NULL) + if (msym.minsym != NULL) { const char *new_name = gdbarch_static_transform_name (gdbarch, SYMBOL_LINKAGE_NAME (sym)); SYMBOL_SET_LINKAGE_NAME (sym, new_name); - SYMBOL_VALUE_ADDRESS (sym) = MSYMBOL_VALUE_ADDRESS (msym); + SYMBOL_VALUE_ADDRESS (sym) = MSYMBOL_VALUE_ADDRESS (msym.minsym); } } SYMBOL_DOMAIN (sym) = VAR_DOMAIN; @@ -1360,17 +1360,17 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_LINKAGE_NAME (sym)) != SYMBOL_LINKAGE_NAME (sym)) { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, objfile); - if (msym != NULL) + if (msym.minsym != NULL) { const char *new_name = gdbarch_static_transform_name (gdbarch, SYMBOL_LINKAGE_NAME (sym)); SYMBOL_SET_LINKAGE_NAME (sym, new_name); - SYMBOL_VALUE_ADDRESS (sym) = MSYMBOL_VALUE_ADDRESS (msym); + SYMBOL_VALUE_ADDRESS (sym) = MSYMBOL_VALUE_ADDRESS (msym.minsym); } } SYMBOL_DOMAIN (sym) = VAR_DOMAIN; diff --git a/gdb/symfile.c b/gdb/symfile.c index 7420643..b8d4479 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3532,7 +3532,7 @@ read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr, static int simple_read_overlay_table (void) { - struct minimal_symbol *novlys_msym; + struct bound_minimal_symbol novlys_msym; struct bound_minimal_symbol ovly_table_msym; struct gdbarch *gdbarch; int word_size; @@ -3540,7 +3540,7 @@ simple_read_overlay_table (void) simple_free_overlay_table (); novlys_msym = lookup_minimal_symbol ("_novlys", NULL, NULL); - if (! novlys_msym) + if (! novlys_msym.minsym) { error (_("Error reading inferior's overlay table: " "couldn't find `_novlys' variable\n" @@ -3561,8 +3561,9 @@ simple_read_overlay_table (void) word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT; byte_order = gdbarch_byte_order (gdbarch); - cache_novlys = read_memory_integer (MSYMBOL_VALUE_ADDRESS (novlys_msym), - 4, byte_order); + cache_novlys + = read_memory_integer (MSYMBOL_VALUE_ADDRESS (novlys_msym.minsym), + 4, byte_order); cache_ovly_table = (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table)); cache_ovly_table_base = MSYMBOL_VALUE_ADDRESS (ovly_table_msym.minsym); @@ -3633,15 +3634,15 @@ simple_overlay_update (struct obj_section *osect) { /* Does its cached location match what's currently in the symtab? */ - struct minimal_symbol *minsym + struct bound_minimal_symbol minsym = lookup_minimal_symbol ("_ovly_table", NULL, NULL); - if (minsym == NULL) + if (minsym.minsym == NULL) error (_("Error reading inferior's overlay table: couldn't " "find `_ovly_table' array\n" "in inferior. Use `overlay manual' mode.")); - if (cache_ovly_table_base == MSYMBOL_VALUE_ADDRESS (minsym)) + if (cache_ovly_table_base == MSYMBOL_VALUE_ADDRESS (minsym.minsym)) /* Then go ahead and try to look up this single section in the cache. */ if (simple_overlay_update_1 (osect)) diff --git a/gdb/symtab.c b/gdb/symtab.c index 326f4c9..65d7188 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2379,7 +2379,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) { mfunsym = lookup_minimal_symbol_text (MSYMBOL_LINKAGE_NAME (msymbol.minsym), - NULL); + NULL).minsym; if (mfunsym == NULL) /* I eliminated this warning since it is coming out * in the following situation: diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 13e132f..bd3e9d0 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2701,7 +2701,7 @@ scope_info (char *args, int from_tty) { struct symtabs_and_lines sals; struct symbol *sym; - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; struct block *block; const char *symname; char *save_args = args; @@ -2824,14 +2824,14 @@ scope_info (char *args, int from_tty) case LOC_UNRESOLVED: msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, NULL); - if (msym == NULL) + if (msym.minsym == NULL) printf_filtered ("Unresolved Static"); else { printf_filtered ("static storage at address "); printf_filtered ("%s", paddress (gdbarch, - MSYMBOL_VALUE_ADDRESS (msym))); + MSYMBOL_VALUE_ADDRESS (msym.minsym))); } break; case LOC_OPTIMIZED_OUT: diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index ee629f3..e0ea183 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -339,17 +339,17 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p) if (element->addr == 0) { - struct minimal_symbol *main_symbol; + struct bound_minimal_symbol main_symbol; /* Find address of the start of program. Note: this should be language specific. */ main_symbol = lookup_minimal_symbol ("main", NULL, NULL); - if (main_symbol == 0) + if (main_symbol.minsym == 0) main_symbol = lookup_minimal_symbol ("MAIN", NULL, NULL); - if (main_symbol == 0) + if (main_symbol.minsym == 0) main_symbol = lookup_minimal_symbol ("_start", NULL, NULL); - if (main_symbol) - addr = MSYMBOL_VALUE_ADDRESS (main_symbol); + if (main_symbol.minsym) + addr = MSYMBOL_VALUE_ADDRESS (main_symbol.minsym); else addr = 0; } diff --git a/gdb/value.c b/gdb/value.c index 0ee29f5..1dfc6d5 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2750,15 +2750,15 @@ value_static_field (struct type *type, int fieldno) { /* With some compilers, e.g. HP aCC, static data members are reported as non-debuggable symbols. */ - struct minimal_symbol *msym = lookup_minimal_symbol (phys_name, - NULL, NULL); + struct bound_minimal_symbol msym + = lookup_minimal_symbol (phys_name, NULL, NULL); - if (!msym) + if (!msym.minsym) return allocate_optimized_out_value (type); else { retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), - MSYMBOL_VALUE_ADDRESS (msym)); + MSYMBOL_VALUE_ADDRESS (msym.minsym)); } } else |