* New R5900 COP2 test case.
[deliverable/binutils-gdb.git] / gdb / symtab.c
index c88d1b05627994d813c6671986da66e06eb84f12..422a67e79550bda1acc40e32e26e0f71ef9f905e 100644 (file)
@@ -87,12 +87,18 @@ static struct partial_symbol *
 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 */
@@ -359,10 +365,6 @@ gdb_mangle_name (type, i, j)
 
 \f
 
-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 *
@@ -532,7 +534,7 @@ fixup_symbol_section (sym, objfile)
   return sym;
 }
 
-struct partial_symbol *
+static struct partial_symbol *
 fixup_psymbol_section (psym, objfile)
      struct partial_symbol *psym;
      struct objfile *objfile;
@@ -1025,7 +1027,7 @@ lookup_block_symbol (block, name, namespace)
                 ?!? Is checking the current pc correct?  Is this routine
                 ever called to look up a symbol from another context?  */
               if (SYMBOL_ALIASES (sym))
-                sym = ref_search_val (sym, read_pc ());
+                sym = find_active_alias (sym, read_pc ());
 
              sym_found = sym;
              if (SYMBOL_CLASS (sym) != LOC_ARG &&
@@ -1044,6 +1046,39 @@ lookup_block_symbol (block, name, namespace)
   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.  */
@@ -1302,6 +1337,9 @@ find_pc_sect_line (pc, section, notcurrent)
   s = find_pc_sect_symtab (pc, section);
   if (!s)
     {
+      /* if no symbol information, return previous pc */
+      if (notcurrent)
+       pc++;
       val.pc = pc;
       return val;
     }
@@ -2066,7 +2104,6 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
        xmalloc (sizeof (struct symtab_and_line));
       values.nelts = 1;
       values.sals[0] = find_pc_line (pc, 0);
-      values.sals[0].pc = pc;
       return values;
     }
 
@@ -3512,7 +3549,7 @@ are listed.");
   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... */
This page took 0.033414 seconds and 4 git commands to generate.