diff options
-rw-r--r-- | gdb/ChangeLog | 39 | ||||
-rw-r--r-- | gdb/blockframe.c | 4 | ||||
-rw-r--r-- | gdb/breakpoint.c | 4 | ||||
-rw-r--r-- | gdb/elfread.c | 4 | ||||
-rw-r--r-- | gdb/findvar.c | 18 | ||||
-rw-r--r-- | gdb/hppa-hpux-tdep.c | 2 | ||||
-rw-r--r-- | gdb/infcmd.c | 4 | ||||
-rw-r--r-- | gdb/linespec.c | 2 | ||||
-rw-r--r-- | gdb/maint.c | 2 | ||||
-rw-r--r-- | gdb/minsyms.c | 10 | ||||
-rw-r--r-- | gdb/parse.c | 2 | ||||
-rw-r--r-- | gdb/printcmd.c | 18 | ||||
-rw-r--r-- | gdb/psymtab.c | 14 | ||||
-rw-r--r-- | gdb/spu-tdep.c | 2 | ||||
-rw-r--r-- | gdb/stabsread.c | 13 | ||||
-rw-r--r-- | gdb/symmisc.c | 5 | ||||
-rw-r--r-- | gdb/symtab.c | 40 | ||||
-rw-r--r-- | gdb/symtab.h | 15 |
18 files changed, 124 insertions, 74 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 11a8cf3..de9ae90 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,44 @@ 2013-04-08 Tom Tromey <tromey@redhat.com> + PR symtab/8424: + * blockframe.c (find_pc_partial_function_gnu_ifunc): Check + SYMBOL_SECTION, not SYMBOL_OBJ_SECTION. + * breakpoint.c (resolve_sal_pc): Update. + * elfread.c (elf_gnu_ifunc_record_cache): Update. + * findvar.c (struct minsym_lookup_data) <objfile>: New field. + (minsym_lookup_iterator_cb): Use it. + (default_read_var_value): Update. + * hppa-hpux-tdep.c (hppa64_hpux_in_solib_call_trampoline): + Update. + * infcmd.c (jump_command): Update. + * linespec.c (minsym_found): Update. + * maint.c (maintenance_translate_address): Update. + * minsyms.c (lookup_minimal_symbol_by_pc_section_1): Update. + (prim_record_minimal_symbol_full): Don't set SYMBOL_OBJ_SECTION. + * parse.c (write_exp_msymbol): Update. + * printcmd.c (address_info): Update. + * psymtab.c (find_pc_sect_psymbol): Update. + (fixup_psymbol_section): Check SYMBOL_SECTION, not + SYMBOL_OBJ_SECTION. + (add_psymbol_to_bcache): Correctly initialize SYMBOL_SECTION. + Don't initialize SYMBOL_OBJ_SECTION. + * spu-tdep.c (spu_catch_start): Update. + * stabsread.c (define_symbol): Don't set SYMBOL_SECTION. + * symmisc.c (dump_msymbols, print_symbol): Update. + * symtab.c (fixup_section): Don't set 'obj_section'. Change + how fallback section is computed. + (fixup_symbol_section): Update. + (find_pc_sect_symtab, find_function_start_sal, skip_prologue_sal): + Update. + (allocate_symbol, initialize_symbol, allocate_template_symbol): + Initialize SYMBOL_SECTION. + * symtab.h (struct general_symbol_info) <section>: Update comment. + <obj_section>: Remove. + (SYMBOL_OBJ_SECTION): Add 'objfile' argument. Rewrite. + (SYMBOL_OBJFILE): New macro. + +2013-04-08 Tom Tromey <tromey@redhat.com> + * coffread.c (record_minimal_symbol): Update. * dbxread.c (record_minimal_symbol): Update. * elfread.c (record_minimal_symbol): Update. diff --git a/gdb/blockframe.c b/gdb/blockframe.c index aedad3e..40e6c27 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -292,8 +292,8 @@ find_pc_partial_function_gnu_ifunc (CORE_ADDR pc, const char **name, { if (SYMBOL_VALUE_ADDRESS (msymbol + i) != SYMBOL_VALUE_ADDRESS (msymbol) - && SYMBOL_OBJ_SECTION (msymbol + i) - == SYMBOL_OBJ_SECTION (msymbol)) + && SYMBOL_SECTION (msymbol + i) + == SYMBOL_SECTION (msymbol)) break; } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 758a7a9..09933f4 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9814,7 +9814,7 @@ resolve_sal_pc (struct symtab_and_line *sal) if (sym != NULL) { fixup_symbol_section (sym, sal->symtab->objfile); - sal->section = SYMBOL_OBJ_SECTION (sym); + sal->section = SYMBOL_OBJ_SECTION (sal->symtab->objfile, sym); } else { @@ -9830,7 +9830,7 @@ resolve_sal_pc (struct symtab_and_line *sal) msym = lookup_minimal_symbol_by_pc (sal->pc); if (msym.minsym) - sal->section = SYMBOL_OBJ_SECTION (msym.minsym); + sal->section = SYMBOL_OBJ_SECTION (msym.objfile, msym.minsym); do_cleanups (old_chain); } diff --git a/gdb/elfread.c b/gdb/elfread.c index b92ba16..710e9e5 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -752,8 +752,8 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr) if (SYMBOL_VALUE_ADDRESS (msym.minsym) != addr) return 0; /* minimal symbols have always SYMBOL_OBJ_SECTION non-NULL. */ - sect = SYMBOL_OBJ_SECTION (msym.minsym)->the_bfd_section; - objfile = SYMBOL_OBJ_SECTION (msym.minsym)->objfile; + sect = SYMBOL_OBJ_SECTION (msym.objfile, msym.minsym)->the_bfd_section; + objfile = msym.objfile; /* If .plt jumps back to .plt the symbol is still deferred for later resolution and it has no use for GDB. Besides ".text" this symbol can diff --git a/gdb/findvar.c b/gdb/findvar.c index 22be47a..fdce436 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -414,6 +414,9 @@ struct minsym_lookup_data 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; }; /* A callback function for gdbarch_iterate_over_objfiles_in_search_order. @@ -429,6 +432,7 @@ minsym_lookup_iterator_cb (struct objfile *objfile, void *cb_data) gdb_assert (data->result == 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); @@ -475,7 +479,8 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) { CORE_ADDR addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), - SYMBOL_OBJ_SECTION (var)); + SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (var), + var)); store_typed_address (value_contents_raw (v), type, addr); } @@ -496,7 +501,8 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) v = allocate_value_lazy (type); if (overlay_debugging) addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), - SYMBOL_OBJ_SECTION (var)); + SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (var), + var)); else addr = SYMBOL_VALUE_ADDRESS (var); break; @@ -541,7 +547,8 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) v = allocate_value_lazy (type); if (overlay_debugging) addr = symbol_overlayed_address - (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var)); + (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (var), + var)); else addr = BLOCK_START (SYMBOL_BLOCK_VALUE (var)); break; @@ -600,11 +607,12 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) error (_("No global symbol \"%s\"."), SYMBOL_LINKAGE_NAME (var)); if (overlay_debugging) addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (msym), - SYMBOL_OBJ_SECTION (msym)); + SYMBOL_OBJ_SECTION (lookup_data.objfile, + msym)); else addr = SYMBOL_VALUE_ADDRESS (msym); - obj_section = SYMBOL_OBJ_SECTION (msym); + obj_section = SYMBOL_OBJ_SECTION (lookup_data.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/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c index ad9b4fa..e964064 100644 --- a/gdb/hppa-hpux-tdep.c +++ b/gdb/hppa-hpux-tdep.c @@ -184,7 +184,7 @@ hppa64_hpux_in_solib_call_trampoline (struct gdbarch *gdbarch, if (! minsym.minsym) return 0; - sec = SYMBOL_OBJ_SECTION (minsym.minsym)->the_bfd_section; + sec = SYMBOL_OBJ_SECTION (minsym.objfile, minsym.minsym)->the_bfd_section; if (bfd_get_section_vma (sec->owner, sec) <= pc && pc < (bfd_get_section_vma (sec->owner, sec) diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 53e2168..c60f19a 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1170,8 +1170,8 @@ jump_command (char *arg, int from_tty) if (sfn != NULL) { fixup_symbol_section (sfn, 0); - if (section_is_overlay (SYMBOL_OBJ_SECTION (sfn)) && - !section_is_mapped (SYMBOL_OBJ_SECTION (sfn))) + if (section_is_overlay (SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sfn), sfn)) && + !section_is_mapped (SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sfn), sfn))) { if (!query (_("WARNING!!! Destination is in " "unmapped overlay! Jump anyway? "))) diff --git a/gdb/linespec.c b/gdb/linespec.c index 9647d08..1c7a7a0 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3399,7 +3399,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile, sal = find_pc_sect_line (SYMBOL_VALUE_ADDRESS (msymbol), (struct obj_section *) 0, 0); - sal.section = SYMBOL_OBJ_SECTION (msymbol); + sal.section = SYMBOL_OBJ_SECTION (objfile, msymbol); /* The minimal symbol might point to a function descriptor; resolve it to the actual code address instead. */ diff --git a/gdb/maint.c b/gdb/maint.c index ee947bd..63dd25d 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -493,7 +493,7 @@ maintenance_translate_address (char *arg, int from_tty) const char *symbol_offset = pulongest (address - SYMBOL_VALUE_ADDRESS (sym.minsym)); - sect = SYMBOL_OBJ_SECTION(sym.minsym); + sect = SYMBOL_OBJ_SECTION(sym.objfile, sym.minsym); if (sect != NULL) { const char *section_name; diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 396b063..89e538a 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -593,9 +593,10 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc, /* Some types of debug info, such as COFF, don't fill the bfd_section member, so don't throw away symbols on those platforms. */ - && SYMBOL_OBJ_SECTION (&msymbol[hi]) != NULL + && SYMBOL_OBJ_SECTION (objfile, &msymbol[hi]) != NULL && (!matching_obj_sections - (SYMBOL_OBJ_SECTION (&msymbol[hi]), section))) + (SYMBOL_OBJ_SECTION (objfile, &msymbol[hi]), + section))) { hi--; continue; @@ -612,8 +613,8 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc, == MSYMBOL_SIZE (&msymbol[hi - 1])) && (SYMBOL_VALUE_ADDRESS (&msymbol[hi]) == SYMBOL_VALUE_ADDRESS (&msymbol[hi - 1])) - && (SYMBOL_OBJ_SECTION (&msymbol[hi]) - == SYMBOL_OBJ_SECTION (&msymbol[hi - 1]))) + && (SYMBOL_OBJ_SECTION (objfile, &msymbol[hi]) + == SYMBOL_OBJ_SECTION (objfile, &msymbol[hi - 1]))) { hi--; continue; @@ -942,7 +943,6 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name, SYMBOL_VALUE_ADDRESS (msymbol) = address; SYMBOL_SECTION (msymbol) = section; - SYMBOL_OBJ_SECTION (msymbol) = NULL; MSYMBOL_TYPE (msymbol) = ms_type; MSYMBOL_TARGET_FLAG_1 (msymbol) = 0; diff --git a/gdb/parse.c b/gdb/parse.c index ff4ed6c..aa8f09c 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -502,7 +502,7 @@ write_exp_msymbol (struct minimal_symbol *msymbol) struct gdbarch *gdbarch = get_objfile_arch (objfile); CORE_ADDR addr = SYMBOL_VALUE_ADDRESS (msymbol); - struct obj_section *section = SYMBOL_OBJ_SECTION (msymbol); + struct obj_section *section = SYMBOL_OBJ_SECTION (objfile, msymbol); enum minimal_symbol_type type = MSYMBOL_TYPE (msymbol); CORE_ADDR pc; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 6ac0ba5..4f8c9d4 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1219,7 +1219,9 @@ address_info (char *exp, int from_tty) if (msymbol != NULL) { - gdbarch = get_objfile_arch (msymbol_objfile (msymbol)); + struct objfile *objfile = msymbol_objfile (msymbol); + + gdbarch = get_objfile_arch (objfile); load_addr = SYMBOL_VALUE_ADDRESS (msymbol); printf_filtered ("Symbol \""); @@ -1228,7 +1230,7 @@ address_info (char *exp, int from_tty) printf_filtered ("\" is at "); fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); printf_filtered (" in a file compiled without debugging"); - section = SYMBOL_OBJ_SECTION (msymbol); + section = SYMBOL_OBJ_SECTION (objfile, msymbol); if (section_is_overlay (section)) { load_addr = overlay_unmapped_address (load_addr, section); @@ -1249,7 +1251,7 @@ address_info (char *exp, int from_tty) current_language->la_language, DMGL_ANSI); printf_filtered ("\" is "); val = SYMBOL_VALUE (sym); - section = SYMBOL_OBJ_SECTION (sym); + section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym); gdbarch = get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile); if (SYMBOL_COMPUTED_OPS (sym) != NULL) @@ -1354,15 +1356,15 @@ address_info (char *exp, int from_tty) case LOC_UNRESOLVED: { - struct minimal_symbol *msym; + struct bound_minimal_symbol msym; - msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, NULL); - if (msym == NULL) + msym = lookup_minimal_symbol_and_objfile (SYMBOL_LINKAGE_NAME (sym)); + if (msym.minsym == NULL) printf_filtered ("unresolved"); else { - section = SYMBOL_OBJ_SECTION (msym); - load_addr = SYMBOL_VALUE_ADDRESS (msym); + section = SYMBOL_OBJ_SECTION (msym.objfile, msym.minsym); + load_addr = SYMBOL_VALUE_ADDRESS (msym.minsym); if (section && (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) diff --git a/gdb/psymtab.c b/gdb/psymtab.c index e36268d..b799a03 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -429,7 +429,8 @@ find_pc_sect_psymbol (struct objfile *objfile, if (section) /* Match on a specific section. */ { fixup_psymbol_section (p, objfile); - if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section)) + if (!matching_obj_sections (SYMBOL_OBJ_SECTION (objfile, p), + section)) continue; } best_pc = SYMBOL_VALUE_ADDRESS (p); @@ -453,7 +454,8 @@ find_pc_sect_psymbol (struct objfile *objfile, if (section) /* Match on a specific section. */ { fixup_psymbol_section (p, objfile); - if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section)) + if (!matching_obj_sections (SYMBOL_OBJ_SECTION (objfile, p), + section)) continue; } best_pc = SYMBOL_VALUE_ADDRESS (p); @@ -469,7 +471,10 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile) { CORE_ADDR addr; - if (psym == NULL || SYMBOL_OBJ_SECTION (psym) != NULL) + if (!psym) + return; + + if (SYMBOL_SECTION (psym) >= 0) return; gdb_assert (objfile); @@ -1603,8 +1608,7 @@ add_psymbol_to_bcache (const char *name, int namelength, int copy_name, { SYMBOL_VALUE_ADDRESS (&psymbol) = coreaddr; } - SYMBOL_SECTION (&psymbol) = 0; - SYMBOL_OBJ_SECTION (&psymbol) = NULL; + SYMBOL_SECTION (&psymbol) = -1; SYMBOL_SET_LANGUAGE (&psymbol, language, &objfile->objfile_obstack); PSYMBOL_DOMAIN (&psymbol) = domain; PSYMBOL_CLASS (&psymbol) = class; diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index 0cf94e9..4365da1 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -1920,7 +1920,7 @@ spu_catch_start (struct objfile *objfile) /* If we have debugging information, try to use it -- this will allow us to properly skip the prologue. */ pc = SYMBOL_VALUE_ADDRESS (minsym); - symtab = find_pc_sect_symtab (pc, SYMBOL_OBJ_SECTION (minsym)); + symtab = find_pc_sect_symtab (pc, SYMBOL_OBJ_SECTION (objfile, minsym)); if (symtab != NULL) { struct blockvector *bv = BLOCKVECTOR (symtab); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 5fa183f..c63ecc2 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -650,19 +650,6 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, current_symbol = sym = allocate_symbol (objfile); - switch (type & N_TYPE) - { - case N_TEXT: - SYMBOL_SECTION (sym) = SECT_OFF_TEXT (objfile); - break; - case N_DATA: - SYMBOL_SECTION (sym) = SECT_OFF_DATA (objfile); - break; - case N_BSS: - SYMBOL_SECTION (sym) = SECT_OFF_BSS (objfile); - break; - } - if (processing_gcc_compilation) { /* GCC 2.x puts the line number in desc. SunOS apparently puts in the diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 5fa4e4e..4156fc6 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -218,7 +218,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) index = 0; ALL_OBJFILE_MSYMBOLS (objfile, msymbol) { - struct obj_section *section = SYMBOL_OBJ_SECTION (msymbol); + struct obj_section *section = SYMBOL_OBJ_SECTION (objfile, msymbol); switch (MSYMBOL_TYPE (msymbol)) { @@ -464,7 +464,8 @@ print_symbol (void *args) struct symbol *symbol = ((struct print_symbol_args *) args)->symbol; int depth = ((struct print_symbol_args *) args)->depth; struct ui_file *outfile = ((struct print_symbol_args *) args)->outfile; - struct obj_section *section = SYMBOL_OBJ_SECTION (symbol); + struct obj_section *section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (symbol), + symbol); print_spaces (depth, outfile); if (SYMBOL_DOMAIN (symbol) == LABEL_DOMAIN) diff --git a/gdb/symtab.c b/gdb/symtab.c index 2526503..cf4a476 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1018,10 +1018,7 @@ fixup_section (struct general_symbol_info *ginfo, point to the actual function code. */ msym = lookup_minimal_symbol_by_pc_name (addr, ginfo->name, objfile); if (msym) - { - ginfo->obj_section = SYMBOL_OBJ_SECTION (msym); - ginfo->section = SYMBOL_SECTION (msym); - } + ginfo->section = SYMBOL_SECTION (msym); else { /* Static, function-local variables do appear in the linker @@ -1061,20 +1058,31 @@ fixup_section (struct general_symbol_info *ginfo, a search of the section table. */ struct obj_section *s; + int fallback = -1; ALL_OBJFILE_OSECTIONS (objfile, s) { int idx = s - objfile->sections; CORE_ADDR offset = ANOFFSET (objfile->section_offsets, idx); + if (fallback == -1) + fallback = idx; + if (obj_section_addr (s) - offset <= addr && addr < obj_section_endaddr (s) - offset) { - ginfo->obj_section = s; ginfo->section = idx; return; } } + + /* If we didn't find the section, assume it is in the first + section. If there is no allocated section, then it hardly + matters what we pick, so just pick zero. */ + if (fallback == -1) + ginfo->section = 0; + else + ginfo->section = fallback; } } @@ -1086,9 +1094,6 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile) if (!sym) return NULL; - if (SYMBOL_OBJ_SECTION (sym)) - return sym; - /* We either have an OBJFILE, or we can get at it from the sym's symtab. Anything else is a bug. */ gdb_assert (objfile || SYMBOL_SYMTAB (sym)); @@ -1096,6 +1101,9 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile) if (objfile == NULL) objfile = SYMBOL_SYMTAB (sym)->objfile; + if (SYMBOL_OBJ_SECTION (objfile, sym)) + return sym; + /* We should have an objfile by now. */ gdb_assert (objfile); @@ -2131,7 +2139,8 @@ find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section) ALL_BLOCK_SYMBOLS (b, iter, sym) { fixup_symbol_section (sym, objfile); - if (matching_obj_sections (SYMBOL_OBJ_SECTION (sym), section)) + if (matching_obj_sections (SYMBOL_OBJ_SECTION (objfile, sym), + section)) break; } if (sym == NULL) @@ -2763,7 +2772,7 @@ find_function_start_sal (struct symbol *sym, int funfirstline) fixup_symbol_section (sym, NULL); sal = find_pc_sect_line (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)), - SYMBOL_OBJ_SECTION (sym), 0); + SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym), 0); /* We always should have a line for the function start address. If we don't, something is odd. Create a plain SAL refering @@ -2774,7 +2783,7 @@ find_function_start_sal (struct symbol *sym, int funfirstline) init_sal (&sal); sal.pspace = current_program_space; sal.pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)); - sal.section = SYMBOL_OBJ_SECTION (sym); + sal.section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym); } if (funfirstline) @@ -2815,7 +2824,7 @@ skip_prologue_sal (struct symtab_and_line *sal) fixup_symbol_section (sym, NULL); pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)); - section = SYMBOL_OBJ_SECTION (sym); + section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym); name = SYMBOL_LINKAGE_NAME (sym); objfile = SYMBOL_SYMTAB (sym)->objfile; } @@ -2830,10 +2839,10 @@ skip_prologue_sal (struct symtab_and_line *sal) return; } + objfile = msymbol_objfile (msymbol); pc = SYMBOL_VALUE_ADDRESS (msymbol); - section = SYMBOL_OBJ_SECTION (msymbol); + section = SYMBOL_OBJ_SECTION (objfile, msymbol); name = SYMBOL_LINKAGE_NAME (msymbol); - objfile = msymbol_objfile (msymbol); } gdbarch = get_objfile_arch (objfile); @@ -5146,6 +5155,7 @@ void initialize_symbol (struct symbol *sym) { memset (sym, 0, sizeof (*sym)); + SYMBOL_SECTION (sym) = -1; } /* Allocate and initialize a new 'struct symbol' on OBJFILE's @@ -5157,6 +5167,7 @@ allocate_symbol (struct objfile *objfile) struct symbol *result; result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol); + SYMBOL_SECTION (result) = -1; return result; } @@ -5170,6 +5181,7 @@ allocate_template_symbol (struct objfile *objfile) struct template_symbol *result; result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct template_symbol); + SYMBOL_SECTION (&result->base) = -1; return result; } diff --git a/gdb/symtab.h b/gdb/symtab.h index a1da44b..29a12ff 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -165,16 +165,9 @@ struct general_symbol_info /* Which section is this symbol in? This is an index into section_offsets for this objfile. Negative means that the symbol - does not get relocated relative to a section. - Disclaimer: currently this is just used for xcoff, so don't - expect all symbol-reading code to set it correctly (the ELF code - also tries to set it correctly). */ + does not get relocated relative to a section. */ short section; - - /* The section associated with this symbol. It can be NULL. */ - - struct obj_section *obj_section; }; extern void symbol_set_demangled_name (struct general_symbol_info *, @@ -202,7 +195,10 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *); #define SYMBOL_VALUE_CHAIN(symbol) (symbol)->ginfo.value.chain #define SYMBOL_LANGUAGE(symbol) (symbol)->ginfo.language #define SYMBOL_SECTION(symbol) (symbol)->ginfo.section -#define SYMBOL_OBJ_SECTION(symbol) (symbol)->ginfo.obj_section +#define SYMBOL_OBJ_SECTION(objfile, symbol) \ + (((symbol)->ginfo.section >= 0) \ + ? (&(((objfile)->sections)[(symbol)->ginfo.section])) \ + : NULL) /* Initializes the language dependent portion of a symbol depending upon the language for the symbol. */ @@ -731,6 +727,7 @@ extern const struct symbol_impl *symbol_impls; #define SYMBOL_BLOCK_OPS(symbol) (SYMBOL_IMPL (symbol).ops_block) #define SYMBOL_REGISTER_OPS(symbol) (SYMBOL_IMPL (symbol).ops_register) #define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value +#define SYMBOL_OBJFILE(symbol) (SYMBOL_SYMTAB (symbol)->objfile) extern int register_symbol_computed_impl (enum address_class, const struct symbol_computed_ops *); |