* symtab.h (SYMBOL_SEARCH_NAME): New definition.
(SYMBOL_MATCHES_SEARCH_NAME): New definition. (symbol_search_name): Declare. * dictionary.c (iter_name_first_hashed): Match on SYMBOL_SEARCH_NAME. (iter_name_next_hashed): Ditto. (iter_name_next_linear): Ditto. (insert_symbol_hashed): Hash on SYMBOL_SEARCH_NAME. * symtab.c (lookup_partial_symbol): Assume symbols ordered by search name, using SYMBOL_SEARCH_NAME and SYMBOL_MATCHES_SEARCH_NAME. (symbol_search_name): New function. * symfile.c (compare_psymbols): Order by SYMBOL_SEARCH_NAME. * minsyms.c (build_minimal_symbol_hash_tables): Change test for adding to demangled hash table to check for difference between SYMBOL_SEARCH_NAME and SYMBOL_LINKAGE_NAME.
This commit is contained in:
parent
82d69f8b4c
commit
4725b72191
6 changed files with 53 additions and 10 deletions
|
@ -1,3 +1,24 @@
|
||||||
|
2004-05-20 Paul N. Hilfinger <hilfinger@gnat.com>
|
||||||
|
|
||||||
|
* symtab.h (SYMBOL_SEARCH_NAME): New definition.
|
||||||
|
(SYMBOL_MATCHES_SEARCH_NAME): New definition.
|
||||||
|
(symbol_search_name): Declare.
|
||||||
|
|
||||||
|
* dictionary.c (iter_name_first_hashed): Match on SYMBOL_SEARCH_NAME.
|
||||||
|
(iter_name_next_hashed): Ditto.
|
||||||
|
(iter_name_next_linear): Ditto.
|
||||||
|
(insert_symbol_hashed): Hash on SYMBOL_SEARCH_NAME.
|
||||||
|
|
||||||
|
* symtab.c (lookup_partial_symbol): Assume symbols ordered by
|
||||||
|
search name, using SYMBOL_SEARCH_NAME and SYMBOL_MATCHES_SEARCH_NAME.
|
||||||
|
(symbol_search_name): New function.
|
||||||
|
|
||||||
|
* symfile.c (compare_psymbols): Order by SYMBOL_SEARCH_NAME.
|
||||||
|
|
||||||
|
* minsyms.c (build_minimal_symbol_hash_tables): Change
|
||||||
|
test for adding to demangled hash table to check for difference
|
||||||
|
between SYMBOL_SEARCH_NAME and SYMBOL_LINKAGE_NAME.
|
||||||
|
|
||||||
2004-05-19 Jim Blandy <jimb@redhat.com>
|
2004-05-19 Jim Blandy <jimb@redhat.com>
|
||||||
|
|
||||||
Use a constructor function to create regset structures.
|
Use a constructor function to create regset structures.
|
||||||
|
|
|
@ -636,7 +636,7 @@ iter_name_first_hashed (const struct dictionary *dict,
|
||||||
sym = sym->hash_next)
|
sym = sym->hash_next)
|
||||||
{
|
{
|
||||||
/* Warning: the order of arguments to strcmp_iw matters! */
|
/* Warning: the order of arguments to strcmp_iw matters! */
|
||||||
if (strcmp_iw (SYMBOL_NATURAL_NAME (sym), name) == 0)
|
if (strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -656,7 +656,7 @@ iter_name_next_hashed (const char *name, struct dict_iterator *iterator)
|
||||||
next != NULL;
|
next != NULL;
|
||||||
next = next->hash_next)
|
next = next->hash_next)
|
||||||
{
|
{
|
||||||
if (strcmp_iw (SYMBOL_NATURAL_NAME (next), name) == 0)
|
if (strcmp_iw (SYMBOL_SEARCH_NAME (next), name) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ insert_symbol_hashed (struct dictionary *dict,
|
||||||
unsigned int hash_index;
|
unsigned int hash_index;
|
||||||
struct symbol **buckets = DICT_HASHED_BUCKETS (dict);
|
struct symbol **buckets = DICT_HASHED_BUCKETS (dict);
|
||||||
|
|
||||||
hash_index = (msymbol_hash_iw (SYMBOL_NATURAL_NAME (sym))
|
hash_index = (msymbol_hash_iw (SYMBOL_SEARCH_NAME (sym))
|
||||||
% DICT_HASHED_NBUCKETS (dict));
|
% DICT_HASHED_NBUCKETS (dict));
|
||||||
sym->hash_next = buckets[hash_index];
|
sym->hash_next = buckets[hash_index];
|
||||||
buckets[hash_index] = sym;
|
buckets[hash_index] = sym;
|
||||||
|
@ -789,7 +789,7 @@ iter_name_next_linear (const char *name, struct dict_iterator *iterator)
|
||||||
for (i = DICT_ITERATOR_INDEX (iterator) + 1; i < nsyms; ++i)
|
for (i = DICT_ITERATOR_INDEX (iterator) + 1; i < nsyms; ++i)
|
||||||
{
|
{
|
||||||
sym = DICT_LINEAR_SYM (dict, i);
|
sym = DICT_LINEAR_SYM (dict, i);
|
||||||
if (strcmp_iw (SYMBOL_NATURAL_NAME (sym), name) == 0)
|
if (strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
|
||||||
{
|
{
|
||||||
retval = sym;
|
retval = sym;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -791,7 +791,7 @@ build_minimal_symbol_hash_tables (struct objfile *objfile)
|
||||||
add_minsym_to_hash_table (msym, objfile->msymbol_hash);
|
add_minsym_to_hash_table (msym, objfile->msymbol_hash);
|
||||||
|
|
||||||
msym->demangled_hash_next = 0;
|
msym->demangled_hash_next = 0;
|
||||||
if (SYMBOL_DEMANGLED_NAME (msym) != NULL)
|
if (SYMBOL_SEARCH_NAME (msym) != SYMBOL_LINKAGE_NAME (msym))
|
||||||
add_minsym_to_demangled_hash_table (msym,
|
add_minsym_to_demangled_hash_table (msym,
|
||||||
objfile->msymbol_demangled_hash);
|
objfile->msymbol_demangled_hash);
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,8 +207,8 @@ compare_psymbols (const void *s1p, const void *s2p)
|
||||||
struct partial_symbol *const *s1 = s1p;
|
struct partial_symbol *const *s1 = s1p;
|
||||||
struct partial_symbol *const *s2 = s2p;
|
struct partial_symbol *const *s2 = s2p;
|
||||||
|
|
||||||
return strcmp_iw_ordered (SYMBOL_NATURAL_NAME (*s1),
|
return strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*s1),
|
||||||
SYMBOL_NATURAL_NAME (*s2));
|
SYMBOL_SEARCH_NAME (*s2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
14
gdb/symtab.c
14
gdb/symtab.c
|
@ -659,6 +659,14 @@ symbol_demangled_name (struct general_symbol_info *gsymbol)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return the search name of a symbol---generally the demangled or
|
||||||
|
linkage name of the symbol, depending on how it will be searched for.
|
||||||
|
If there is no distinct demangled name, then returns the same value
|
||||||
|
(same pointer) as SYMBOL_LINKAGE_NAME. */
|
||||||
|
char *symbol_search_name (const struct general_symbol_info *gsymbol) {
|
||||||
|
return symbol_natural_name (gsymbol);
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize the structure fields to zero values. */
|
/* Initialize the structure fields to zero values. */
|
||||||
void
|
void
|
||||||
init_sal (struct symtab_and_line *sal)
|
init_sal (struct symtab_and_line *sal)
|
||||||
|
@ -1467,7 +1475,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name,
|
||||||
{
|
{
|
||||||
do_linear_search = 1;
|
do_linear_search = 1;
|
||||||
}
|
}
|
||||||
if (strcmp_iw_ordered (SYMBOL_NATURAL_NAME (*center), name) >= 0)
|
if (strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*center), name) >= 0)
|
||||||
{
|
{
|
||||||
top = center;
|
top = center;
|
||||||
}
|
}
|
||||||
|
@ -1482,7 +1490,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name,
|
||||||
while (top <= real_top
|
while (top <= real_top
|
||||||
&& (linkage_name != NULL
|
&& (linkage_name != NULL
|
||||||
? strcmp (SYMBOL_LINKAGE_NAME (*top), linkage_name) == 0
|
? strcmp (SYMBOL_LINKAGE_NAME (*top), linkage_name) == 0
|
||||||
: SYMBOL_MATCHES_NATURAL_NAME (*top,name)))
|
: SYMBOL_MATCHES_SEARCH_NAME (*top,name)))
|
||||||
{
|
{
|
||||||
if (SYMBOL_DOMAIN (*top) == domain)
|
if (SYMBOL_DOMAIN (*top) == domain)
|
||||||
{
|
{
|
||||||
|
@ -1503,7 +1511,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name,
|
||||||
{
|
{
|
||||||
if (linkage_name != NULL
|
if (linkage_name != NULL
|
||||||
? strcmp (SYMBOL_LINKAGE_NAME (*psym), linkage_name) == 0
|
? strcmp (SYMBOL_LINKAGE_NAME (*psym), linkage_name) == 0
|
||||||
: SYMBOL_MATCHES_NATURAL_NAME (*psym, name))
|
: SYMBOL_MATCHES_SEARCH_NAME (*psym, name))
|
||||||
{
|
{
|
||||||
return (*psym);
|
return (*psym);
|
||||||
}
|
}
|
||||||
|
|
14
gdb/symtab.h
14
gdb/symtab.h
|
@ -258,6 +258,20 @@ extern char *symbol_demangled_name (struct general_symbol_info *symbol);
|
||||||
#define SYMBOL_MATCHES_NATURAL_NAME(symbol, name) \
|
#define SYMBOL_MATCHES_NATURAL_NAME(symbol, name) \
|
||||||
(strcmp_iw (SYMBOL_NATURAL_NAME (symbol), (name)) == 0)
|
(strcmp_iw (SYMBOL_NATURAL_NAME (symbol), (name)) == 0)
|
||||||
|
|
||||||
|
/* Macro that returns the name to be used when sorting and searching symbols.
|
||||||
|
In C++, Chill, and Java, we search for the demangled form of a name,
|
||||||
|
and so sort symbols accordingly. In Ada, however, we search by mangled
|
||||||
|
name. If there is no distinct demangled name, then SYMBOL_SEARCH_NAME
|
||||||
|
returns the same value (same pointer) as SYMBOL_LINKAGE_NAME. */
|
||||||
|
#define SYMBOL_SEARCH_NAME(symbol) \
|
||||||
|
(symbol_search_name (&(symbol)->ginfo))
|
||||||
|
extern char *symbol_search_name (const struct general_symbol_info *);
|
||||||
|
|
||||||
|
/* Analogous to SYMBOL_MATCHES_NATURAL_NAME, but uses the search
|
||||||
|
name. */
|
||||||
|
#define SYMBOL_MATCHES_SEARCH_NAME(symbol, name) \
|
||||||
|
(strcmp_iw (SYMBOL_SEARCH_NAME (symbol), (name)) == 0)
|
||||||
|
|
||||||
/* Classification types for a minimal symbol. These should be taken as
|
/* Classification types for a minimal symbol. These should be taken as
|
||||||
"advisory only", since if gdb can't easily figure out a
|
"advisory only", since if gdb can't easily figure out a
|
||||||
classification it simply selects mst_unknown. It may also have to
|
classification it simply selects mst_unknown. It may also have to
|
||||||
|
|
Loading…
Reference in a new issue