aboutsummaryrefslogtreecommitdiff
path: root/gdb/psympriv.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-05-03 16:36:17 -0600
committerTom Tromey <tom@tromey.com>2018-07-26 09:18:29 -0600
commit8a6d4234503bfe1c656d8cd335cac828507df9a3 (patch)
tree39e3fcfa8399f9b70aaad86632292cc2f474348f /gdb/psympriv.h
parent08994e1ddcc8e5e1e003602409662ae799a1ff30 (diff)
downloadgdb-8a6d4234503bfe1c656d8cd335cac828507df9a3.zip
gdb-8a6d4234503bfe1c656d8cd335cac828507df9a3.tar.gz
gdb-8a6d4234503bfe1c656d8cd335cac828507df9a3.tar.bz2
Change representation of psymbol to flush out accessors
This is the psymbol analog to the patch to change the representation of minimal symbols: https://sourceware.org/ml/gdb-patches/2013-10/msg00524.html It has the same rationale: namely, that we're going to change the code to apply psymbol offsets at runtime. This will be done by adding an argument to the SYMBOL_VALUE_ADDRESS macro -- but since we can't convert all the symbol types at once, we need a new approach. Because gdb now is in C++, this patch changes partial_symbol to inherit from general_symbol_info, rather than renaming the field. This simplifies code in some places. Also, as noted before, these macros implement a kind of "phony polymorphism" that is not actually useful in practice; so this patch removes the macros in favor of simply referring directly to members. In a few cases -- obj_section in this patch and the symbol address in the future -- methods will be used instead. Note that this removes the blanket memset from add_psymbol_to_bcache. This hasn't really been needed since bcache was modified to allow holes in objects and since psymtab took advantage of that. This deletion was required due to changing partial_symbol to derive from general_symbol_info. gdb/ChangeLog 2018-07-26 Tom Tromey <tom@tromey.com> * dwarf-index-write.c (write_psymbols, debug_names::insert) (debug_names::write_psymbols): Update. * psympriv.h (struct partial_symbol): Derive from general_symbol_info. <obj_section>: New method. (PSYMBOL_DOMAIN, PSYMBOL_CLASS): Remove.n * psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab) (find_pc_sect_psymbol, fixup_psymbol_section) (match_partial_symbol, lookup_partial_symbol, relocate_psymtabs) (print_partial_symbols, recursively_search_psymtabs) (compare_psymbols, psymbol_hash, psymbol_compare) (add_psymbol_to_bcache, maintenance_check_psymtabs) (psymbol_name_matches, psym_fill_psymbol_map): Update.
Diffstat (limited to 'gdb/psympriv.h')
-rw-r--r--gdb/psympriv.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 45746a2..f3cb0a6 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -33,11 +33,16 @@
/* This structure is space critical. See space comments at the top of
symtab.h. */
-struct partial_symbol
+struct partial_symbol : public general_symbol_info
{
- /* The general symbol info required for all types of symbols. */
-
- struct general_symbol_info ginfo;
+ /* Return the section for this partial symbol, or nullptr if no
+ section has been set. */
+ struct obj_section *obj_section (struct objfile *objfile) const
+ {
+ if (section >= 0)
+ return &objfile->sections[section];
+ return nullptr;
+ }
/* Name space code. */
@@ -50,9 +55,6 @@ struct partial_symbol
ENUM_BITFIELD(address_class) aclass : SYMBOL_ACLASS_BITS;
};
-#define PSYMBOL_DOMAIN(psymbol) (psymbol)->domain
-#define PSYMBOL_CLASS(psymbol) (psymbol)->aclass
-
/* A convenience enum to give names to some constants used when
searching psymtabs. This is internal to psymtab and should not be
used elsewhere. */