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.
This commit is contained in:
parent
08994e1ddc
commit
8a6d423450
@ -1,3 +1,19 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2018-07-26 Tom Tromey <tromey@redhat.com>
|
2018-07-26 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* dbxread.c (end_psymtab): Remove dead code.
|
* dbxread.c (end_psymtab): Remove dead code.
|
||||||
|
@ -499,8 +499,8 @@ write_address_map (struct objfile *objfile, data_buf &addr_vec,
|
|||||||
static gdb_index_symbol_kind
|
static gdb_index_symbol_kind
|
||||||
symbol_kind (struct partial_symbol *psym)
|
symbol_kind (struct partial_symbol *psym)
|
||||||
{
|
{
|
||||||
domain_enum domain = PSYMBOL_DOMAIN (psym);
|
domain_enum domain = psym->domain;
|
||||||
enum address_class aclass = PSYMBOL_CLASS (psym);
|
enum address_class aclass = psym->aclass;
|
||||||
|
|
||||||
switch (domain)
|
switch (domain)
|
||||||
{
|
{
|
||||||
@ -546,7 +546,7 @@ write_psymbols (struct mapped_symtab *symtab,
|
|||||||
{
|
{
|
||||||
struct partial_symbol *psym = *psymp;
|
struct partial_symbol *psym = *psymp;
|
||||||
|
|
||||||
if (SYMBOL_LANGUAGE (psym) == language_ada)
|
if (psym->language == language_ada)
|
||||||
error (_("Ada is not currently supported by the index"));
|
error (_("Ada is not currently supported by the index"));
|
||||||
|
|
||||||
/* Only add a given psymbol once. */
|
/* Only add a given psymbol once. */
|
||||||
@ -554,7 +554,7 @@ write_psymbols (struct mapped_symtab *symtab,
|
|||||||
{
|
{
|
||||||
gdb_index_symbol_kind kind = symbol_kind (psym);
|
gdb_index_symbol_kind kind = symbol_kind (psym);
|
||||||
|
|
||||||
add_index_entry (symtab, SYMBOL_SEARCH_NAME (psym),
|
add_index_entry (symtab, symbol_search_name (psym),
|
||||||
is_static, kind, cu_index);
|
is_static, kind, cu_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -688,7 +688,7 @@ public:
|
|||||||
const int dwarf_tag = psymbol_tag (psym);
|
const int dwarf_tag = psymbol_tag (psym);
|
||||||
if (dwarf_tag == 0)
|
if (dwarf_tag == 0)
|
||||||
return;
|
return;
|
||||||
const char *const name = SYMBOL_SEARCH_NAME (psym);
|
const char *const name = symbol_search_name (psym);
|
||||||
const auto insertpair
|
const auto insertpair
|
||||||
= m_name_to_value_set.emplace (c_str_view (name),
|
= m_name_to_value_set.emplace (c_str_view (name),
|
||||||
std::set<symbol_value> ());
|
std::set<symbol_value> ());
|
||||||
@ -1141,8 +1141,8 @@ private:
|
|||||||
GDB as a DWARF-5 index consumer. */
|
GDB as a DWARF-5 index consumer. */
|
||||||
static int psymbol_tag (const struct partial_symbol *psym)
|
static int psymbol_tag (const struct partial_symbol *psym)
|
||||||
{
|
{
|
||||||
domain_enum domain = PSYMBOL_DOMAIN (psym);
|
domain_enum domain = psym->domain;
|
||||||
enum address_class aclass = PSYMBOL_CLASS (psym);
|
enum address_class aclass = psym->aclass;
|
||||||
|
|
||||||
switch (domain)
|
switch (domain)
|
||||||
{
|
{
|
||||||
@ -1183,7 +1183,7 @@ private:
|
|||||||
{
|
{
|
||||||
struct partial_symbol *psym = *psymp;
|
struct partial_symbol *psym = *psymp;
|
||||||
|
|
||||||
if (SYMBOL_LANGUAGE (psym) == language_ada)
|
if (psym->language == language_ada)
|
||||||
error (_("Ada is not currently supported by the index"));
|
error (_("Ada is not currently supported by the index"));
|
||||||
|
|
||||||
/* Only add a given psymbol once. */
|
/* Only add a given psymbol once. */
|
||||||
|
@ -33,11 +33,16 @@
|
|||||||
/* This structure is space critical. See space comments at the top of
|
/* This structure is space critical. See space comments at the top of
|
||||||
symtab.h. */
|
symtab.h. */
|
||||||
|
|
||||||
struct partial_symbol
|
struct partial_symbol : public general_symbol_info
|
||||||
{
|
{
|
||||||
/* The general symbol info required for all types of symbols. */
|
/* Return the section for this partial symbol, or nullptr if no
|
||||||
|
section has been set. */
|
||||||
struct general_symbol_info ginfo;
|
struct obj_section *obj_section (struct objfile *objfile) const
|
||||||
|
{
|
||||||
|
if (section >= 0)
|
||||||
|
return &objfile->sections[section];
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
/* Name space code. */
|
/* Name space code. */
|
||||||
|
|
||||||
@ -50,9 +55,6 @@ struct partial_symbol
|
|||||||
ENUM_BITFIELD(address_class) aclass : SYMBOL_ACLASS_BITS;
|
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
|
/* A convenience enum to give names to some constants used when
|
||||||
searching psymtabs. This is internal to psymtab and should not be
|
searching psymtabs. This is internal to psymtab and should not be
|
||||||
used elsewhere. */
|
used elsewhere. */
|
||||||
|
168
gdb/psymtab.c
168
gdb/psymtab.c
@ -267,8 +267,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
|
|||||||
object's symbol table. */
|
object's symbol table. */
|
||||||
p = find_pc_sect_psymbol (objfile, tpst, pc, section);
|
p = find_pc_sect_psymbol (objfile, tpst, pc, section);
|
||||||
if (p != NULL
|
if (p != NULL
|
||||||
&& (SYMBOL_VALUE_ADDRESS (p)
|
&& (p->value.address == BMSYMBOL_VALUE_ADDRESS (msymbol)))
|
||||||
== BMSYMBOL_VALUE_ADDRESS (msymbol)))
|
|
||||||
return tpst;
|
return tpst;
|
||||||
|
|
||||||
/* Also accept the textlow value of a psymtab as a
|
/* Also accept the textlow value of a psymtab as a
|
||||||
@ -276,7 +275,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
|
|||||||
symbol tables with line information but no debug
|
symbol tables with line information but no debug
|
||||||
symbols (e.g. those produced by an assembler). */
|
symbols (e.g. those produced by an assembler). */
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
this_addr = SYMBOL_VALUE_ADDRESS (p);
|
this_addr = p->value.address;
|
||||||
else
|
else
|
||||||
this_addr = tpst->textlow;
|
this_addr = tpst->textlow;
|
||||||
|
|
||||||
@ -334,8 +333,7 @@ find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
|
|||||||
object's symbol table. */
|
object's symbol table. */
|
||||||
p = find_pc_sect_psymbol (objfile, pst, pc, section);
|
p = find_pc_sect_psymbol (objfile, pst, pc, section);
|
||||||
if (p == NULL
|
if (p == NULL
|
||||||
|| (SYMBOL_VALUE_ADDRESS (p)
|
|| (p->value.address != BMSYMBOL_VALUE_ADDRESS (msymbol)))
|
||||||
!= BMSYMBOL_VALUE_ADDRESS (msymbol)))
|
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,21 +423,21 @@ find_pc_sect_psymbol (struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
partial_symbol *p = objfile->global_psymbols[psymtab->globals_offset + i];
|
partial_symbol *p = objfile->global_psymbols[psymtab->globals_offset + i];
|
||||||
|
|
||||||
if (SYMBOL_DOMAIN (p) == VAR_DOMAIN
|
if (p->domain == VAR_DOMAIN
|
||||||
&& PSYMBOL_CLASS (p) == LOC_BLOCK
|
&& p->aclass == LOC_BLOCK
|
||||||
&& pc >= SYMBOL_VALUE_ADDRESS (p)
|
&& pc >= p->value.address
|
||||||
&& (SYMBOL_VALUE_ADDRESS (p) > best_pc
|
&& (p->value.address > best_pc
|
||||||
|| (psymtab->textlow == 0
|
|| (psymtab->textlow == 0
|
||||||
&& best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0)))
|
&& best_pc == 0 && p->value.address == 0)))
|
||||||
{
|
{
|
||||||
if (section != NULL) /* Match on a specific section. */
|
if (section != NULL) /* Match on a specific section. */
|
||||||
{
|
{
|
||||||
fixup_psymbol_section (p, objfile);
|
fixup_psymbol_section (p, objfile);
|
||||||
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (objfile, p),
|
if (!matching_obj_sections (p->obj_section (objfile),
|
||||||
section))
|
section))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
best_pc = SYMBOL_VALUE_ADDRESS (p);
|
best_pc = p->value.address;
|
||||||
best = p;
|
best = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,21 +446,21 @@ find_pc_sect_psymbol (struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
partial_symbol *p = objfile->static_psymbols[psymtab->statics_offset + i];
|
partial_symbol *p = objfile->static_psymbols[psymtab->statics_offset + i];
|
||||||
|
|
||||||
if (SYMBOL_DOMAIN (p) == VAR_DOMAIN
|
if (p->domain == VAR_DOMAIN
|
||||||
&& PSYMBOL_CLASS (p) == LOC_BLOCK
|
&& p->aclass == LOC_BLOCK
|
||||||
&& pc >= SYMBOL_VALUE_ADDRESS (p)
|
&& pc >= p->value.address
|
||||||
&& (SYMBOL_VALUE_ADDRESS (p) > best_pc
|
&& (p->value.address > best_pc
|
||||||
|| (psymtab->textlow == 0
|
|| (psymtab->textlow == 0
|
||||||
&& best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0)))
|
&& best_pc == 0 && p->value.address == 0)))
|
||||||
{
|
{
|
||||||
if (section != NULL) /* Match on a specific section. */
|
if (section != NULL) /* Match on a specific section. */
|
||||||
{
|
{
|
||||||
fixup_psymbol_section (p, objfile);
|
fixup_psymbol_section (p, objfile);
|
||||||
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (objfile, p),
|
if (!matching_obj_sections (p->obj_section (objfile),
|
||||||
section))
|
section))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
best_pc = SYMBOL_VALUE_ADDRESS (p);
|
best_pc = p->value.address;
|
||||||
best = p;
|
best = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -478,17 +476,17 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
|
|||||||
if (psym == NULL)
|
if (psym == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (SYMBOL_SECTION (psym) >= 0)
|
if (psym->section >= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gdb_assert (objfile);
|
gdb_assert (objfile);
|
||||||
|
|
||||||
switch (PSYMBOL_CLASS (psym))
|
switch (psym->aclass)
|
||||||
{
|
{
|
||||||
case LOC_STATIC:
|
case LOC_STATIC:
|
||||||
case LOC_LABEL:
|
case LOC_LABEL:
|
||||||
case LOC_BLOCK:
|
case LOC_BLOCK:
|
||||||
addr = SYMBOL_VALUE_ADDRESS (psym);
|
addr = psym->value.address;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Nothing else will be listed in the minsyms -- no use looking
|
/* Nothing else will be listed in the minsyms -- no use looking
|
||||||
@ -496,7 +494,7 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixup_section (&psym->ginfo, addr, objfile);
|
fixup_section (psym, addr, objfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Psymtab version of lookup_symbol. See its definition in
|
/* Psymtab version of lookup_symbol. See its definition in
|
||||||
@ -554,10 +552,10 @@ static bool
|
|||||||
psymbol_name_matches (partial_symbol *psym,
|
psymbol_name_matches (partial_symbol *psym,
|
||||||
const lookup_name_info &lookup_name)
|
const lookup_name_info &lookup_name)
|
||||||
{
|
{
|
||||||
const language_defn *lang = language_def (SYMBOL_LANGUAGE (psym));
|
const language_defn *lang = language_def (psym->language);
|
||||||
symbol_name_matcher_ftype *name_match
|
symbol_name_matcher_ftype *name_match
|
||||||
= get_symbol_name_matcher (lang, lookup_name);
|
= get_symbol_name_matcher (lang, lookup_name);
|
||||||
return name_match (SYMBOL_SEARCH_NAME (psym), lookup_name, NULL);
|
return name_match (symbol_search_name (psym), lookup_name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look in PST for a symbol in DOMAIN whose name matches NAME. Search
|
/* Look in PST for a symbol in DOMAIN whose name matches NAME. Search
|
||||||
@ -607,11 +605,11 @@ match_partial_symbol (struct objfile *objfile,
|
|||||||
center = bottom + (top - bottom) / 2;
|
center = bottom + (top - bottom) / 2;
|
||||||
gdb_assert (center < top);
|
gdb_assert (center < top);
|
||||||
|
|
||||||
enum language lang = SYMBOL_LANGUAGE (*center);
|
enum language lang = (*center)->language;
|
||||||
const char *lang_ln
|
const char *lang_ln
|
||||||
= lookup_name.language_lookup_name (lang).c_str ();
|
= lookup_name.language_lookup_name (lang).c_str ();
|
||||||
|
|
||||||
if (ordered_compare (SYMBOL_SEARCH_NAME (*center), lang_ln) >= 0)
|
if (ordered_compare (symbol_search_name (*center), lang_ln) >= 0)
|
||||||
top = center;
|
top = center;
|
||||||
else
|
else
|
||||||
bottom = center + 1;
|
bottom = center + 1;
|
||||||
@ -621,8 +619,8 @@ match_partial_symbol (struct objfile *objfile,
|
|||||||
while (top <= real_top
|
while (top <= real_top
|
||||||
&& psymbol_name_matches (*top, lookup_name))
|
&& psymbol_name_matches (*top, lookup_name))
|
||||||
{
|
{
|
||||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (*top),
|
if (symbol_matches_domain ((*top)->language,
|
||||||
SYMBOL_DOMAIN (*top), domain))
|
(*top)->domain, domain))
|
||||||
return *top;
|
return *top;
|
||||||
top++;
|
top++;
|
||||||
}
|
}
|
||||||
@ -635,8 +633,8 @@ match_partial_symbol (struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
for (psym = start; psym < start + length; psym++)
|
for (psym = start; psym < start + length; psym++)
|
||||||
{
|
{
|
||||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym),
|
if (symbol_matches_domain ((*psym)->language,
|
||||||
SYMBOL_DOMAIN (*psym), domain)
|
(*psym)->domain, domain)
|
||||||
&& psymbol_name_matches (*psym, lookup_name))
|
&& psymbol_name_matches (*psym, lookup_name))
|
||||||
return *psym;
|
return *psym;
|
||||||
}
|
}
|
||||||
@ -718,7 +716,7 @@ lookup_partial_symbol (struct objfile *objfile,
|
|||||||
if (!(center < top))
|
if (!(center < top))
|
||||||
internal_error (__FILE__, __LINE__,
|
internal_error (__FILE__, __LINE__,
|
||||||
_("failed internal consistency check"));
|
_("failed internal consistency check"));
|
||||||
if (strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*center),
|
if (strcmp_iw_ordered (symbol_search_name (*center),
|
||||||
search_name.get ()) >= 0)
|
search_name.get ()) >= 0)
|
||||||
{
|
{
|
||||||
top = center;
|
top = center;
|
||||||
@ -734,16 +732,16 @@ lookup_partial_symbol (struct objfile *objfile,
|
|||||||
|
|
||||||
/* For `case_sensitivity == case_sensitive_off' strcmp_iw_ordered will
|
/* For `case_sensitivity == case_sensitive_off' strcmp_iw_ordered will
|
||||||
search more exactly than what matches SYMBOL_MATCHES_SEARCH_NAME. */
|
search more exactly than what matches SYMBOL_MATCHES_SEARCH_NAME. */
|
||||||
while (top >= start && SYMBOL_MATCHES_SEARCH_NAME (*top, lookup_name))
|
while (top >= start && symbol_matches_search_name (*top, lookup_name))
|
||||||
top--;
|
top--;
|
||||||
|
|
||||||
/* Fixup to have a symbol which matches SYMBOL_MATCHES_SEARCH_NAME. */
|
/* Fixup to have a symbol which matches SYMBOL_MATCHES_SEARCH_NAME. */
|
||||||
top++;
|
top++;
|
||||||
|
|
||||||
while (top <= real_top && SYMBOL_MATCHES_SEARCH_NAME (*top, lookup_name))
|
while (top <= real_top && symbol_matches_search_name (*top, lookup_name))
|
||||||
{
|
{
|
||||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (*top),
|
if (symbol_matches_domain ((*top)->language,
|
||||||
SYMBOL_DOMAIN (*top), domain))
|
(*top)->domain, domain))
|
||||||
return *top;
|
return *top;
|
||||||
top++;
|
top++;
|
||||||
}
|
}
|
||||||
@ -756,9 +754,9 @@ lookup_partial_symbol (struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
for (psym = start; psym < start + length; psym++)
|
for (psym = start; psym < start + length; psym++)
|
||||||
{
|
{
|
||||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym),
|
if (symbol_matches_domain ((*psym)->language,
|
||||||
SYMBOL_DOMAIN (*psym), domain)
|
(*psym)->domain, domain)
|
||||||
&& SYMBOL_MATCHES_SEARCH_NAME (*psym, lookup_name))
|
&& symbol_matches_search_name (*psym, lookup_name))
|
||||||
return *psym;
|
return *psym;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -814,14 +812,14 @@ psym_relocate (struct objfile *objfile,
|
|||||||
for (partial_symbol *psym : objfile->global_psymbols)
|
for (partial_symbol *psym : objfile->global_psymbols)
|
||||||
{
|
{
|
||||||
fixup_psymbol_section (psym, objfile);
|
fixup_psymbol_section (psym, objfile);
|
||||||
if (SYMBOL_SECTION (psym) >= 0)
|
if (psym->section >= 0)
|
||||||
SYMBOL_VALUE_ADDRESS (psym) += ANOFFSET (delta, SYMBOL_SECTION (psym));
|
psym->value.address += ANOFFSET (delta, psym->section);
|
||||||
}
|
}
|
||||||
for (partial_symbol *psym : objfile->static_psymbols)
|
for (partial_symbol *psym : objfile->static_psymbols)
|
||||||
{
|
{
|
||||||
fixup_psymbol_section (psym, objfile);
|
fixup_psymbol_section (psym, objfile);
|
||||||
if (SYMBOL_SECTION (psym) >= 0)
|
if (psym->section >= 0)
|
||||||
SYMBOL_VALUE_ADDRESS (psym) += ANOFFSET (delta, SYMBOL_SECTION (psym));
|
psym->value.address += ANOFFSET (delta, psym->section);
|
||||||
}
|
}
|
||||||
|
|
||||||
objfile->psymbol_map.clear ();
|
objfile->psymbol_map.clear ();
|
||||||
@ -893,13 +891,13 @@ print_partial_symbols (struct gdbarch *gdbarch,
|
|||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
fprintf_filtered (outfile, " `%s'", SYMBOL_LINKAGE_NAME (*p));
|
fprintf_filtered (outfile, " `%s'", (*p)->name);
|
||||||
if (SYMBOL_DEMANGLED_NAME (*p) != NULL)
|
if (symbol_demangled_name (*p) != NULL)
|
||||||
{
|
{
|
||||||
fprintf_filtered (outfile, " `%s'", SYMBOL_DEMANGLED_NAME (*p));
|
fprintf_filtered (outfile, " `%s'", symbol_demangled_name (*p));
|
||||||
}
|
}
|
||||||
fputs_filtered (", ", outfile);
|
fputs_filtered (", ", outfile);
|
||||||
switch (SYMBOL_DOMAIN (*p))
|
switch ((*p)->domain)
|
||||||
{
|
{
|
||||||
case UNDEF_DOMAIN:
|
case UNDEF_DOMAIN:
|
||||||
fputs_filtered ("undefined domain, ", outfile);
|
fputs_filtered ("undefined domain, ", outfile);
|
||||||
@ -917,7 +915,7 @@ print_partial_symbols (struct gdbarch *gdbarch,
|
|||||||
fputs_filtered ("<invalid domain>, ", outfile);
|
fputs_filtered ("<invalid domain>, ", outfile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (PSYMBOL_CLASS (*p))
|
switch ((*p)->aclass)
|
||||||
{
|
{
|
||||||
case LOC_UNDEF:
|
case LOC_UNDEF:
|
||||||
fputs_filtered ("undefined", outfile);
|
fputs_filtered ("undefined", outfile);
|
||||||
@ -969,7 +967,7 @@ print_partial_symbols (struct gdbarch *gdbarch,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fputs_filtered (", ", outfile);
|
fputs_filtered (", ", outfile);
|
||||||
fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (*p)), outfile);
|
fputs_filtered (paddress (gdbarch, (*p)->value.address), outfile);
|
||||||
fprintf_filtered (outfile, "\n");
|
fprintf_filtered (outfile, "\n");
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -1364,14 +1362,14 @@ recursively_search_psymtabs
|
|||||||
|
|
||||||
if ((domain == ALL_DOMAIN
|
if ((domain == ALL_DOMAIN
|
||||||
|| (domain == VARIABLES_DOMAIN
|
|| (domain == VARIABLES_DOMAIN
|
||||||
&& PSYMBOL_CLASS (*psym) != LOC_TYPEDEF
|
&& (*psym)->aclass != LOC_TYPEDEF
|
||||||
&& PSYMBOL_CLASS (*psym) != LOC_BLOCK)
|
&& (*psym)->aclass != LOC_BLOCK)
|
||||||
|| (domain == FUNCTIONS_DOMAIN
|
|| (domain == FUNCTIONS_DOMAIN
|
||||||
&& PSYMBOL_CLASS (*psym) == LOC_BLOCK)
|
&& (*psym)->aclass == LOC_BLOCK)
|
||||||
|| (domain == TYPES_DOMAIN
|
|| (domain == TYPES_DOMAIN
|
||||||
&& PSYMBOL_CLASS (*psym) == LOC_TYPEDEF))
|
&& (*psym)->aclass == LOC_TYPEDEF))
|
||||||
&& psymbol_name_matches (*psym, lookup_name)
|
&& psymbol_name_matches (*psym, lookup_name)
|
||||||
&& (sym_matcher == NULL || sym_matcher (SYMBOL_SEARCH_NAME (*psym))))
|
&& (sym_matcher == NULL || sym_matcher (symbol_search_name (*psym))))
|
||||||
{
|
{
|
||||||
/* Found a match, so notify our caller. */
|
/* Found a match, so notify our caller. */
|
||||||
result = PST_SEARCHED_AND_FOUND;
|
result = PST_SEARCHED_AND_FOUND;
|
||||||
@ -1475,9 +1473,9 @@ psym_fill_psymbol_map (struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
struct partial_symbol *psym = symbols[start + i];
|
struct partial_symbol *psym = symbols[start + i];
|
||||||
|
|
||||||
if (PSYMBOL_CLASS (psym) == LOC_STATIC)
|
if (psym->aclass == LOC_STATIC)
|
||||||
{
|
{
|
||||||
CORE_ADDR addr = SYMBOL_VALUE_ADDRESS (psym);
|
CORE_ADDR addr = psym->value.address;
|
||||||
if (seen_addrs->find (addr) == seen_addrs->end ())
|
if (seen_addrs->find (addr) == seen_addrs->end ())
|
||||||
{
|
{
|
||||||
seen_addrs->insert (addr);
|
seen_addrs->insert (addr);
|
||||||
@ -1573,8 +1571,8 @@ sort_pst_symbols (struct objfile *objfile, struct partial_symtab *pst)
|
|||||||
|
|
||||||
std::sort (begin, end, [] (partial_symbol *s1, partial_symbol *s2)
|
std::sort (begin, end, [] (partial_symbol *s1, partial_symbol *s2)
|
||||||
{
|
{
|
||||||
return strcmp_iw_ordered (SYMBOL_SEARCH_NAME (s1),
|
return strcmp_iw_ordered (symbol_search_name (s1),
|
||||||
SYMBOL_SEARCH_NAME (s2)) < 0;
|
symbol_search_name (s2)) < 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1621,17 +1619,18 @@ psymbol_hash (const void *addr, int length)
|
|||||||
{
|
{
|
||||||
unsigned long h = 0;
|
unsigned long h = 0;
|
||||||
struct partial_symbol *psymbol = (struct partial_symbol *) addr;
|
struct partial_symbol *psymbol = (struct partial_symbol *) addr;
|
||||||
unsigned int lang = psymbol->ginfo.language;
|
unsigned int lang = psymbol->language;
|
||||||
unsigned int domain = PSYMBOL_DOMAIN (psymbol);
|
unsigned int domain = psymbol->domain;
|
||||||
unsigned int theclass = PSYMBOL_CLASS (psymbol);
|
unsigned int theclass = psymbol->aclass;
|
||||||
|
|
||||||
h = hash_continue (&psymbol->ginfo.value, sizeof (psymbol->ginfo.value), h);
|
h = hash_continue (&psymbol->value, sizeof (psymbol->value), h);
|
||||||
h = hash_continue (&lang, sizeof (unsigned int), h);
|
h = hash_continue (&lang, sizeof (unsigned int), h);
|
||||||
h = hash_continue (&domain, sizeof (unsigned int), h);
|
h = hash_continue (&domain, sizeof (unsigned int), h);
|
||||||
h = hash_continue (&theclass, sizeof (unsigned int), h);
|
h = hash_continue (&theclass, sizeof (unsigned int), h);
|
||||||
/* Note that psymbol names are interned via symbol_set_names, so
|
/* Note that psymbol names are interned via symbol_set_names, so
|
||||||
there's no need to hash the contents of the name here. */
|
there's no need to hash the contents of the name here. */
|
||||||
h = hash_continue (&psymbol->ginfo.name, sizeof (psymbol->ginfo.name), h);
|
h = hash_continue (&psymbol->name,
|
||||||
|
sizeof (psymbol->name), h);
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
@ -1646,15 +1645,15 @@ psymbol_compare (const void *addr1, const void *addr2, int length)
|
|||||||
struct partial_symbol *sym1 = (struct partial_symbol *) addr1;
|
struct partial_symbol *sym1 = (struct partial_symbol *) addr1;
|
||||||
struct partial_symbol *sym2 = (struct partial_symbol *) addr2;
|
struct partial_symbol *sym2 = (struct partial_symbol *) addr2;
|
||||||
|
|
||||||
return (memcmp (&sym1->ginfo.value, &sym2->ginfo.value,
|
return (memcmp (&sym1->value, &sym2->value,
|
||||||
sizeof (sym1->ginfo.value)) == 0
|
sizeof (sym1->value)) == 0
|
||||||
&& sym1->ginfo.language == sym2->ginfo.language
|
&& sym1->language == sym2->language
|
||||||
&& PSYMBOL_DOMAIN (sym1) == PSYMBOL_DOMAIN (sym2)
|
&& sym1->domain == sym2->domain
|
||||||
&& PSYMBOL_CLASS (sym1) == PSYMBOL_CLASS (sym2)
|
&& sym1->aclass == sym2->aclass
|
||||||
/* Note that psymbol names are interned via
|
/* Note that psymbol names are interned via
|
||||||
symbol_set_names, so there's no need to compare the
|
symbol_set_names, so there's no need to compare the
|
||||||
contents of the name here. */
|
contents of the name here. */
|
||||||
&& sym1->ginfo.name == sym2->ginfo.name);
|
&& sym1->name == sym2->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize a partial symbol bcache. */
|
/* Initialize a partial symbol bcache. */
|
||||||
@ -1719,18 +1718,15 @@ add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
|
|||||||
{
|
{
|
||||||
struct partial_symbol psymbol;
|
struct partial_symbol psymbol;
|
||||||
|
|
||||||
/* We must ensure that the entire struct has been zeroed before
|
psymbol.value.address = coreaddr;
|
||||||
assigning to it, because an assignment may not touch some of the
|
psymbol.section = -1;
|
||||||
holes. */
|
psymbol.domain = domain;
|
||||||
memset (&psymbol, 0, sizeof (psymbol));
|
psymbol.aclass = theclass;
|
||||||
|
|
||||||
SYMBOL_VALUE_ADDRESS (&psymbol) = coreaddr;
|
memset (&psymbol.language_specific, 0, sizeof (psymbol.language_specific));
|
||||||
SYMBOL_SECTION (&psymbol) = -1;
|
psymbol.ada_mangled = 0;
|
||||||
SYMBOL_SET_LANGUAGE (&psymbol, language, &objfile->objfile_obstack);
|
symbol_set_language (&psymbol, language, &objfile->objfile_obstack);
|
||||||
PSYMBOL_DOMAIN (&psymbol) = domain;
|
symbol_set_names (&psymbol, name, namelength, copy_name, objfile);
|
||||||
PSYMBOL_CLASS (&psymbol) = theclass;
|
|
||||||
|
|
||||||
SYMBOL_SET_NAMES (&psymbol, name, namelength, copy_name, objfile);
|
|
||||||
|
|
||||||
/* Stash the partial symbol away in the cache. */
|
/* Stash the partial symbol away in the cache. */
|
||||||
return psymbol_bcache_full (&psymbol, objfile->psymbol_cache, added);
|
return psymbol_bcache_full (&psymbol, objfile->psymbol_cache, added);
|
||||||
@ -2252,13 +2248,13 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
|
|||||||
length = ps->n_static_syms;
|
length = ps->n_static_syms;
|
||||||
while (length--)
|
while (length--)
|
||||||
{
|
{
|
||||||
sym = block_lookup_symbol (b, SYMBOL_SEARCH_NAME (*psym),
|
sym = block_lookup_symbol (b, symbol_search_name (*psym),
|
||||||
symbol_name_match_type::SEARCH_NAME,
|
symbol_name_match_type::SEARCH_NAME,
|
||||||
SYMBOL_DOMAIN (*psym));
|
(*psym)->domain);
|
||||||
if (!sym)
|
if (!sym)
|
||||||
{
|
{
|
||||||
printf_filtered ("Static symbol `");
|
printf_filtered ("Static symbol `");
|
||||||
puts_filtered (SYMBOL_LINKAGE_NAME (*psym));
|
puts_filtered ((*psym)->name);
|
||||||
printf_filtered ("' only found in ");
|
printf_filtered ("' only found in ");
|
||||||
puts_filtered (ps->filename);
|
puts_filtered (ps->filename);
|
||||||
printf_filtered (" psymtab\n");
|
printf_filtered (" psymtab\n");
|
||||||
@ -2270,13 +2266,13 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
|
|||||||
length = ps->n_global_syms;
|
length = ps->n_global_syms;
|
||||||
while (length--)
|
while (length--)
|
||||||
{
|
{
|
||||||
sym = block_lookup_symbol (b, SYMBOL_SEARCH_NAME (*psym),
|
sym = block_lookup_symbol (b, symbol_search_name (*psym),
|
||||||
symbol_name_match_type::SEARCH_NAME,
|
symbol_name_match_type::SEARCH_NAME,
|
||||||
SYMBOL_DOMAIN (*psym));
|
(*psym)->domain);
|
||||||
if (!sym)
|
if (!sym)
|
||||||
{
|
{
|
||||||
printf_filtered ("Global symbol `");
|
printf_filtered ("Global symbol `");
|
||||||
puts_filtered (SYMBOL_LINKAGE_NAME (*psym));
|
puts_filtered ((*psym)->name);
|
||||||
printf_filtered ("' only found in ");
|
printf_filtered ("' only found in ");
|
||||||
puts_filtered (ps->filename);
|
puts_filtered (ps->filename);
|
||||||
printf_filtered (" psymtab\n");
|
printf_filtered (" psymtab\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user