X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fsymtab.c;h=515612e5ba66f5ec797761c6e2cc95010d978046;hb=b6ba6518e9254bc25f88088228e93ac966ebccd1;hp=be021dd33910d6f3c8c55ece931924803e84ffd0;hpb=e85428fca34d86c6b432884ea40b565508fa8773;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/symtab.c b/gdb/symtab.c index be021dd339..515612e5ba 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1,5 +1,6 @@ /* Symbol table lookup for the GNU debugger, GDB. - Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998 + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, + 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GDB. @@ -35,6 +36,7 @@ #include "language.h" #include "demangle.h" #include "inferior.h" +#include "linespec.h" #include "obstack.h" @@ -594,7 +596,7 @@ lookup_symbol (const char *name, const struct block *block, returnval = lookup_symbol_aux (modified_name, block, namespace, is_a_field_of_this, symtab); if (needtofreename) - free (modified_name2); + xfree (modified_name2); return returnval; } @@ -770,8 +772,8 @@ lookup_symbol_aux (const char *name, const struct block *block, { /* This is a mangled variable, look it up by its mangled name. */ - return lookup_symbol (SYMBOL_NAME (msymbol), block, - namespace, is_a_field_of_this, symtab); + return lookup_symbol_aux (SYMBOL_NAME (msymbol), block, + namespace, is_a_field_of_this, symtab); } /* There are no debug symbols for this file, or we are looking for an unmangled variable. @@ -948,8 +950,8 @@ lookup_symbol_aux (const char *name, const struct block *block, && MSYMBOL_TYPE (msymbol) != mst_file_text && !STREQ (name, SYMBOL_NAME (msymbol))) { - return lookup_symbol (SYMBOL_NAME (msymbol), block, - namespace, is_a_field_of_this, symtab); + return lookup_symbol_aux (SYMBOL_NAME (msymbol), block, + namespace, is_a_field_of_this, symtab); } } } @@ -997,13 +999,13 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global, { center = bottom + (top - bottom) / 2; if (!(center < top)) - abort (); + internal_error (__FILE__, __LINE__, "failed internal consistency check"); if (!do_linear_search && (SYMBOL_LANGUAGE (*center) == language_java)) { do_linear_search = 1; } - if (STRCMP (SYMBOL_SOURCE_NAME (*center), name) >= 0) + if (strcmp (SYMBOL_SOURCE_NAME (*center), name) >= 0) { top = center; } @@ -1013,7 +1015,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global, } } if (!(top == bottom)) - abort (); + internal_error (__FILE__, __LINE__, "failed internal consistency check"); /* djb - 2000-06-03 - Use SYMBOL_MATCHES_NAME, not a strcmp, so we don't have to force a linear search on C++. Probably holds true @@ -1236,7 +1238,7 @@ lookup_block_symbol (register const struct block *block, const char *name, { top = inc; } - else if (STRCMP (SYMBOL_SOURCE_NAME (sym), name) < 0) + else if (strcmp (SYMBOL_SOURCE_NAME (sym), name) < 0) { bot = inc; } @@ -1258,8 +1260,11 @@ lookup_block_symbol (register const struct block *block, const char *name, while (bot < top) { sym = BLOCK_SYM (block, bot); - if (SYMBOL_MATCHES_NAME (sym, name)) - return sym; + if (SYMBOL_NAMESPACE (sym) == namespace && + SYMBOL_MATCHES_NAME (sym, name)) + { + return sym; + } bot++; } } @@ -2277,7 +2282,7 @@ free_search_symbols (struct symbol_search *symbols) for (p = symbols; p != NULL; p = next) { next = p->next; - free (p); + xfree (p); } } @@ -2344,7 +2349,7 @@ search_symbols (char *regexp, namespace_enum kind, int nfiles, char *files[], struct symbol_search *tail; struct cleanup *old_chain = NULL; - if (kind < LABEL_NAMESPACE) + if (kind < VARIABLES_NAMESPACE) error ("must search on specific namespace"); ourtype = types[(int) (kind - VARIABLES_NAMESPACE)]; @@ -2636,7 +2641,7 @@ print_symbol_info (namespace_enum kind, struct symtab *s, struct symbol *sym, else { fputs_filtered (demangled_name, stream); - free (demangled_name); + xfree (demangled_name); } #endif } @@ -2875,7 +2880,7 @@ completion_list_add_name (char *symname, char *sym_text, int sym_text_len, { if (STREQ (new, return_val[i])) { - free (new); + xfree (new); return; } } @@ -3182,7 +3187,7 @@ overload_list_add_symbol (struct symbol *sym, char *oload_name) /* skip symbols that cannot match */ if (strcmp (sym_name, oload_name) != 0) { - free (sym_name); + xfree (sym_name); return; } @@ -3205,7 +3210,7 @@ overload_list_add_symbol (struct symbol *sym, char *oload_name) sym_return_val[sym_return_val_index++] = sym; sym_return_val[sym_return_val_index] = NULL; - free (sym_name); + xfree (sym_name); } /* Return a null-terminated list of pointers to function symbols that @@ -3326,7 +3331,7 @@ make_symbol_overload_list (struct symbol *fsym) } } - free (oload_name); + xfree (oload_name); return (sym_return_val); }