2000-10-12 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
From Daniel Berlin <dberlin@redhat.com> : * symtab.c (lookup_symbol_aux): New function. Renamed from lookup_symbol. Move code to do demangling/case sensitivity to lookup_symbol(). (lookup_symbol): Now wrapper for lookup_symbol_aux, so we can perform case sensitivity/demangling without leaking memory. Move code to do demangling/case sensitivity from old_lookup_symbol to here. (lookup_partial_symbol): Use SYMBOL_SOURCE_NAME instead of SYMBOL_NAME. (lookup_block_symbol): Use SYMBOL_SOURCE_NAME instead of SYMBOL_NAME. Don't do linear search in case of C++. * symfile.c (compare_symbols): Use SYMBOL_SOURCE_NAME instead of SYMBOL_NAME. (compare_psymbols): Same here.
This commit is contained in:
parent
24376d1b58
commit
fba7f19cf6
|
@ -1,3 +1,23 @@
|
||||||
|
2000-10-12 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
|
||||||
|
|
||||||
|
From Daniel Berlin <dberlin@redhat.com> :
|
||||||
|
|
||||||
|
* symtab.c (lookup_symbol_aux): New function. Renamed from
|
||||||
|
lookup_symbol. Move code to do demangling/case sensitivity to
|
||||||
|
lookup_symbol().
|
||||||
|
(lookup_symbol): Now wrapper for lookup_symbol_aux, so we can
|
||||||
|
perform case sensitivity/demangling without leaking memory. Move
|
||||||
|
code to do demangling/case sensitivity from old_lookup_symbol to
|
||||||
|
here.
|
||||||
|
(lookup_partial_symbol): Use SYMBOL_SOURCE_NAME instead of
|
||||||
|
SYMBOL_NAME.
|
||||||
|
(lookup_block_symbol): Use SYMBOL_SOURCE_NAME instead of
|
||||||
|
SYMBOL_NAME. Don't do linear search in case of C++.
|
||||||
|
|
||||||
|
* symfile.c (compare_symbols): Use SYMBOL_SOURCE_NAME instead of
|
||||||
|
SYMBOL_NAME.
|
||||||
|
(compare_psymbols): Same here.
|
||||||
|
|
||||||
2000-10-09 Kevin Buettner <kevinb@redhat.com>
|
2000-10-09 Kevin Buettner <kevinb@redhat.com>
|
||||||
|
|
||||||
* remote-nindy.c (non_dle, nindy_xfer_inferior_memory): Protoize.
|
* remote-nindy.c (non_dle, nindy_xfer_inferior_memory): Protoize.
|
||||||
|
|
|
@ -212,8 +212,7 @@ compare_symbols (const PTR s1p, const PTR s2p)
|
||||||
|
|
||||||
s1 = (struct symbol **) s1p;
|
s1 = (struct symbol **) s1p;
|
||||||
s2 = (struct symbol **) s2p;
|
s2 = (struct symbol **) s2p;
|
||||||
|
return (STRCMP (SYMBOL_SOURCE_NAME (*s1), SYMBOL_SOURCE_NAME (*s2)));
|
||||||
return (STRCMP (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -241,8 +240,14 @@ compare_symbols (const PTR s1p, const PTR s2p)
|
||||||
static int
|
static int
|
||||||
compare_psymbols (const PTR s1p, const PTR s2p)
|
compare_psymbols (const PTR s1p, const PTR s2p)
|
||||||
{
|
{
|
||||||
register char *st1 = SYMBOL_NAME (*(struct partial_symbol **) s1p);
|
register struct partial_symbol **s1, **s2;
|
||||||
register char *st2 = SYMBOL_NAME (*(struct partial_symbol **) s2p);
|
register char *st1, *st2;
|
||||||
|
|
||||||
|
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])
|
if ((st1[0] - st2[0]) || !st1[0])
|
||||||
{
|
{
|
||||||
|
|
90
gdb/symtab.c
90
gdb/symtab.c
|
@ -83,6 +83,13 @@ static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
|
||||||
|
|
||||||
static struct symtab *lookup_symtab_1 (char *);
|
static struct symtab *lookup_symtab_1 (char *);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
static void cplusplus_hint (char *);
|
static void cplusplus_hint (char *);
|
||||||
|
|
||||||
static struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr);
|
static struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr);
|
||||||
|
@ -572,17 +579,14 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
|
||||||
can probably assume it will never hit the C++ code). */
|
can probably assume it will never hit the C++ code). */
|
||||||
|
|
||||||
struct symbol *
|
struct symbol *
|
||||||
lookup_symbol (const char *name, register const struct block *block,
|
lookup_symbol (const char *name, const struct block *block,
|
||||||
const namespace_enum namespace, int *is_a_field_of_this,
|
const namespace_enum namespace, int *is_a_field_of_this,
|
||||||
struct symtab **symtab)
|
struct symtab **symtab)
|
||||||
{
|
{
|
||||||
register struct symbol *sym;
|
char *modified_name = NULL;
|
||||||
register struct symtab *s = NULL;
|
char *modified_name2 = NULL;
|
||||||
register struct partial_symtab *ps;
|
int needtofreename = 0;
|
||||||
struct blockvector *bv;
|
struct symbol *returnval;
|
||||||
register struct objfile *objfile = NULL;
|
|
||||||
register struct block *b;
|
|
||||||
register struct minimal_symbol *msymbol;
|
|
||||||
|
|
||||||
if (case_sensitivity == case_sensitive_off)
|
if (case_sensitivity == case_sensitive_off)
|
||||||
{
|
{
|
||||||
|
@ -594,8 +598,44 @@ lookup_symbol (const char *name, register const struct block *block,
|
||||||
for (i= 0; i < len; i++)
|
for (i= 0; i < len; i++)
|
||||||
copy[i] = tolower (name[i]);
|
copy[i] = tolower (name[i]);
|
||||||
copy[len] = 0;
|
copy[len] = 0;
|
||||||
name = copy;
|
modified_name = copy;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
modified_name = (char *) name;
|
||||||
|
|
||||||
|
/* If we are using C++ language, demangle the name before doing a lookup, so
|
||||||
|
we can always binary search. */
|
||||||
|
if (current_language->la_language == language_cplus)
|
||||||
|
{
|
||||||
|
modified_name2 = cplus_demangle (modified_name, DMGL_ANSI | DMGL_PARAMS);
|
||||||
|
if (modified_name2)
|
||||||
|
{
|
||||||
|
modified_name = modified_name2;
|
||||||
|
needtofreename = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
returnval = lookup_symbol_aux (modified_name, block, namespace,
|
||||||
|
is_a_field_of_this, symtab);
|
||||||
|
if (needtofreename)
|
||||||
|
free (modified_name2);
|
||||||
|
|
||||||
|
return returnval;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
register struct partial_symtab *ps;
|
||||||
|
register struct blockvector *bv;
|
||||||
|
register struct objfile *objfile = NULL;
|
||||||
|
register struct block *b;
|
||||||
|
register struct minimal_symbol *msymbol;
|
||||||
|
|
||||||
|
|
||||||
/* Search specified block and its superiors. */
|
/* Search specified block and its superiors. */
|
||||||
|
|
||||||
|
@ -987,7 +1027,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
|
||||||
{
|
{
|
||||||
do_linear_search = 1;
|
do_linear_search = 1;
|
||||||
}
|
}
|
||||||
if (STRCMP (SYMBOL_NAME (*center), name) >= 0)
|
if (STRCMP (SYMBOL_SOURCE_NAME (*center), name) >= 0)
|
||||||
{
|
{
|
||||||
top = center;
|
top = center;
|
||||||
}
|
}
|
||||||
|
@ -1190,9 +1230,7 @@ lookup_block_symbol (register const struct block *block, const char *name,
|
||||||
{
|
{
|
||||||
/* Reset the linear search flag so if the binary search fails, we
|
/* Reset the linear search flag so if the binary search fails, we
|
||||||
won't do the linear search once unless we find some reason to
|
won't do the linear search once unless we find some reason to
|
||||||
do so, such as finding a C++ symbol during the binary search.
|
do so */
|
||||||
Note that for C++ modules, ALL the symbols in a block should
|
|
||||||
end up marked as C++ symbols. */
|
|
||||||
|
|
||||||
do_linear_search = 0;
|
do_linear_search = 0;
|
||||||
top = BLOCK_NSYMS (block);
|
top = BLOCK_NSYMS (block);
|
||||||
|
@ -1210,22 +1248,19 @@ lookup_block_symbol (register const struct block *block, const char *name,
|
||||||
}
|
}
|
||||||
inc = (inc >> 1) + bot;
|
inc = (inc >> 1) + bot;
|
||||||
sym = BLOCK_SYM (block, inc);
|
sym = BLOCK_SYM (block, inc);
|
||||||
if (!do_linear_search
|
if (!do_linear_search && (SYMBOL_LANGUAGE (sym) == language_java))
|
||||||
&& (SYMBOL_LANGUAGE (sym) == language_cplus
|
|
||||||
|| SYMBOL_LANGUAGE (sym) == language_java
|
|
||||||
))
|
|
||||||
{
|
{
|
||||||
do_linear_search = 1;
|
do_linear_search = 1;
|
||||||
}
|
}
|
||||||
if (SYMBOL_NAME (sym)[0] < name[0])
|
if (SYMBOL_SOURCE_NAME (sym)[0] < name[0])
|
||||||
{
|
{
|
||||||
bot = inc;
|
bot = inc;
|
||||||
}
|
}
|
||||||
else if (SYMBOL_NAME (sym)[0] > name[0])
|
else if (SYMBOL_SOURCE_NAME (sym)[0] > name[0])
|
||||||
{
|
{
|
||||||
top = inc;
|
top = inc;
|
||||||
}
|
}
|
||||||
else if (STRCMP (SYMBOL_NAME (sym), name) < 0)
|
else if (STRCMP (SYMBOL_SOURCE_NAME (sym), name) < 0)
|
||||||
{
|
{
|
||||||
bot = inc;
|
bot = inc;
|
||||||
}
|
}
|
||||||
|
@ -1247,19 +1282,8 @@ lookup_block_symbol (register const struct block *block, const char *name,
|
||||||
while (bot < top)
|
while (bot < top)
|
||||||
{
|
{
|
||||||
sym = BLOCK_SYM (block, bot);
|
sym = BLOCK_SYM (block, bot);
|
||||||
inc = SYMBOL_NAME (sym)[0] - name[0];
|
if (SYMBOL_MATCHES_NAME (sym, name))
|
||||||
if (inc == 0)
|
return sym;
|
||||||
{
|
|
||||||
inc = STRCMP (SYMBOL_NAME (sym), name);
|
|
||||||
}
|
|
||||||
if (inc == 0 && SYMBOL_NAMESPACE (sym) == namespace)
|
|
||||||
{
|
|
||||||
return (sym);
|
|
||||||
}
|
|
||||||
if (inc > 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
bot++;
|
bot++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue