diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-07 21:15:12 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-10 14:38:08 +0000 |
commit | a52d653e9170d361e354ddaf2876aaa09aece207 (patch) | |
tree | 3f9112c2ab5ced4c5fef37b25d711d96fe53329d /gdb/symtab.c | |
parent | ebbc3a7d56f82f68bbeece3d7daf1823c9d98170 (diff) | |
download | gdb-a52d653e9170d361e354ddaf2876aaa09aece207.zip gdb-a52d653e9170d361e354ddaf2876aaa09aece207.tar.gz gdb-a52d653e9170d361e354ddaf2876aaa09aece207.tar.bz2 |
gdb: delete SYMBOL_SECTION and MSYMBOL_SECTION macros
Delete two more symbol/section related macros. This time it's
SYMBOL_SECTION and MSYMBOL_SECTION.
As with general_symbol_info::m_name it is not currently possible to
make general_symbol_info::m_section private as general_symbol_info
must remain a POD type.
But other than failing to make the new m_section private, this change
does what you'd expect, adds a get and set member function and updates
all users to use the new functions instead of the previous wrapper
macros.
There should be no user visible change after this commit.
gdb/ChangeLog:
* coff-pe-read.c (add_pe_forwarded_sym): Make use of section_index
and set_section_index member functions where appropriate.
* coffread.c (coff_symtab_read): Likewise.
(process_coff_symbol): Likewise.
* ctfread.c (set_symbol_address): Likewise.
* dwarf2/read.c (add_partial_symbol): Likewise.
(var_decode_location): Likewise.
* language.c: Likewise.
* minsyms.c (minimal_symbol_reader::record_full): Likewise.
(compact_minimal_symbols): Likewise.
(minimal_symbol_upper_bound): Likewise.
* objfiles.c (relocate_one_symbol): Likewise.
* psympriv.h (partial_symbol::obj_section): Likewise.
(partial_symbol::address): Likewise.
* psymtab.c (partial_symtab::add_psymbol): Likewise.
* stabsread.c (scan_file_globals): Likewise.
* symmisc.c (dump_msymbols): Likewise.
* symtab.c (general_symbol_info::obj_section): Likewise.
(fixup_section): Likewise.
(get_msymbol_address): Likewise.
* symtab.h (general_symbol_info::section): Rename to...
(general_symbol_info::m_section): ...this.
(general_symbol_info::set_section_index): New member function.
(general_symbol_info::section_index): Likewise.
(SYMBOL_SECTION): Delete.
(MSYMBOL_VALUE_ADDRESS): Make use of section_index and
set_section_index member functions where appropriate.
(MSYMBOL_SECTION): Delete.
(symbol::symbol): Update to initialize 'm_section'.
* xcoffread.c (read_xcoff_symtab): Make use of set_section_index.
(process_xcoff_symbol): Likewise.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 9ad7c1f..3650b49 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1015,8 +1015,8 @@ general_symbol_info::search_name () const struct obj_section * general_symbol_info::obj_section (const struct objfile *objfile) const { - if (section >= 0) - return &objfile->sections[section]; + if (section_index () >= 0) + return &objfile->sections[section_index ()]; return nullptr; } @@ -1655,7 +1655,7 @@ fixup_section (struct general_symbol_info *ginfo, msym = lookup_minimal_symbol_by_pc_name (addr, ginfo->linkage_name (), objfile); if (msym) - ginfo->section = MSYMBOL_SECTION (msym); + ginfo->set_section_index (msym->section_index ()); else { /* Static, function-local variables do appear in the linker @@ -1707,7 +1707,7 @@ fixup_section (struct general_symbol_info *ginfo, if (obj_section_addr (s) - offset <= addr && addr < obj_section_endaddr (s) - offset) { - ginfo->section = idx; + ginfo->set_section_index (idx); return; } } @@ -1716,9 +1716,9 @@ fixup_section (struct general_symbol_info *ginfo, section. If there is no allocated section, then it hardly matters what we pick, so just pick zero. */ if (fallback == -1) - ginfo->section = 0; + ginfo->set_section_index (0); else - ginfo->section = fallback; + ginfo->set_section_index (fallback); } } @@ -6472,7 +6472,8 @@ get_msymbol_address (struct objfile *objf, const struct minimal_symbol *minsym) return BMSYMBOL_VALUE_ADDRESS (found); } } - return minsym->value.address + objf->section_offsets[minsym->section]; + return (minsym->value.address + + objf->section_offsets[minsym->section_index ()]); } |