/* Symbol table lookup for the GNU debugger, GDB.
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007
+ 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008
Free Software Foundation, Inc.
This file is part of GDB.
if (objfile->demangled_names_hash == NULL)
create_demangled_names_hash (objfile);
+ if (gsymbol->language == language_ada)
+ {
+ /* In Ada, we do the symbol lookups using the mangled name, so
+ we can save some space by not storing the demangled name.
+
+ As a side note, we have also observed some overlap between
+ the C++ mangling and Ada mangling, similarly to what has
+ been observed with Java. Because we don't store the demangled
+ name with the symbol, we don't need to use the same trick
+ as Java. */
+ gsymbol->name = obstack_alloc (&objfile->objfile_obstack, len + 1);
+ memcpy (gsymbol->name, linkage_name, len);
+ gsymbol->name[len] = '\0';
+ gsymbol->language_specific.cplus_specific.demangled_name = NULL;
+
+ return;
+ }
+
/* The stabs reader generally provides names that are not
NUL-terminated; most of the other readers don't do this, so we
can just use the given copy, unless we're in the Java case. */
}
}
+ if (objfile->separate_debug_objfile)
+ return lookup_global_symbol_from_objfile (objfile->separate_debug_objfile,
+ name, linkage_name, domain,
+ symtab);
+
return NULL;
}
* So I commented out the warning. RT */
/* warning ("In stub for %s; unable to find real function/line info", SYMBOL_LINKAGE_NAME (msymbol)) */ ;
/* fall through */
- else if (SYMBOL_VALUE (mfunsym) == SYMBOL_VALUE (msymbol))
+ else if (SYMBOL_VALUE_ADDRESS (mfunsym) == SYMBOL_VALUE_ADDRESS (msymbol))
/* Avoid infinite recursion */
/* See above comment about why warning is commented out */
/* warning ("In stub for %s; unable to find real function/line info", SYMBOL_LINKAGE_NAME (msymbol)) */ ;
/* fall through */
else
- return find_pc_line (SYMBOL_VALUE (mfunsym), 0);
+ return find_pc_line (SYMBOL_VALUE_ADDRESS (mfunsym), 0);
}
struct objfile *objfile;
struct symtab *s;
+ struct partial_symtab *p;
if (best_index >= 0)
best = best_linetable->item[best_index].line;
else
best = 0;
+ ALL_PSYMTABS (objfile, p)
+ {
+ if (strcmp (symtab->filename, p->filename) != 0)
+ continue;
+ PSYMTAB_TO_SYMTAB (p);
+ }
+
ALL_SYMTABS (objfile, s)
{
struct linetable *l;
int best_index = -1;
int best = 0;
+ *exact_match = 0;
+
if (lineno <= 0)
return -1;
if (l == 0)
}
/* If we got here, we didn't get an exact match. */
-
- *exact_match = 0;
return best_index;
}
}
else
{
- break_command (SYMBOL_LINKAGE_NAME (p->msymbol), from_tty);
+ char *string = alloca (strlen (SYMBOL_LINKAGE_NAME (p->msymbol))
+ + 3);
+ strcpy (string, "'");
+ strcat (string, SYMBOL_LINKAGE_NAME (p->msymbol));
+ strcat (string, "'");
+
+ break_command (string, from_tty);
printf_filtered ("<function, no debug info> %s;\n",
SYMBOL_PRINT_NAME (p->msymbol));
}
return p;
}
-
-/* Return a NULL terminated array of all symbols (regardless of class)
- which begin by matching TEXT. If the answer is no symbols, then
- the return value is an array which contains only a NULL pointer.
-
- Problem: All of the symbols have to be copied because readline frees them.
- I'm not going to worry about this; hopefully there won't be that many. */
-
char **
-make_symbol_completion_list (char *text, char *word)
+default_make_symbol_completion_list (char *text, char *word)
{
+ /* Problem: All of the symbols have to be copied because readline
+ frees them. I'm not going to worry about this; hopefully there
+ won't be that many. */
+
struct symbol *sym;
struct symtab *s;
struct partial_symtab *ps;
/* Length of sym_text. */
int sym_text_len;
- /* Now look for the symbol we are supposed to complete on.
- FIXME: This should be language-specific. */
+ /* Now look for the symbol we are supposed to complete on. */
{
char *p;
char quote_found;
return (return_val);
}
+/* Return a NULL terminated array of all symbols (regardless of class)
+ which begin by matching TEXT. If the answer is no symbols, then
+ the return value is an array which contains only a NULL pointer. */
+
+char **
+make_symbol_completion_list (char *text, char *word)
+{
+ return current_language->la_make_symbol_completion_list (text, word);
+}
+
/* Like make_symbol_completion_list, but returns a list of symbols
defined in a source file FILE. */