* [patch] add linkage_name argument to lookup_partial_symbol
@ 2003-03-03 20:36 David Carlton
2003-03-03 20:04 ` David Carlton
2003-03-04 17:06 ` David Carlton
0 siblings, 2 replies; 3+ messages in thread
From: David Carlton @ 2003-03-03 20:36 UTC (permalink / raw)
To: gdb-patches; +Cc: Elena Zannoni, Jim Blandy
Currently, lookup_partial_symbol only matches on natural names, not on
linkage names. This can be a problem when it's called from
lookup_symbol_aux_psymtabs: that functions cares about the linkage
name of the symbol in addition to its natural name. So the wrong
partial symtab could be found, leading to a "name found in psymtab but
not in symtab" error.
Here's a patch to fix that; it seems obvious, so I'm planning to
commit it tomorrow unless somebody objects. I've tested it on
i686-pc-linux-gnu/GCC3.1/DWARF-2; Michael's run it through his entire
testbed, since I thought it might fix a Java bug that I can't
reproduce. (It didn't, alas.) No new failures in either case.
David Carlton
carlton@math.stanford.edu
2003-03-03 David Carlton <carlton@math.stanford.edu>
* symtab.c (lookup_partial_symbol): Add linkage_name argument.
(lookup_symbol_aux_psymtabs): Update call to
lookup_partial_symbol.
(lookup_transparent_type, find_main_psymtab)
(make_symbol_overload_list): Ditto.
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.98
diff -u -p -r1.98 symtab.c
--- symtab.c 3 Mar 2003 18:34:12 -0000 1.98
+++ symtab.c 3 Mar 2003 19:28:56 -0000
@@ -76,6 +76,7 @@ static int find_line_common (struct line
char *operator_chars (char *p, char **end);
static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
+ const char *,
const char *, int,
namespace_enum);
@@ -1201,7 +1202,8 @@ lookup_symbol_aux_psymtabs (int block_in
ALL_PSYMTABS (objfile, ps)
{
if (!ps->readin
- && lookup_partial_symbol (ps, name, psymtab_index, namespace))
+ && lookup_partial_symbol (ps, name, mangled_name,
+ psymtab_index, namespace))
{
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
@@ -1367,11 +1369,14 @@ lookup_symbol_aux_minsyms (const char *n
return NULL;
}
-/* Look, in partial_symtab PST, for symbol NAME. Check the global
- symbols if GLOBAL, the static symbols if not */
+/* Look, in partial_symtab PST, for symbol whose natural name is NAME.
+ If LINKAGE_NAME is non-NULL, check in addition that the symbol's
+ linkage name matches it. Check the global symbols if GLOBAL, the
+ static symbols if not */
static struct partial_symbol *
-lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
+lookup_partial_symbol (struct partial_symtab *pst, const char *name,
+ const char *linkage_name, int global,
namespace_enum namespace)
{
struct partial_symbol *temp;
@@ -1423,7 +1428,10 @@ lookup_partial_symbol (struct partial_sy
if (!(top == bottom))
internal_error (__FILE__, __LINE__, "failed internal consistency check");
- while (top <= real_top && SYMBOL_MATCHES_NATURAL_NAME (*top,name))
+ while (top <= real_top
+ && (linkage_name != NULL
+ ? strcmp (SYMBOL_LINKAGE_NAME (*top), linkage_name) == 0
+ : SYMBOL_MATCHES_NATURAL_NAME (*top,name)))
{
if (SYMBOL_NAMESPACE (*top) == namespace)
{
@@ -1442,7 +1450,9 @@ lookup_partial_symbol (struct partial_sy
{
if (namespace == SYMBOL_NAMESPACE (*psym))
{
- if (SYMBOL_MATCHES_NATURAL_NAME (*psym, name))
+ if (linkage_name != NULL
+ ? strcmp (SYMBOL_LINKAGE_NAME (*psym), linkage_name) == 0
+ : SYMBOL_MATCHES_NATURAL_NAME (*psym, name))
{
return (*psym);
}
@@ -1489,7 +1499,8 @@ lookup_transparent_type (const char *nam
ALL_PSYMTABS (objfile, ps)
{
- if (!ps->readin && lookup_partial_symbol (ps, name, 1, STRUCT_NAMESPACE))
+ if (!ps->readin && lookup_partial_symbol (ps, name, NULL,
+ 1, STRUCT_NAMESPACE))
{
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
@@ -1536,7 +1547,7 @@ lookup_transparent_type (const char *nam
ALL_PSYMTABS (objfile, ps)
{
- if (!ps->readin && lookup_partial_symbol (ps, name, 0, STRUCT_NAMESPACE))
+ if (!ps->readin && lookup_partial_symbol (ps, name, NULL, 0, STRUCT_NAMESPACE))
{
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
@@ -1577,7 +1588,7 @@ find_main_psymtab (void)
ALL_PSYMTABS (objfile, pst)
{
- if (lookup_partial_symbol (pst, main_name (), 1, VAR_NAMESPACE))
+ if (lookup_partial_symbol (pst, main_name (), NULL, 1, VAR_NAMESPACE))
{
return (pst);
}
@@ -4027,8 +4038,10 @@ make_symbol_overload_list (struct symbol
if (ps->readin)
continue;
- if ((lookup_partial_symbol (ps, oload_name, 1, VAR_NAMESPACE) != NULL)
- || (lookup_partial_symbol (ps, oload_name, 0, VAR_NAMESPACE) != NULL))
+ if ((lookup_partial_symbol (ps, oload_name, NULL, 1, VAR_NAMESPACE)
+ != NULL)
+ || (lookup_partial_symbol (ps, oload_name, NULL, 0, VAR_NAMESPACE)
+ != NULL))
PSYMTAB_TO_SYMTAB (ps);
}
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch] add linkage_name argument to lookup_partial_symbol
2003-03-03 20:36 [patch] add linkage_name argument to lookup_partial_symbol David Carlton
@ 2003-03-03 20:04 ` David Carlton
2003-03-04 17:06 ` David Carlton
1 sibling, 0 replies; 3+ messages in thread
From: David Carlton @ 2003-03-03 20:04 UTC (permalink / raw)
To: gdb-patches; +Cc: Elena Zannoni, Jim Blandy
On 03 Mar 2003 11:50:54 -0800, David Carlton <carlton@math.Stanford.EDU> said:
> Currently, lookup_partial_symbol only matches on natural names, not on
> linkage names. This can be a problem when it's called from
> lookup_symbol_aux_psymtabs: that functions cares about the linkage
> name of the symbol in addition to its natural name. So the wrong
> partial symtab could be found, leading to a "name found in psymtab but
> not in symtab" error.
I should also add another observation: after this patch goes in, every
use of SYMBOL_MATCHES_NATURAL_NAME in symtab.c will be paired with a
check on linkage names. This suggests that perhaps we should replace
SYMBOL_MATCHES_NATURAL_NAME by a macro SYMBOL_MATCHES_NAMES that
accepts a symbol, a linkage name (which might be NULL), and a natural
name.
On the other hand, we still have the uses of
DEPRECATED_SYMBOL_MATCHES_NAME in minsyms.c, and there such a
SYMBOL_MATCHES_NAMES wouldn't be appropriate (though the current
SYMBOL_MATCHES_NATURAL_NAME might be). So it's not something to do
right now, but it probably is something to keep in mind once minsyms.c
has gotten cleaned up a bit, when we'll have a better idea where this
macro might be used. (We should probably audit all uses of strcmp_iw
within GDB when doing this.)
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] add linkage_name argument to lookup_partial_symbol
2003-03-03 20:36 [patch] add linkage_name argument to lookup_partial_symbol David Carlton
2003-03-03 20:04 ` David Carlton
@ 2003-03-04 17:06 ` David Carlton
1 sibling, 0 replies; 3+ messages in thread
From: David Carlton @ 2003-03-04 17:06 UTC (permalink / raw)
To: gdb-patches; +Cc: Elena Zannoni, Jim Blandy
On 03 Mar 2003 11:50:54 -0800, David Carlton <carlton@math.Stanford.EDU> said:
> Here's a patch to fix that; it seems obvious, so I'm planning to
> commit it tomorrow unless somebody objects.
Committed.
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-03-04 17:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-03 20:36 [patch] add linkage_name argument to lookup_partial_symbol David Carlton
2003-03-03 20:04 ` David Carlton
2003-03-04 17:06 ` David Carlton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox