#include "expression.h"
#include "language.h"
#include "demangle.h"
+#include "inferior.h"
#include "obstack.h"
lookup_partial_symbol PARAMS ((struct partial_symtab *, const char *,
int, namespace_enum));
+static struct partial_symbol *
+fixup_psymbol_section PARAMS ((struct partial_symbol *, struct objfile *));
+
static struct symtab *
lookup_symtab_1 PARAMS ((char *));
static void
cplusplus_hint PARAMS ((char *));
+static struct symbol *
+find_active_alias PARAMS ((struct symbol *sym, CORE_ADDR addr));
+
/* */
/* The single non-language-specific builtin type */
\f
-struct symbol * fixup_symbol_section PARAMS ((struct symbol *,
- struct objfile *));
-struct partial_symbol * fixup_psymbol_section PARAMS ((struct partial_symbol *,
- struct objfile *));
-
-
/* Find which partial symtab on contains PC and SECTION. Return 0 if none. */
struct partial_symtab *
struct symbol *sym;
struct objfile *objfile;
{
- struct minimal_symbol *msym;
-
if (!sym)
return NULL;
return sym;
}
-struct partial_symbol *
+static struct partial_symbol *
fixup_psymbol_section (psym, objfile)
struct partial_symbol *psym;
struct objfile *objfile;
{
- struct minimal_symbol *msym;
-
if (!psym)
return NULL;
if (SYMBOL_NAMESPACE (sym) == namespace &&
SYMBOL_MATCHES_NAME (sym, name))
{
+ /* If SYM has aliases, then use any alias that is active
+ at the current PC. If no alias is active at the current
+ PC, then use the main symbol.
+
+ ?!? Is checking the current pc correct? Is this routine
+ ever called to look up a symbol from another context? */
+ if (SYMBOL_ALIASES (sym))
+ sym = find_active_alias (sym, read_pc ());
+
sym_found = sym;
if (SYMBOL_CLASS (sym) != LOC_ARG &&
SYMBOL_CLASS (sym) != LOC_LOCAL_ARG &&
return (sym_found); /* Will be NULL if not found. */
}
+/* Given a main symbol SYM and ADDR, search through the alias
+ list to determine if an alias is active at ADDR and return
+ the active alias.
+
+ If no alias is active, then return SYM. */
+
+static struct symbol *
+find_active_alias (sym, addr)
+ struct symbol *sym;
+ CORE_ADDR addr;
+{
+ struct range_list *r;
+ struct alias_list *aliases;
+
+ /* If we have aliases, check them first. */
+ aliases = SYMBOL_ALIASES (sym);
+
+ while (aliases)
+ {
+ if (!SYMBOL_RANGES (aliases->sym))
+ return aliases->sym;
+ for (r = SYMBOL_RANGES (aliases->sym); r; r = r->next)
+ {
+ if (r->start <= addr && r->end > addr)
+ return aliases->sym;
+ }
+ aliases = aliases->next;
+ }
+
+ /* Nothing found, return the main symbol. */
+ return sym;
+}
+
\f
/* Return the symbol for the function which contains a specified
lexical block, described by a struct block BL. */
register struct symtab *best_s = NULL;
register struct partial_symtab *ps;
register struct objfile *objfile;
- int distance = 0;
+ CORE_ADDR distance = 0;
/* Search all symtabs for the one whose file contains our address, and which
is the smallest of all the ones containing the address. This is designed
s = find_pc_sect_symtab (pc, section);
if (!s)
{
+ /* if no symbol information, return previous pc */
+ if (notcurrent)
+ pc++;
val.pc = pc;
return val;
}
xmalloc (sizeof (struct symtab_and_line));
values.nelts = 1;
values.sals[0] = find_pc_line (pc, 0);
- values.sals[0].pc = pc;
return values;
}
}
if (p[0] == ':' || p[0] == ' ' || p[0] == '\t')
break;
+ if (p[0] == '.' && strchr (p, ':') == NULL) /* Java qualified method. */
+ {
+ /* Find the *last* '.', since the others are package qualifiers. */
+ for (p1 = p; *p1; p1++)
+ {
+ if (*p1 == '.')
+ p = p1;
+ }
+ break;
+ }
}
while (p[0] == ' ' || p[0] == '\t') p++;
- if ((p[0] == ':') && !has_parens)
+ if ((p[0] == ':' || p[0] == '.') && !has_parens)
{
- /* C++ */
+ /* C++ or Java */
if (is_quoted) *argptr = *argptr+1;
- if (p[1] ==':')
+ if (p[0] == '.' || p[1] ==':')
{
/* Extract the class name. */
p1 = p;
copy[p - *argptr] = 0;
/* Discard the class name from the arg. */
- p = p1 + 2;
+ p = p1 + (p1[0] == ':' ? 2 : 1);
while (*p == ' ' || *p == '\t') p++;
*argptr = p;
add_info ("sources", sources_info,
"Source files in the program.");
- add_com ("rbreak", no_class, rbreak_command,
+ add_com ("rbreak", class_breakpoint, rbreak_command,
"Set a breakpoint for all functions matching REGEXP.");
/* Initialize the one built-in type that isn't language dependent... */