Make struct symbol inherit from general_symbol_info
Since this is now no longer a POD, also give it a constructor that initializes all fields. (I have considered overloading operator new to zero-initialize the memory instead; let me know if you prefer that) gdb/ChangeLog: 2019-11-12 Christian Biesinger <cbiesinger@google.com> * ada-exp.y (write_ambiguous_var): Update. * buildsym.c (add_symbol_to_list): Update. * dwarf2read.c (read_variable): Update. (new_symbol): Update. * jit.c (finalize_symtab): Update. * language.c (language_alloc_type_symbol): Update. * symtab.c (fixup_symbol_section): Update. (initialize_objfile_symbol_1): Move code to... (initialize_objfile_symbol): ...here. Remove now-unnecessary memset. (allocate_symbol): Update. (allocate_template_symbol): Update. (get_symbol_address): Update. * symtab.h (struct symbol): Inherit from general_symbol_info instead of having as a field, and add a constructor. (SYMBOL_VALUE): Update. (SYMBOL_VALUE_ADDRESS): Update. (SET_SYMBOL_VALUE_ADDRESS): Update. (SYMBOL_VALUE_BYTES): Update. (SYMBOL_VALUE_COMMON_BLOCK): Update. (SYMBOL_BLOCK_VALUE): Update. (SYMBOL_VALUE_CHAIN): Update. (SYMBOL_LANGUAGE): Update. (SYMBOL_SECTION): Update. (SYMBOL_OBJ_SECTION): Update. (SYMBOL_SET_LANGUAGE): Update. (SYMBOL_SET_LINKAGE_NAME): Update. (SYMBOL_SET_NAMES): Update. (SYMBOL_NATURAL_NAME): Update. (SYMBOL_LINKAGE_NAME): Update. (SYMBOL_DEMANGLED_NAME): Update. (SYMBOL_SEARCH_NAME): Update. (SYMBOL_MATCHES_SEARCH_NAME): Update. (struct symbol): Update. (struct template_symbol): Update. (struct rust_vtable_symbol): Update. * xcoffread.c (SYMBOL_DUP): Update. Change-Id: I05b1628455bcce3efaa101e65ef051708d17eb07
This commit is contained in:
parent
ed2c82c364
commit
468c0cbb32
9 changed files with 109 additions and 73 deletions
|
@ -1,3 +1,42 @@
|
||||||
|
2019-11-12 Christian Biesinger <cbiesinger@google.com>
|
||||||
|
|
||||||
|
* ada-exp.y (write_ambiguous_var): Update.
|
||||||
|
* buildsym.c (add_symbol_to_list): Update.
|
||||||
|
* dwarf2read.c (read_variable): Update.
|
||||||
|
(new_symbol): Update.
|
||||||
|
* jit.c (finalize_symtab): Update.
|
||||||
|
* language.c (language_alloc_type_symbol): Update.
|
||||||
|
* symtab.c (fixup_symbol_section): Update.
|
||||||
|
(initialize_objfile_symbol_1): Move code to...
|
||||||
|
(initialize_objfile_symbol): ...here. Remove now-unnecessary memset.
|
||||||
|
(allocate_symbol): Update.
|
||||||
|
(allocate_template_symbol): Update.
|
||||||
|
(get_symbol_address): Update.
|
||||||
|
* symtab.h (struct symbol): Inherit from general_symbol_info instead
|
||||||
|
of having as a field, and add a constructor.
|
||||||
|
(SYMBOL_VALUE): Update.
|
||||||
|
(SYMBOL_VALUE_ADDRESS): Update.
|
||||||
|
(SET_SYMBOL_VALUE_ADDRESS): Update.
|
||||||
|
(SYMBOL_VALUE_BYTES): Update.
|
||||||
|
(SYMBOL_VALUE_COMMON_BLOCK): Update.
|
||||||
|
(SYMBOL_BLOCK_VALUE): Update.
|
||||||
|
(SYMBOL_VALUE_CHAIN): Update.
|
||||||
|
(SYMBOL_LANGUAGE): Update.
|
||||||
|
(SYMBOL_SECTION): Update.
|
||||||
|
(SYMBOL_OBJ_SECTION): Update.
|
||||||
|
(SYMBOL_SET_LANGUAGE): Update.
|
||||||
|
(SYMBOL_SET_LINKAGE_NAME): Update.
|
||||||
|
(SYMBOL_SET_NAMES): Update.
|
||||||
|
(SYMBOL_NATURAL_NAME): Update.
|
||||||
|
(SYMBOL_LINKAGE_NAME): Update.
|
||||||
|
(SYMBOL_DEMANGLED_NAME): Update.
|
||||||
|
(SYMBOL_SEARCH_NAME): Update.
|
||||||
|
(SYMBOL_MATCHES_SEARCH_NAME): Update.
|
||||||
|
(struct symbol): Update.
|
||||||
|
(struct template_symbol): Update.
|
||||||
|
(struct rust_vtable_symbol): Update.
|
||||||
|
* xcoffread.c (SYMBOL_DUP): Update.
|
||||||
|
|
||||||
2019-11-12 Tom Tromey <tom@tromey.com>
|
2019-11-12 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* tui/tui-layout.c (show_layout): Set current_layout.
|
* tui/tui-layout.c (show_layout): Set current_layout.
|
||||||
|
|
|
@ -1102,9 +1102,8 @@ static void
|
||||||
write_ambiguous_var (struct parser_state *par_state,
|
write_ambiguous_var (struct parser_state *par_state,
|
||||||
const struct block *block, char *name, int len)
|
const struct block *block, char *name, int len)
|
||||||
{
|
{
|
||||||
struct symbol *sym = XOBNEW (&temp_parse_space, struct symbol);
|
struct symbol *sym = new (&temp_parse_space) symbol ();
|
||||||
|
|
||||||
memset (sym, 0, sizeof (struct symbol));
|
|
||||||
SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN;
|
SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN;
|
||||||
SYMBOL_LINKAGE_NAME (sym) = obstack_strndup (&temp_parse_space, name, len);
|
SYMBOL_LINKAGE_NAME (sym) = obstack_strndup (&temp_parse_space, name, len);
|
||||||
SYMBOL_LANGUAGE (sym) = language_ada;
|
SYMBOL_LANGUAGE (sym) = language_ada;
|
||||||
|
|
|
@ -135,7 +135,7 @@ add_symbol_to_list (struct symbol *symbol, struct pending **listhead)
|
||||||
struct pending *link;
|
struct pending *link;
|
||||||
|
|
||||||
/* If this is an alias for another symbol, don't add it. */
|
/* If this is an alias for another symbol, don't add it. */
|
||||||
if (symbol->ginfo.name && symbol->ginfo.name[0] == '#')
|
if (symbol->name && symbol->name[0] == '#')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* We keep PENDINGSIZE symbols in each link of the list. If we
|
/* We keep PENDINGSIZE symbols in each link of the list. If we
|
||||||
|
|
|
@ -14320,8 +14320,7 @@ read_variable (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
{
|
{
|
||||||
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
|
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
|
||||||
|
|
||||||
storage = OBSTACK_ZALLOC (&objfile->objfile_obstack,
|
storage = new (&objfile->objfile_obstack) rust_vtable_symbol ();
|
||||||
struct rust_vtable_symbol);
|
|
||||||
initialize_objfile_symbol (storage);
|
initialize_objfile_symbol (storage);
|
||||||
storage->concrete_type = containing_type;
|
storage->concrete_type = containing_type;
|
||||||
storage->subclass = SYMBOL_RUST_VTABLE;
|
storage->subclass = SYMBOL_RUST_VTABLE;
|
||||||
|
@ -21636,8 +21635,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
|
||||||
/* Fortran does not have mangling standard and the mangling does differ
|
/* Fortran does not have mangling standard and the mangling does differ
|
||||||
between gfortran, iFort etc. */
|
between gfortran, iFort etc. */
|
||||||
if (cu->language == language_fortran
|
if (cu->language == language_fortran
|
||||||
&& symbol_get_demangled_name (&(sym->ginfo)) == NULL)
|
&& symbol_get_demangled_name (sym) == NULL)
|
||||||
symbol_set_demangled_name (&(sym->ginfo),
|
symbol_set_demangled_name (sym,
|
||||||
dwarf2_full_name (name, die, cu),
|
dwarf2_full_name (name, die, cu),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
|
|
@ -700,8 +700,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
||||||
SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
|
SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
|
||||||
SYMBOL_BLOCK_VALUE (block_name) = new_block;
|
SYMBOL_BLOCK_VALUE (block_name) = new_block;
|
||||||
|
|
||||||
block_name->ginfo.name = obstack_strdup (&objfile->objfile_obstack,
|
block_name->name = obstack_strdup (&objfile->objfile_obstack,
|
||||||
gdb_block_iter->name);
|
gdb_block_iter->name);
|
||||||
|
|
||||||
BLOCK_FUNCTION (new_block) = block_name;
|
BLOCK_FUNCTION (new_block) = block_name;
|
||||||
|
|
||||||
|
|
|
@ -1048,10 +1048,10 @@ language_alloc_type_symbol (enum language lang, struct type *type)
|
||||||
gdb_assert (!TYPE_OBJFILE_OWNED (type));
|
gdb_assert (!TYPE_OBJFILE_OWNED (type));
|
||||||
|
|
||||||
gdbarch = TYPE_OWNER (type).gdbarch;
|
gdbarch = TYPE_OWNER (type).gdbarch;
|
||||||
symbol = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct symbol);
|
symbol = new (gdbarch_obstack (gdbarch)) struct symbol ();
|
||||||
|
|
||||||
symbol->ginfo.name = TYPE_NAME (type);
|
symbol->name = TYPE_NAME (type);
|
||||||
symbol->ginfo.language = lang;
|
symbol->language = lang;
|
||||||
symbol->owner.arch = gdbarch;
|
symbol->owner.arch = gdbarch;
|
||||||
SYMBOL_OBJFILE_OWNED (symbol) = 0;
|
SYMBOL_OBJFILE_OWNED (symbol) = 0;
|
||||||
SYMBOL_TYPE (symbol) = type;
|
SYMBOL_TYPE (symbol) = type;
|
||||||
|
|
27
gdb/symtab.c
27
gdb/symtab.c
|
@ -1759,7 +1759,7 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixup_section (&sym->ginfo, addr, objfile);
|
fixup_section (sym, addr, objfile);
|
||||||
|
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
@ -6208,23 +6208,13 @@ initialize_ordinary_address_classes (void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Helper function to initialize the fields of an objfile-owned symbol.
|
|
||||||
It assumed that *SYM is already all zeroes. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
initialize_objfile_symbol_1 (struct symbol *sym)
|
|
||||||
{
|
|
||||||
SYMBOL_OBJFILE_OWNED (sym) = 1;
|
|
||||||
SYMBOL_SECTION (sym) = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the symbol SYM, and mark it as being owned by an objfile. */
|
/* Initialize the symbol SYM, and mark it as being owned by an objfile. */
|
||||||
|
|
||||||
void
|
void
|
||||||
initialize_objfile_symbol (struct symbol *sym)
|
initialize_objfile_symbol (struct symbol *sym)
|
||||||
{
|
{
|
||||||
memset (sym, 0, sizeof (*sym));
|
SYMBOL_OBJFILE_OWNED (sym) = 1;
|
||||||
initialize_objfile_symbol_1 (sym);
|
SYMBOL_SECTION (sym) = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate and initialize a new 'struct symbol' on OBJFILE's
|
/* Allocate and initialize a new 'struct symbol' on OBJFILE's
|
||||||
|
@ -6233,10 +6223,9 @@ initialize_objfile_symbol (struct symbol *sym)
|
||||||
struct symbol *
|
struct symbol *
|
||||||
allocate_symbol (struct objfile *objfile)
|
allocate_symbol (struct objfile *objfile)
|
||||||
{
|
{
|
||||||
struct symbol *result;
|
struct symbol *result = new (&objfile->objfile_obstack) symbol ();
|
||||||
|
|
||||||
result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol);
|
initialize_objfile_symbol (result);
|
||||||
initialize_objfile_symbol_1 (result);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -6249,8 +6238,8 @@ allocate_template_symbol (struct objfile *objfile)
|
||||||
{
|
{
|
||||||
struct template_symbol *result;
|
struct template_symbol *result;
|
||||||
|
|
||||||
result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct template_symbol);
|
result = new (&objfile->objfile_obstack) template_symbol ();
|
||||||
initialize_objfile_symbol_1 (result);
|
initialize_objfile_symbol (result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -6309,7 +6298,7 @@ get_symbol_address (const struct symbol *sym)
|
||||||
if (minsym.minsym != nullptr)
|
if (minsym.minsym != nullptr)
|
||||||
return BMSYMBOL_VALUE_ADDRESS (minsym);
|
return BMSYMBOL_VALUE_ADDRESS (minsym);
|
||||||
}
|
}
|
||||||
return sym->ginfo.value.address;
|
return sym->value.address;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See symtab.h. */
|
/* See symtab.h. */
|
||||||
|
|
92
gdb/symtab.h
92
gdb/symtab.h
|
@ -25,6 +25,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "gdbsupport/gdb_vecs.h"
|
#include "gdbsupport/gdb_vecs.h"
|
||||||
#include "gdbtypes.h"
|
#include "gdbtypes.h"
|
||||||
|
#include "gdb_obstack.h"
|
||||||
#include "gdb_regex.h"
|
#include "gdb_regex.h"
|
||||||
#include "gdbsupport/enum-flags.h"
|
#include "gdbsupport/enum-flags.h"
|
||||||
#include "gdbsupport/function-view.h"
|
#include "gdbsupport/function-view.h"
|
||||||
|
@ -470,35 +471,29 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
|
||||||
|
|
||||||
extern CORE_ADDR get_symbol_address (const struct symbol *sym);
|
extern CORE_ADDR get_symbol_address (const struct symbol *sym);
|
||||||
|
|
||||||
/* Note that all the following SYMBOL_* macros are used with the
|
/* Note that these macros only work with symbol, not partial_symbol. */
|
||||||
SYMBOL argument being either a partial symbol or
|
|
||||||
a full symbol. Both types have a ginfo field. In particular
|
|
||||||
the SYMBOL_SET_LANGUAGE, SYMBOL_DEMANGLED_NAME, etc.
|
|
||||||
macros cannot be entirely substituted by
|
|
||||||
functions, unless the callers are changed to pass in the ginfo
|
|
||||||
field only, instead of the SYMBOL parameter. */
|
|
||||||
|
|
||||||
#define SYMBOL_VALUE(symbol) (symbol)->ginfo.value.ivalue
|
#define SYMBOL_VALUE(symbol) (symbol)->value.ivalue
|
||||||
#define SYMBOL_VALUE_ADDRESS(symbol) \
|
#define SYMBOL_VALUE_ADDRESS(symbol) \
|
||||||
(((symbol)->maybe_copied) ? get_symbol_address (symbol) \
|
(((symbol)->maybe_copied) ? get_symbol_address (symbol) \
|
||||||
: ((symbol)->ginfo.value.address))
|
: ((symbol)->value.address))
|
||||||
#define SET_SYMBOL_VALUE_ADDRESS(symbol, new_value) \
|
#define SET_SYMBOL_VALUE_ADDRESS(symbol, new_value) \
|
||||||
((symbol)->ginfo.value.address = (new_value))
|
((symbol)->value.address = (new_value))
|
||||||
#define SYMBOL_VALUE_BYTES(symbol) (symbol)->ginfo.value.bytes
|
#define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes
|
||||||
#define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->ginfo.value.common_block
|
#define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->value.common_block
|
||||||
#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->ginfo.value.block
|
#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block
|
||||||
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->ginfo.value.chain
|
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain
|
||||||
#define SYMBOL_LANGUAGE(symbol) (symbol)->ginfo.language
|
#define SYMBOL_LANGUAGE(symbol) (symbol)->language
|
||||||
#define SYMBOL_SECTION(symbol) (symbol)->ginfo.section
|
#define SYMBOL_SECTION(symbol) (symbol)->section
|
||||||
#define SYMBOL_OBJ_SECTION(objfile, symbol) \
|
#define SYMBOL_OBJ_SECTION(objfile, symbol) \
|
||||||
(((symbol)->ginfo.section >= 0) \
|
(((symbol)->section >= 0) \
|
||||||
? (&(((objfile)->sections)[(symbol)->ginfo.section])) \
|
? (&(((objfile)->sections)[(symbol)->section])) \
|
||||||
: NULL)
|
: NULL)
|
||||||
|
|
||||||
/* Initializes the language dependent portion of a symbol
|
/* Initializes the language dependent portion of a symbol
|
||||||
depending upon the language for the symbol. */
|
depending upon the language for the symbol. */
|
||||||
#define SYMBOL_SET_LANGUAGE(symbol,language,obstack) \
|
#define SYMBOL_SET_LANGUAGE(symbol,language,obstack) \
|
||||||
(symbol_set_language (&(symbol)->ginfo, (language), (obstack)))
|
(symbol_set_language ((symbol), (language), (obstack)))
|
||||||
extern void symbol_set_language (struct general_symbol_info *symbol,
|
extern void symbol_set_language (struct general_symbol_info *symbol,
|
||||||
enum language language,
|
enum language language,
|
||||||
struct obstack *obstack);
|
struct obstack *obstack);
|
||||||
|
@ -509,13 +504,13 @@ extern void symbol_set_language (struct general_symbol_info *symbol,
|
||||||
be terminated and either already on the objfile's obstack or
|
be terminated and either already on the objfile's obstack or
|
||||||
permanently allocated. */
|
permanently allocated. */
|
||||||
#define SYMBOL_SET_LINKAGE_NAME(symbol,linkage_name) \
|
#define SYMBOL_SET_LINKAGE_NAME(symbol,linkage_name) \
|
||||||
(symbol)->ginfo.name = (linkage_name)
|
(symbol)->name = (linkage_name)
|
||||||
|
|
||||||
/* Set the linkage and natural names of a symbol, by demangling
|
/* Set the linkage and natural names of a symbol, by demangling
|
||||||
the linkage name. If linkage_name may not be nullterminated,
|
the linkage name. If linkage_name may not be nullterminated,
|
||||||
copy_name must be set to true. */
|
copy_name must be set to true. */
|
||||||
#define SYMBOL_SET_NAMES(symbol,linkage_name,copy_name,objfile) \
|
#define SYMBOL_SET_NAMES(symbol,linkage_name,copy_name,objfile) \
|
||||||
symbol_set_names (&(symbol)->ginfo, linkage_name, copy_name, \
|
symbol_set_names ((symbol), linkage_name, copy_name, \
|
||||||
(objfile)->per_bfd)
|
(objfile)->per_bfd)
|
||||||
extern void symbol_set_names (struct general_symbol_info *symbol,
|
extern void symbol_set_names (struct general_symbol_info *symbol,
|
||||||
gdb::string_view linkage_name, bool copy_name,
|
gdb::string_view linkage_name, bool copy_name,
|
||||||
|
@ -535,7 +530,7 @@ extern void symbol_set_names (struct general_symbol_info *symbol,
|
||||||
demangled name. */
|
demangled name. */
|
||||||
|
|
||||||
#define SYMBOL_NATURAL_NAME(symbol) \
|
#define SYMBOL_NATURAL_NAME(symbol) \
|
||||||
(symbol_natural_name (&(symbol)->ginfo))
|
(symbol_natural_name ((symbol)))
|
||||||
extern const char *symbol_natural_name
|
extern const char *symbol_natural_name
|
||||||
(const struct general_symbol_info *symbol);
|
(const struct general_symbol_info *symbol);
|
||||||
|
|
||||||
|
@ -544,12 +539,12 @@ extern const char *symbol_natural_name
|
||||||
manipulation by the linker, this is the mangled name; otherwise,
|
manipulation by the linker, this is the mangled name; otherwise,
|
||||||
it's the same as SYMBOL_NATURAL_NAME. */
|
it's the same as SYMBOL_NATURAL_NAME. */
|
||||||
|
|
||||||
#define SYMBOL_LINKAGE_NAME(symbol) (symbol)->ginfo.name
|
#define SYMBOL_LINKAGE_NAME(symbol) (symbol)->name
|
||||||
|
|
||||||
/* Return the demangled name for a symbol based on the language for
|
/* Return the demangled name for a symbol based on the language for
|
||||||
that symbol. If no demangled name exists, return NULL. */
|
that symbol. If no demangled name exists, return NULL. */
|
||||||
#define SYMBOL_DEMANGLED_NAME(symbol) \
|
#define SYMBOL_DEMANGLED_NAME(symbol) \
|
||||||
(symbol_demangled_name (&(symbol)->ginfo))
|
(symbol_demangled_name ((symbol)))
|
||||||
extern const char *symbol_demangled_name
|
extern const char *symbol_demangled_name
|
||||||
(const struct general_symbol_info *symbol);
|
(const struct general_symbol_info *symbol);
|
||||||
|
|
||||||
|
@ -560,7 +555,7 @@ extern const char *symbol_demangled_name
|
||||||
The result should never be NULL. Don't use this for internal
|
The result should never be NULL. Don't use this for internal
|
||||||
purposes (e.g. storing in a hashtable): it's only suitable for output.
|
purposes (e.g. storing in a hashtable): it's only suitable for output.
|
||||||
|
|
||||||
N.B. symbol may be anything with a ginfo member,
|
N.B. symbol may be anything inheriting from general_symbol_info,
|
||||||
e.g., struct symbol or struct minimal_symbol. */
|
e.g., struct symbol or struct minimal_symbol. */
|
||||||
|
|
||||||
#define SYMBOL_PRINT_NAME(symbol) \
|
#define SYMBOL_PRINT_NAME(symbol) \
|
||||||
|
@ -573,13 +568,13 @@ extern bool demangle;
|
||||||
name. If there is no distinct demangled name, then SYMBOL_SEARCH_NAME
|
name. If there is no distinct demangled name, then SYMBOL_SEARCH_NAME
|
||||||
returns the same value (same pointer) as SYMBOL_LINKAGE_NAME. */
|
returns the same value (same pointer) as SYMBOL_LINKAGE_NAME. */
|
||||||
#define SYMBOL_SEARCH_NAME(symbol) \
|
#define SYMBOL_SEARCH_NAME(symbol) \
|
||||||
(symbol_search_name (&(symbol)->ginfo))
|
(symbol_search_name (symbol))
|
||||||
extern const char *symbol_search_name (const struct general_symbol_info *ginfo);
|
extern const char *symbol_search_name (const struct general_symbol_info *ginfo);
|
||||||
|
|
||||||
/* Return true if NAME matches the "search" name of SYMBOL, according
|
/* Return true if NAME matches the "search" name of SYMBOL, according
|
||||||
to the symbol's language. */
|
to the symbol's language. */
|
||||||
#define SYMBOL_MATCHES_SEARCH_NAME(symbol, name) \
|
#define SYMBOL_MATCHES_SEARCH_NAME(symbol, name) \
|
||||||
symbol_matches_search_name (&(symbol)->ginfo, (name))
|
symbol_matches_search_name ((symbol), (name))
|
||||||
|
|
||||||
/* Helper for SYMBOL_MATCHES_SEARCH_NAME that works with both symbols
|
/* Helper for SYMBOL_MATCHES_SEARCH_NAME that works with both symbols
|
||||||
and psymbols. */
|
and psymbols. */
|
||||||
|
@ -1105,16 +1100,31 @@ enum symbol_subclass_kind
|
||||||
|
|
||||||
/* This structure is space critical. See space comments at the top. */
|
/* This structure is space critical. See space comments at the top. */
|
||||||
|
|
||||||
struct symbol
|
struct symbol : public general_symbol_info, public allocate_on_obstack
|
||||||
{
|
{
|
||||||
|
symbol ()
|
||||||
/* The general symbol info required for all types of symbols. */
|
/* Class-initialization of bitfields is only allowed in C++20. */
|
||||||
|
: domain (UNDEF_DOMAIN),
|
||||||
struct general_symbol_info ginfo;
|
aclass_index (0),
|
||||||
|
is_objfile_owned (0),
|
||||||
|
is_argument (0),
|
||||||
|
is_inlined (0),
|
||||||
|
maybe_copied (0),
|
||||||
|
subclass (SYMBOL_NONE)
|
||||||
|
{
|
||||||
|
/* We can't use an initializer list for members of a base class, and
|
||||||
|
general_symbol_info needs to stay a POD type. */
|
||||||
|
name = nullptr;
|
||||||
|
value.ivalue = 0;
|
||||||
|
language_specific.obstack = nullptr;
|
||||||
|
language = language_unknown;
|
||||||
|
ada_mangled = 0;
|
||||||
|
section = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Data type of value */
|
/* Data type of value */
|
||||||
|
|
||||||
struct type *type;
|
struct type *type = nullptr;
|
||||||
|
|
||||||
/* The owner of this symbol.
|
/* The owner of this symbol.
|
||||||
Which one to use is defined by symbol.is_objfile_owned. */
|
Which one to use is defined by symbol.is_objfile_owned. */
|
||||||
|
@ -1124,7 +1134,7 @@ struct symbol
|
||||||
/* The symbol table containing this symbol. This is the file associated
|
/* The symbol table containing this symbol. This is the file associated
|
||||||
with LINE. It can be NULL during symbols read-in but it is never NULL
|
with LINE. It can be NULL during symbols read-in but it is never NULL
|
||||||
during normal operation. */
|
during normal operation. */
|
||||||
struct symtab *symtab;
|
struct symtab *symtab = nullptr;
|
||||||
|
|
||||||
/* For types defined by the architecture. */
|
/* For types defined by the architecture. */
|
||||||
struct gdbarch *arch;
|
struct gdbarch *arch;
|
||||||
|
@ -1141,7 +1151,7 @@ struct symbol
|
||||||
unsigned int aclass_index : SYMBOL_ACLASS_BITS;
|
unsigned int aclass_index : SYMBOL_ACLASS_BITS;
|
||||||
|
|
||||||
/* If non-zero then symbol is objfile-owned, use owner.symtab.
|
/* If non-zero then symbol is objfile-owned, use owner.symtab.
|
||||||
Otherwise symbol is arch-owned, use owner.arch. */
|
Otherwise symbol is arch-owned, use owner.arch. */
|
||||||
|
|
||||||
unsigned int is_objfile_owned : 1;
|
unsigned int is_objfile_owned : 1;
|
||||||
|
|
||||||
|
@ -1175,7 +1185,7 @@ struct symbol
|
||||||
to debug files longer than 64K lines? What about machine
|
to debug files longer than 64K lines? What about machine
|
||||||
generated programs? */
|
generated programs? */
|
||||||
|
|
||||||
unsigned short line;
|
unsigned short line = 0;
|
||||||
|
|
||||||
/* An arbitrary data pointer, allowing symbol readers to record
|
/* An arbitrary data pointer, allowing symbol readers to record
|
||||||
additional information on a per-symbol basis. Note that this data
|
additional information on a per-symbol basis. Note that this data
|
||||||
|
@ -1189,9 +1199,9 @@ struct symbol
|
||||||
to add a magic symbol to the block containing this information,
|
to add a magic symbol to the block containing this information,
|
||||||
or to have a generic debug info annotation slot for symbols. */
|
or to have a generic debug info annotation slot for symbols. */
|
||||||
|
|
||||||
void *aux_value;
|
void *aux_value = nullptr;
|
||||||
|
|
||||||
struct symbol *hash_next;
|
struct symbol *hash_next = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This struct is size-critical (see comment at the top), so this assert
|
/* This struct is size-critical (see comment at the top), so this assert
|
||||||
|
@ -1272,11 +1282,11 @@ extern void symbol_set_symtab (struct symbol *symbol, struct symtab *symtab);
|
||||||
struct template_symbol : public symbol
|
struct template_symbol : public symbol
|
||||||
{
|
{
|
||||||
/* The number of template arguments. */
|
/* The number of template arguments. */
|
||||||
int n_template_arguments;
|
int n_template_arguments = 0;
|
||||||
|
|
||||||
/* The template arguments. This is an array with
|
/* The template arguments. This is an array with
|
||||||
N_TEMPLATE_ARGUMENTS elements. */
|
N_TEMPLATE_ARGUMENTS elements. */
|
||||||
struct symbol **template_arguments;
|
struct symbol **template_arguments = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A symbol that represents a Rust virtual table object. */
|
/* A symbol that represents a Rust virtual table object. */
|
||||||
|
@ -1285,7 +1295,7 @@ struct rust_vtable_symbol : public symbol
|
||||||
{
|
{
|
||||||
/* The concrete type for which this vtable was created; that is, in
|
/* The concrete type for which this vtable was created; that is, in
|
||||||
"impl Trait for Type", this is "Type". */
|
"impl Trait for Type", this is "Type". */
|
||||||
struct type *concrete_type;
|
struct type *concrete_type = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1522,7 +1522,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SYMBOL_DUP(SYMBOL1, SYMBOL2) \
|
#define SYMBOL_DUP(SYMBOL1, SYMBOL2) \
|
||||||
(SYMBOL2) = XOBNEW (&objfile->objfile_obstack, struct symbol); \
|
(SYMBOL2) = new (&objfile->objfile_obstack) symbol (); \
|
||||||
*(SYMBOL2) = *(SYMBOL1);
|
*(SYMBOL2) = *(SYMBOL1);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue