diff options
author | Tom Tromey <tom@tromey.com> | 2019-04-23 16:42:14 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-05-04 13:43:50 -0600 |
commit | af97b4161f07a716783183f1b17fa5cac9f99a49 (patch) | |
tree | 4afe3bc56a89346123d7ad0ab369b6da3dfe0a2e /gdb/psympriv.h | |
parent | 9d6d4be89d12747a92629ed1bde1d423e2831de1 (diff) | |
download | gdb-af97b4161f07a716783183f1b17fa5cac9f99a49.zip gdb-af97b4161f07a716783183f1b17fa5cac9f99a49.tar.gz gdb-af97b4161f07a716783183f1b17fa5cac9f99a49.tar.bz2 |
Don't derive partial_symbol from general_symbol_info
This patch partly reverts commit 8a6d42345 ("Change representation of
psymbol to flush out accessors"); specifically, it changes
partial_symbol to no longer derive from general_symbol_info.
The basic problem here is that the bcache compares objects bitwise,
and this change made it less likely that the relevant fields in the
psymbol would be fully initialized. This could be seen by running a
test under valgrind on the Fedora-i686 buildbot.
I considered a simpler patch, namely just zeroing the psymbol's
"value" field in add_psymbol_to_bcache. However, it wasn't clear to
me that this memset could not then be optimized away by the compiler.
Regression tested by the buildbot. I think this should go in 8.3 as
well.
gdb/ChangeLog
2019-05-04 Tom Tromey <tom@tromey.com>
* psymtab.c (psymbol_name_matches, match_partial_symbol)
(lookup_partial_symbol, print_partial_symbols)
(recursively_search_psymtabs, sort_pst_symbols, psymbol_hash)
(psymbol_compare): Update.
(add_psymbol_to_bcache): Clear the entire psymbol.
(maintenance_check_psymtabs): Update.
* psympriv.h (struct partial_symbol): Don't derive from
general_symbol_info.
<obj_section, unrelocated_address, address,
set_unrelocated_address>: Update.
<ginfo>: New member.
* dwarf-index-write.c (write_psymbols, debug_names::insert)
(debug_names::write_psymbols): Update.
Diffstat (limited to 'gdb/psympriv.h')
-rw-r--r-- | gdb/psympriv.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gdb/psympriv.h b/gdb/psympriv.h index 7d2ce30..61d73a3 100644 --- a/gdb/psympriv.h +++ b/gdb/psympriv.h @@ -33,37 +33,43 @@ /* This structure is space critical. See space comments at the top of symtab.h. */ -struct partial_symbol : public general_symbol_info +struct partial_symbol { /* 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]; + if (ginfo.section >= 0) + return &objfile->sections[ginfo.section]; return nullptr; } /* Return the unrelocated address of this partial symbol. */ CORE_ADDR unrelocated_address () const { - return value.address; + return ginfo.value.address; } /* Return the address of this partial symbol, relocated according to the offsets provided in OBJFILE. */ CORE_ADDR address (const struct objfile *objfile) const { - return value.address + ANOFFSET (objfile->section_offsets, section); + return (ginfo.value.address + + ANOFFSET (objfile->section_offsets, ginfo.section)); } /* Set the address of this partial symbol. The address must be unrelocated. */ void set_unrelocated_address (CORE_ADDR addr) { - value.address = addr; + ginfo.value.address = addr; } + /* Note that partial_symbol does not derive from general_symbol_info + due to the bcache. See add_psymbol_to_bcache. */ + + struct general_symbol_info ginfo; + /* Name space code. */ ENUM_BITFIELD(domain_enum_tag) domain : SYMBOL_DOMAIN_BITS; |