diff options
author | Joel Brobecker <brobecker@gnat.com> | 2002-04-22 10:19:35 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2002-04-22 10:19:35 +0000 |
commit | 0e931cf0eed83e9af7fe3eaf10de174d98c93bc0 (patch) | |
tree | 08a679766ad2cab9e3177d783c53858dda89d06f /gdb/mdebugread.c | |
parent | e2f6d8e5e4989f5b1d93ec36896878d070baacff (diff) | |
download | gdb-0e931cf0eed83e9af7fe3eaf10de174d98c93bc0.zip gdb-0e931cf0eed83e9af7fe3eaf10de174d98c93bc0.tar.gz gdb-0e931cf0eed83e9af7fe3eaf10de174d98c93bc0.tar.bz2 |
* symfile.h (get_section_index): Define.
* symfile.c (get_section_index): New function.
* mdebugread.c (SC_IS_SBSS): New macro.
(SC_IS_BSS): Return true for the scBss storage class only, as
the scSBss storage class refers to the .sbss section.
(parse_partial_symbols): Discard the symbols which associated
section does not exist.
Make sure to use the .sbss section index for symbols which
storage class is scBss, rather than using the .bss section index.
Diffstat (limited to 'gdb/mdebugread.c')
-rw-r--r-- | gdb/mdebugread.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 1bc9eef..c974c9e 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -143,7 +143,8 @@ struct symloc || (sc) == scPData \ || (sc) == scXData) #define SC_IS_COMMON(sc) ((sc) == scCommon || (sc) == scSCommon) -#define SC_IS_BSS(sc) ((sc) == scBss || (sc) == scSBss) +#define SC_IS_BSS(sc) ((sc) == scBss) +#define SC_IS_SBSS(sc) ((sc) == scSBss) #define SC_IS_UNDEF(sc) ((sc) == scUndefined || (sc) == scSUndefined) /* Various complaints about symbol reading that don't abort the process */ @@ -2425,26 +2426,72 @@ parse_partial_symbols (struct objfile *objfile) ms_type = mst_bss; svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile)); } + else if (SC_IS_SBSS (ext_in->asym.sc)) + { + ms_type = mst_bss; + svalue += ANOFFSET (objfile->section_offsets, + get_section_index (objfile, ".sbss")); + } else ms_type = mst_abs; break; case stLabel: /* Label */ + + /* On certain platforms, some extra label symbols can be + generated by the linker. One possible usage for this kind + of symbols is to represent the address of the begining of a + given section. For instance, on Tru64 5.1, the address of + the _ftext label is the start address of the .text section. + + The storage class of these symbols is usually directly + related to the section to which the symbol refers. For + instance, on Tru64 5.1, the storage class for the _fdata + label is scData, refering to the .data section. + + It is actually possible that the section associated to the + storage class of the label does not exist. On True64 5.1 + for instance, the libm.so shared library does not contain + any .data section, although it contains a _fpdata label + which storage class is scData... Since these symbols are + usually useless for the debugger user anyway, we just + discard these symbols. + */ + if (SC_IS_TEXT (ext_in->asym.sc)) { + if (objfile->sect_index_text == -1) + continue; + ms_type = mst_file_text; svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); } else if (SC_IS_DATA (ext_in->asym.sc)) { + if (objfile->sect_index_data == -1) + continue; + ms_type = mst_file_data; svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile)); } else if (SC_IS_BSS (ext_in->asym.sc)) { + if (objfile->sect_index_bss == -1) + continue; + ms_type = mst_file_bss; svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile)); } + else if (SC_IS_SBSS (ext_in->asym.sc)) + { + const int sbss_sect_index = get_section_index (objfile, ".sbss"); + + if (sbss_sect_index == -1) + continue; + + ms_type = mst_file_bss; + svalue += ANOFFSET (objfile->section_offsets, sbss_sect_index); + } else ms_type = mst_abs; break; |