This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA]: Fix partial symbol lookups
- To: gdb-patches at sources dot redhat dot com
- Subject: [RFA]: Fix partial symbol lookups
- From: Daniel Berlin <dberlin at redhat dot com>
- Date: 14 Nov 2000 12:05:25 -0500
- Cc: jimb at redhat dot com
This patch should fix partial symbol lookups, which are currently
broken for C++.
Jim, this needs your approval.
--Dan
Changelog entry:
2000-11-14 Daniel Berlin <dberlin@redhat.com>
* symfile.c (compare_psymbols): Use SYMBOL_NAME rather than
SYMBOL_SOURCE_NAME.
* symtab.c (lookup_symbol_aux): Also take mangled name, and
then pass it as the name to use for lookup for partial symbols.
(lookup_symbol): Pass mangled name to lookup_symbol_aux.
(lookup_partial_symbol): No need for SYMBOL_SOURCE_NAME.
(top level): Change lookup_symbol_aux prototype to take mangled name as
last argument.
Patch:
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.22
diff -c -3 -p -r1.22 symtab.c
*** symtab.c 2000/11/10 23:02:56 1.22
--- symtab.c 2000/11/14 16:55:26
*************** static struct symbol *lookup_symbol_aux
*** 81,87 ****
struct block *block, const
namespace_enum namespace, int
*is_a_field_of_this, struct
! symtab **symtab);
static struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr);
--- 81,87 ----
struct block *block, const
namespace_enum namespace, int
*is_a_field_of_this, struct
! symtab **symtab, const char *mangled_name);
static struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr);
*************** lookup_symbol (const char *name, const s
*** 594,600 ****
}
returnval = lookup_symbol_aux (modified_name, block, namespace,
! is_a_field_of_this, symtab);
if (needtofreename)
free (modified_name2);
--- 594,600 ----
}
returnval = lookup_symbol_aux (modified_name, block, namespace,
! is_a_field_of_this, symtab, name);
if (needtofreename)
free (modified_name2);
*************** lookup_symbol (const char *name, const s
*** 604,610 ****
static struct symbol *
lookup_symbol_aux (const char *name, const struct block *block,
const namespace_enum namespace, int *is_a_field_of_this,
! struct symtab **symtab)
{
register struct symbol *sym;
register struct symtab *s = NULL;
--- 604,610 ----
static struct symbol *
lookup_symbol_aux (const char *name, const struct block *block,
const namespace_enum namespace, int *is_a_field_of_this,
! struct symtab **symtab, const char *mangled_name)
{
register struct symbol *sym;
register struct symtab *s = NULL;
*************** lookup_symbol_aux (const char *name, con
*** 785,791 ****
ALL_PSYMTABS (objfile, ps)
{
! if (!ps->readin && lookup_partial_symbol (ps, name, 1, namespace))
{
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
--- 785,791 ----
ALL_PSYMTABS (objfile, ps)
{
! if (!ps->readin && lookup_partial_symbol (ps, mangled_name, 1, namespace))
{
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
*************** lookup_symbol_aux (const char *name, con
*** 835,841 ****
ALL_PSYMTABS (objfile, ps)
{
! if (!ps->readin && lookup_partial_symbol (ps, name, 0, namespace))
{
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
--- 835,841 ----
ALL_PSYMTABS (objfile, ps)
{
! if (!ps->readin && lookup_partial_symbol (ps, mangled_name, 0, namespace))
{
s = PSYMTAB_TO_SYMTAB (ps);
bv = BLOCKVECTOR (s);
*************** lookup_symbol_aux (const char *name, con
*** 964,970 ****
}
/* Look, in partial_symtab PST, for symbol NAME. 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,
--- 964,975 ----
}
/* Look, in partial_symtab PST, for symbol NAME. Check the global
! symbols if GLOBAL, the static symbols if not.
!
! Be aware that minimal symbols have no demangled names. So we need to lookup
! by mangled name. However, this also means we can always binary search them,
! since they are a sorted list. If you change the way partial symbols work,
! you'll need to change this routine. */
static struct partial_symbol *
lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
*************** lookup_partial_symbol (struct partial_sy
*** 1000,1011 ****
center = bottom + (top - bottom) / 2;
if (!(center < top))
abort ();
! if (!do_linear_search
! && (SYMBOL_LANGUAGE (*center) == language_java))
! {
! do_linear_search = 1;
! }
! if (STRCMP (SYMBOL_SOURCE_NAME (*center), name) >= 0)
{
top = center;
}
--- 1005,1012 ----
center = bottom + (top - bottom) / 2;
if (!(center < top))
abort ();
!
! if (STRCMP (SYMBOL_NAME (*center), name) >= 0)
{
top = center;
}
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 symfile.c
*** symfile.c 2000/10/27 15:02:42 1.20
--- symfile.c 2000/11/14 16:55:27
*************** compare_psymbols (const PTR s1p, const P
*** 245,252 ****
s1 = (struct partial_symbol **) s1p;
s2 = (struct partial_symbol **) s2p;
! st1 = SYMBOL_SOURCE_NAME (*s1);
! st2 = SYMBOL_SOURCE_NAME (*s2);
if ((st1[0] - st2[0]) || !st1[0])
--- 245,252 ----
s1 = (struct partial_symbol **) s1p;
s2 = (struct partial_symbol **) s2p;
! st1 = SYMBOL_NAME (*s1);
! st2 = SYMBOL_NAME (*s2);
if ((st1[0] - st2[0]) || !st1[0])