2000-10-12 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
[deliverable/binutils-gdb.git] / gdb / symtab.c
index 4e1589603c061dc2a6ab383f2c55f892137a0936..3a97e10281b8d72cbf0339ed9735a9e7071afa24 100644 (file)
@@ -77,16 +77,19 @@ char *operator_chars (char *, char **);
 
 static int find_line_common (struct linetable *, int, int *);
 
-static struct partial_symbol *lookup_partial_symbol PARAMS
-  ((struct partial_symtab *, const char *,
-    int, namespace_enum));
-
-static struct partial_symbol *fixup_psymbol_section (struct
-                                                    partial_symbol *,
-                                                    struct objfile *);
+static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
+                                                    const char *, int,
+                                                    namespace_enum);
 
 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 struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr);
@@ -128,8 +131,7 @@ char no_symtab_msg[] = "No symbol table is loaded.  Use the \"file\" command.";
    symbols.  Remove when loose ends are cleaned up.   FIXME -fnf */
 
 static void
-cplusplus_hint (name)
-     char *name;
+cplusplus_hint (char *name)
 {
   while (*name == '\'')
     name++;
@@ -142,8 +144,7 @@ cplusplus_hint (name)
    in the symtab filename will also work.  */
 
 static struct symtab *
-lookup_symtab_1 (name)
-     char *name;
+lookup_symtab_1 (char *name)
 {
   register struct symtab *s;
   register struct partial_symtab *ps;
@@ -206,8 +207,7 @@ got_symtab:
    of variations if the first lookup doesn't work.  */
 
 struct symtab *
-lookup_symtab (name)
-     char *name;
+lookup_symtab (char *name)
 {
   register struct symtab *s;
 #if 0
@@ -244,8 +244,7 @@ lookup_symtab (name)
    in the psymtab filename will also work.  */
 
 struct partial_symtab *
-lookup_partial_symtab (name)
-     char *name;
+lookup_partial_symtab (char *name)
 {
   register struct partial_symtab *pst;
   register struct objfile *objfile;
@@ -282,9 +281,7 @@ lookup_partial_symtab (name)
    specified by SIGNATURE_ID.  Note that this function is g++ specific. */
 
 char *
-gdb_mangle_name (type, method_id, signature_id)
-     struct type *type;
-     int method_id, signature_id;
+gdb_mangle_name (struct type *type, int method_id, int signature_id)
 {
   int mangled_name_len;
   char *mangled_name;
@@ -383,9 +380,7 @@ gdb_mangle_name (type, method_id, signature_id)
 /* Find which partial symtab on contains PC and SECTION.  Return 0 if none.  */
 
 struct partial_symtab *
-find_pc_sect_psymtab (pc, section)
-     CORE_ADDR pc;
-     asection *section;
+find_pc_sect_psymtab (CORE_ADDR pc, asection *section)
 {
   register struct partial_symtab *pst;
   register struct objfile *objfile;
@@ -432,8 +427,7 @@ find_pc_sect_psymtab (pc, section)
    Backward compatibility, no section */
 
 struct partial_symtab *
-find_pc_psymtab (pc)
-     CORE_ADDR pc;
+find_pc_psymtab (CORE_ADDR pc)
 {
   return find_pc_sect_psymtab (pc, find_pc_mapped_section (pc));
 }
@@ -442,10 +436,8 @@ find_pc_psymtab (pc)
    Return 0 if none.  Check all psymtabs if PSYMTAB is 0.  */
 
 struct partial_symbol *
-find_pc_sect_psymbol (psymtab, pc, section)
-     struct partial_symtab *psymtab;
-     CORE_ADDR pc;
-     asection *section;
+find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
+                     asection *section)
 {
   struct partial_symbol *best = NULL, *p, **pp;
   CORE_ADDR best_pc;
@@ -516,9 +508,7 @@ find_pc_sect_psymbol (psymtab, pc, section)
    Check all psymtabs if PSYMTAB is 0.  Backwards compatibility, no section. */
 
 struct partial_symbol *
-find_pc_psymbol (psymtab, pc)
-     struct partial_symtab *psymtab;
-     CORE_ADDR pc;
+find_pc_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc)
 {
   return find_pc_sect_psymbol (psymtab, pc, find_pc_mapped_section (pc));
 }
@@ -527,21 +517,20 @@ find_pc_psymbol (psymtab, pc)
    out of the minimal symbols and stash that in the debug symbol.  */
 
 static void
-fixup_section (ginfo, objfile)
-     struct general_symbol_info *ginfo;
-     struct objfile *objfile;
+fixup_section (struct general_symbol_info *ginfo, struct objfile *objfile)
 {
   struct minimal_symbol *msym;
   msym = lookup_minimal_symbol (ginfo->name, NULL, objfile);
 
   if (msym)
-    ginfo->bfd_section = SYMBOL_BFD_SECTION (msym);
+    {
+      ginfo->bfd_section = SYMBOL_BFD_SECTION (msym);
+      ginfo->section = SYMBOL_SECTION (msym);
+    }
 }
 
 struct symbol *
-fixup_symbol_section (sym, objfile)
-     struct symbol *sym;
-     struct objfile *objfile;
+fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
 {
   if (!sym)
     return NULL;
@@ -554,10 +543,8 @@ fixup_symbol_section (sym, objfile)
   return sym;
 }
 
-static struct partial_symbol *
-fixup_psymbol_section (psym, objfile)
-     struct partial_symbol *psym;
-     struct objfile *objfile;
+struct partial_symbol *
+fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
 {
   if (!psym)
     return NULL;
@@ -592,21 +579,64 @@ fixup_psymbol_section (psym, objfile)
    can probably assume it will never hit the C++ code).  */
 
 struct symbol *
-lookup_symbol (name, block, namespace, is_a_field_of_this, symtab)
-     const char *name;
-     register const struct block *block;
-     const namespace_enum namespace;
-     int *is_a_field_of_this;
-     struct symtab **symtab;
+lookup_symbol (const char *name, const struct block *block,
+              const namespace_enum namespace, int *is_a_field_of_this,
+              struct symtab **symtab)
+{
+  char *modified_name = NULL;
+  char *modified_name2 = NULL;
+  int needtofreename = 0;
+  struct symbol *returnval;
+
+  if (case_sensitivity == case_sensitive_off)
+    {
+      char *copy;
+      int len, i;
+
+      len = strlen (name);
+      copy = (char *) alloca (len + 1);
+      for (i= 0; i < len; i++)
+        copy[i] = tolower (name[i]);
+      copy[len] = 0;
+      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;
-  struct blockvector *bv;
+  register struct blockvector *bv;
   register struct objfile *objfile = NULL;
   register struct block *b;
   register struct minimal_symbol *msymbol;
 
+
   /* Search specified block and its superiors.  */
 
   while (block != 0)
@@ -954,31 +984,28 @@ lookup_symbol (name, block, namespace, is_a_field_of_this, symtab)
     *symtab = NULL;
   return 0;
 }
-
+                                                               
 /* Look, in partial_symtab PST, for symbol NAME.  Check the global
    symbols if GLOBAL, the static symbols if not */
 
 static struct partial_symbol *
-lookup_partial_symbol (pst, name, global, namespace)
-     struct partial_symtab *pst;
-     const char *name;
-     int global;
-     namespace_enum namespace;
+lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
+                      namespace_enum namespace)
 {
+  struct partial_symbol *temp;
   struct partial_symbol **start, **psym;
   struct partial_symbol **top, **bottom, **center;
   int length = (global ? pst->n_global_syms : pst->n_static_syms);
   int do_linear_search = 1;
-
+  
   if (length == 0)
     {
       return (NULL);
     }
-
   start = (global ?
           pst->objfile->global_psymbols.list + pst->globals_offset :
           pst->objfile->static_psymbols.list + pst->statics_offset);
-
+  
   if (global)                  /* This means we can use a binary search. */
     {
       do_linear_search = 0;
@@ -996,13 +1023,11 @@ lookup_partial_symbol (pst, name, global, namespace)
          if (!(center < top))
            abort ();
          if (!do_linear_search
-             && (SYMBOL_LANGUAGE (*center) == language_cplus
-                 || SYMBOL_LANGUAGE (*center) == language_java
-             ))
+             && (SYMBOL_LANGUAGE (*center) == language_java))
            {
              do_linear_search = 1;
            }
-         if (STRCMP (SYMBOL_NAME (*center), name) >= 0)
+         if (STRCMP (SYMBOL_SOURCE_NAME (*center), name) >= 0)
            {
              top = center;
            }
@@ -1013,11 +1038,15 @@ lookup_partial_symbol (pst, name, global, namespace)
        }
       if (!(top == bottom))
        abort ();
-      while (STREQ (SYMBOL_NAME (*top), name))
+
+      /* 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
+        for JAVA as well, no way to check.*/
+      while (SYMBOL_MATCHES_NAME (*top,name))
        {
          if (SYMBOL_NAMESPACE (*top) == namespace)
            {
-             return (*top);
+                 return (*top);
            }
          top++;
        }
@@ -1027,7 +1056,7 @@ lookup_partial_symbol (pst, name, global, namespace)
      we should also do a linear search. */
 
   if (do_linear_search)
-    {
+    {                  
       for (psym = start; psym < start + length; psym++)
        {
          if (namespace == SYMBOL_NAMESPACE (*psym))
@@ -1052,8 +1081,7 @@ lookup_partial_symbol (pst, name, global, namespace)
 
 
 struct type *
-lookup_transparent_type (name)
-     const char *name;
+lookup_transparent_type (const char *name)
 {
   register struct symbol *sym;
   register struct symtab *s = NULL;
@@ -1161,7 +1189,7 @@ lookup_transparent_type (name)
    executables that have no main() ? */
 
 struct partial_symtab *
-find_main_psymtab ()
+find_main_psymtab (void)
 {
   register struct partial_symtab *pst;
   register struct objfile *objfile;
@@ -1188,10 +1216,8 @@ find_main_psymtab ()
    tested for a match. */
 
 struct symbol *
-lookup_block_symbol (block, name, namespace)
-     register const struct block *block;
-     const char *name;
-     const namespace_enum namespace;
+lookup_block_symbol (register const struct block *block, const char *name,
+                    const namespace_enum namespace)
 {
   register int bot, top, inc;
   register struct symbol *sym;
@@ -1204,9 +1230,7 @@ lookup_block_symbol (block, name, namespace)
     {
       /* 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
-         do so, such as finding a C++ symbol during the binary search.
-         Note that for C++ modules, ALL the symbols in a block should
-         end up marked as C++ symbols. */
+         do so */
 
       do_linear_search = 0;
       top = BLOCK_NSYMS (block);
@@ -1224,22 +1248,19 @@ lookup_block_symbol (block, name, namespace)
            }
          inc = (inc >> 1) + bot;
          sym = BLOCK_SYM (block, inc);
-         if (!do_linear_search
-             && (SYMBOL_LANGUAGE (sym) == language_cplus
-                 || SYMBOL_LANGUAGE (sym) == language_java
-             ))
+         if (!do_linear_search && (SYMBOL_LANGUAGE (sym) == language_java))
            {
              do_linear_search = 1;
            }
-         if (SYMBOL_NAME (sym)[0] < name[0])
+         if (SYMBOL_SOURCE_NAME (sym)[0] < name[0])
            {
              bot = inc;
            }
-         else if (SYMBOL_NAME (sym)[0] > name[0])
+         else if (SYMBOL_SOURCE_NAME (sym)[0] > name[0])
            {
              top = inc;
            }
-         else if (STRCMP (SYMBOL_NAME (sym), name) < 0)
+         else if (STRCMP (SYMBOL_SOURCE_NAME (sym), name) < 0)
            {
              bot = inc;
            }
@@ -1261,19 +1282,8 @@ lookup_block_symbol (block, name, namespace)
       while (bot < top)
        {
          sym = BLOCK_SYM (block, bot);
-         inc = SYMBOL_NAME (sym)[0] - name[0];
-         if (inc == 0)
-           {
-             inc = STRCMP (SYMBOL_NAME (sym), name);
-           }
-         if (inc == 0 && SYMBOL_NAMESPACE (sym) == namespace)
-           {
-             return (sym);
-           }
-         if (inc > 0)
-           {
-             break;
-           }
+         if (SYMBOL_MATCHES_NAME (sym, name))
+           return sym;
          bot++;
        }
     }
@@ -1348,9 +1358,7 @@ lookup_block_symbol (block, name, namespace)
    If no alias is active, then return SYM.  */
 
 static struct symbol *
-find_active_alias (sym, addr)
-     struct symbol *sym;
-     CORE_ADDR addr;
+find_active_alias (struct symbol *sym, CORE_ADDR addr)
 {
   struct range_list *r;
   struct alias_list *aliases;
@@ -1379,8 +1387,7 @@ find_active_alias (sym, addr)
    lexical block, described by a struct block BL.  */
 
 struct symbol *
-block_function (bl)
-     struct block *bl;
+block_function (struct block *bl)
 {
   while (BLOCK_FUNCTION (bl) == 0 && BLOCK_SUPERBLOCK (bl) != 0)
     bl = BLOCK_SUPERBLOCK (bl);
@@ -1392,9 +1399,7 @@ block_function (bl)
    psymtabs and read in another symtab if necessary. */
 
 struct symtab *
-find_pc_sect_symtab (pc, section)
-     CORE_ADDR pc;
-     asection *section;
+find_pc_sect_symtab (CORE_ADDR pc, asection *section)
 {
   register struct block *b;
   struct blockvector *bv;
@@ -1470,10 +1475,9 @@ find_pc_sect_symtab (pc, section)
        /* Might want to error() here (in case symtab is corrupt and
           will cause a core dump), but maybe we can successfully
           continue, so let's not.  */
-       /* FIXME-32x64: assumes pc fits in a long */
        warning ("\
-(Internal error: pc 0x%lx in read in psymtab, but not in symtab.)\n",
-                (unsigned long) pc);
+(Internal error: pc 0x%s in read in psymtab, but not in symtab.)\n",
+                paddr_nz (pc));
       s = PSYMTAB_TO_SYMTAB (ps);
     }
   return (s);
@@ -1483,8 +1487,7 @@ find_pc_sect_symtab (pc, section)
    read in another symtab if necessary.  Backward compatibility, no section */
 
 struct symtab *
-find_pc_symtab (pc)
-     CORE_ADDR pc;
+find_pc_symtab (CORE_ADDR pc)
 {
   return find_pc_sect_symtab (pc, find_pc_mapped_section (pc));
 }
@@ -1500,10 +1503,7 @@ find_pc_symtab (pc)
    line *0x2345" cause psymtabs to be converted to symtabs).  */
 
 struct symbol *
-find_addr_symbol (addr, symtabp, symaddrp)
-     CORE_ADDR addr;
-     struct symtab **symtabp;
-     CORE_ADDR *symaddrp;
+find_addr_symbol (CORE_ADDR addr, struct symtab **symtabp, CORE_ADDR *symaddrp)
 {
   struct symtab *symtab, *best_symtab;
   struct objfile *objfile;
@@ -1601,10 +1601,7 @@ done:
 /* If it's worth the effort, we could be using a binary search.  */
 
 struct symtab_and_line
-find_pc_sect_line (pc, section, notcurrent)
-     CORE_ADDR pc;
-     struct sec *section;
-     int notcurrent;
+find_pc_sect_line (CORE_ADDR pc, struct sec *section, int notcurrent)
 {
   struct symtab *s;
   register struct linetable *l;
@@ -1827,9 +1824,7 @@ find_pc_sect_line (pc, section, notcurrent)
 /* Backward compatibility (no section) */
 
 struct symtab_and_line
-find_pc_line (pc, notcurrent)
-     CORE_ADDR pc;
-     int notcurrent;
+find_pc_line (CORE_ADDR pc, int notcurrent)
 {
   asection *section;
 
@@ -1853,11 +1848,7 @@ static struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
    If not found, return NULL.  */
 
 static struct symtab *
-find_line_symtab (symtab, line, index, exact_match)
-     struct symtab *symtab;
-     int line;
-     int *index;
-     int *exact_match;
+find_line_symtab (struct symtab *symtab, int line, int *index, int *exact_match)
 {
   int exact;
 
@@ -1939,10 +1930,7 @@ done:
    The source file is specified with a struct symtab.  */
 
 int
-find_line_pc (symtab, line, pc)
-     struct symtab *symtab;
-     int line;
-     CORE_ADDR *pc;
+find_line_pc (struct symtab *symtab, int line, CORE_ADDR *pc)
 {
   struct linetable *l;
   int ind;
@@ -1969,9 +1957,8 @@ find_line_pc (symtab, line, pc)
    Returns 0 if could not find the specified line.  */
 
 int
-find_line_pc_range (sal, startptr, endptr)
-     struct symtab_and_line sal;
-     CORE_ADDR *startptr, *endptr;
+find_line_pc_range (struct symtab_and_line sal, CORE_ADDR *startptr,
+                   CORE_ADDR *endptr)
 {
   CORE_ADDR startaddr;
   struct symtab_and_line found_sal;
@@ -2009,10 +1996,8 @@ find_line_pc_range (sal, startptr, endptr)
    Set *EXACT_MATCH nonzero if the value returned is an exact match.  */
 
 static int
-find_line_common (l, lineno, exact_match)
-     register struct linetable *l;
-     register int lineno;
-     int *exact_match;
+find_line_common (register struct linetable *l, register int lineno,
+                 int *exact_match)
 {
   register int i;
   register int len;
@@ -2055,9 +2040,7 @@ find_line_common (l, lineno, exact_match)
 }
 
 int
-find_pc_line_pc_range (pc, startptr, endptr)
-     CORE_ADDR pc;
-     CORE_ADDR *startptr, *endptr;
+find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
 {
   struct symtab_and_line sal;
   sal = find_pc_line (pc, 0);
@@ -2075,9 +2058,7 @@ static struct symtab_and_line
 find_function_start_sal (struct symbol *sym, int);
 
 static struct symtab_and_line
-find_function_start_sal (sym, funfirstline)
-     struct symbol *sym;
-     int funfirstline;
+find_function_start_sal (struct symbol *sym, int funfirstline)
 {
   CORE_ADDR pc;
   struct symtab_and_line sal;
@@ -2127,9 +2108,7 @@ find_function_start_sal (sym, funfirstline)
    beginning of the substring of the operator text.
    Otherwise, return "".  */
 char *
-operator_chars (p, end)
-     char *p;
-     char **end;
+operator_chars (char *p, char **end)
 {
   *end = "";
   if (strncmp (p, "operator", 8))
@@ -2215,8 +2194,7 @@ operator_chars (p, end)
 static int total_number_of_methods (struct type *type);
 
 static int
-total_number_of_methods (type)
-     struct type *type;
+total_number_of_methods (struct type *type)
 {
   int n;
   int count;
@@ -2240,10 +2218,7 @@ total_number_of_methods (type)
    Note that this function is g++ specific.  */
 
 static int
-find_methods (t, name, sym_arr)
-     struct type *t;
-     char *name;
-     struct symbol **sym_arr;
+find_methods (struct type *t, char *name, struct symbol **sym_arr)
 {
   int i1 = 0;
   int ibase;
@@ -2363,10 +2338,8 @@ find_methods (t, name, sym_arr)
    line spec is `filename:linenum'.  */
 
 static void
-build_canonical_line_spec (sal, symname, canonical)
-     struct symtab_and_line *sal;
-     char *symname;
-     char ***canonical;
+build_canonical_line_spec (struct symtab_and_line *sal, char *symname,
+                          char ***canonical)
 {
   char **canonical_arr;
   char *canonical_name;
@@ -2475,12 +2448,8 @@ find_toplevel_char (char *s, char c)
    can use as appropriate instead of make_symbol_completion_list.  */
 
 struct symtabs_and_lines
-decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
-     char **argptr;
-     int funfirstline;
-     struct symtab *default_symtab;
-     int default_line;
-     char ***canonical;
+decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+              int default_line, char ***canonical)
 {
   struct symtabs_and_lines values;
 #ifdef HPPA_COMPILER_BUG
@@ -2697,7 +2666,8 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
          /* First check for "global" namespace specification,
             of the form "::foo". If found, skip over the colons
             and jump to normal symbol processing */
-         if ((*argptr == p) || (p[-1] == ' ') || (p[-1] == '\t'))
+         if (p[0] == ':' 
+             && ((*argptr == p) || (p[-1] == ' ') || (p[-1] == '\t')))
            saved_arg2 += 2;
 
          /* We have what looks like a class or namespace
@@ -3285,9 +3255,7 @@ minimal_symbol_found:             /* We also jump here from the case for variables
 }
 
 struct symtabs_and_lines
-decode_line_spec (string, funfirstline)
-     char *string;
-     int funfirstline;
+decode_line_spec (char *string, int funfirstline)
 {
   struct symtabs_and_lines sals;
   if (string == 0)
@@ -3436,9 +3404,7 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
    NAME is the name to print and *FIRST is nonzero if this is the first
    name printed.  Set *FIRST to zero.  */
 static void
-output_source_filename (name, first)
-     char *name;
-     int *first;
+output_source_filename (char *name, int *first)
 {
   /* Table of files printed so far.  Since a single source file can
      result in several partial symbol tables, we need to avoid printing
@@ -3492,9 +3458,7 @@ output_source_filename (name, first)
 }
 
 static void
-sources_info (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+sources_info (char *ignore, int from_tty)
 {
   register struct symtab *s;
   register struct partial_symtab *ps;
@@ -3551,8 +3515,7 @@ file_matches (file, files, nfiles)
 
 /* Free any memory associated with a search. */
 void
-free_search_symbols (symbols)
-     struct symbol_search *symbols;
+free_search_symbols (struct symbol_search *symbols)
 {
   struct symbol_search *p;
   struct symbol_search *next;
@@ -3564,6 +3527,19 @@ free_search_symbols (symbols)
     }
 }
 
+static void
+do_free_search_symbols_cleanup (void *symbols)
+{
+  free_search_symbols (symbols);
+}
+
+struct cleanup *
+make_cleanup_free_search_symbols (struct symbol_search *symbols)
+{
+  return make_cleanup (do_free_search_symbols_cleanup, symbols);
+}
+
+
 /* Search the symbol table for matches to the regular expression REGEXP,
    returning the results in *MATCHES.
 
@@ -3622,10 +3598,10 @@ search_symbols (regexp, kind, nfiles, files, matches)
   if (kind < LABEL_NAMESPACE)
     error ("must search on specific namespace");
 
-  ourtype = types[(int) (kind - LABEL_NAMESPACE)];
-  ourtype2 = types2[(int) (kind - LABEL_NAMESPACE)];
-  ourtype3 = types3[(int) (kind - LABEL_NAMESPACE)];
-  ourtype4 = types4[(int) (kind - LABEL_NAMESPACE)];
+  ourtype = types[(int) (kind - VARIABLES_NAMESPACE)];
+  ourtype2 = types2[(int) (kind - VARIABLES_NAMESPACE)];
+  ourtype3 = types3[(int) (kind - VARIABLES_NAMESPACE)];
+  ourtype4 = types4[(int) (kind - VARIABLES_NAMESPACE)];
 
   sr = *matches = NULL;
   tail = NULL;
@@ -3796,8 +3772,7 @@ search_symbols (regexp, kind, nfiles, files, matches)
                  if (tail == NULL)
                    {
                      sr = psr;
-                     old_chain = make_cleanup ((make_cleanup_func)
-                                               free_search_symbols, sr);
+                     old_chain = make_cleanup_free_search_symbols (sr);
                    }
                  else
                    tail->next = psr;
@@ -3841,8 +3816,7 @@ search_symbols (regexp, kind, nfiles, files, matches)
                        if (tail == NULL)
                          {
                            sr = psr;
-                           old_chain = make_cleanup ((make_cleanup_func)
-                                                 free_search_symbols, &sr);
+                           old_chain = make_cleanup_free_search_symbols (sr);
                          }
                        else
                          tail->next = psr;
@@ -3864,12 +3838,8 @@ search_symbols (regexp, kind, nfiles, files, matches)
    regarding the match to gdb_stdout.
  */
 static void
-print_symbol_info (kind, s, sym, block, last)
-     namespace_enum kind;
-     struct symtab *s;
-     struct symbol *sym;
-     int block;
-     char *last;
+print_symbol_info (namespace_enum kind, struct symtab *s, struct symbol *sym,
+                  int block, char *last)
 {
   if (last == NULL || strcmp (last, s->filename) != 0)
     {
@@ -3884,7 +3854,7 @@ print_symbol_info (kind, s, sym, block, last)
   /* Typedef that is not a C++ class */
   if (kind == TYPES_NAMESPACE
       && SYMBOL_NAMESPACE (sym) != STRUCT_NAMESPACE)
-    c_typedef_print (SYMBOL_TYPE (sym), sym, gdb_stdout);
+    typedef_print (SYMBOL_TYPE (sym), sym, gdb_stdout);
   /* variable, func, or typedef-that-is-c++-class */
   else if (kind < TYPES_NAMESPACE ||
           (kind == TYPES_NAMESPACE &&
@@ -3927,8 +3897,7 @@ print_symbol_info (kind, s, sym, block, last)
    for non-debugging symbols to gdb_stdout.
  */
 static void
-print_msymbol_info (msymbol)
-     struct minimal_symbol *msymbol;
+print_msymbol_info (struct minimal_symbol *msymbol)
 {
   printf_filtered ("   %08lx  %s\n",
                   (unsigned long) SYMBOL_VALUE_ADDRESS (msymbol),
@@ -3941,10 +3910,7 @@ print_msymbol_info (msymbol)
    matches.
  */
 static void
-symtab_symbol_info (regexp, kind, from_tty)
-     char *regexp;
-     namespace_enum kind;
-     int from_tty;
+symtab_symbol_info (char *regexp, namespace_enum kind, int from_tty)
 {
   static char *classnames[]
   =
@@ -3957,12 +3923,12 @@ symtab_symbol_info (regexp, kind, from_tty)
 
   /* must make sure that if we're interrupted, symbols gets freed */
   search_symbols (regexp, kind, 0, (char **) NULL, &symbols);
-  old_chain = make_cleanup ((make_cleanup_func) free_search_symbols, symbols);
+  old_chain = make_cleanup_free_search_symbols (symbols);
 
   printf_filtered (regexp
                   ? "All %ss matching regular expression \"%s\":\n"
                   : "All defined %ss:\n",
-                  classnames[(int) (kind - LABEL_NAMESPACE - 1)], regexp);
+                  classnames[(int) (kind - VARIABLES_NAMESPACE)], regexp);
 
   for (p = symbols; p != NULL; p = p->next)
     {
@@ -3992,25 +3958,20 @@ symtab_symbol_info (regexp, kind, from_tty)
 }
 
 static void
-variables_info (regexp, from_tty)
-     char *regexp;
-     int from_tty;
+variables_info (char *regexp, int from_tty)
 {
   symtab_symbol_info (regexp, VARIABLES_NAMESPACE, from_tty);
 }
 
 static void
-functions_info (regexp, from_tty)
-     char *regexp;
-     int from_tty;
+functions_info (char *regexp, int from_tty)
 {
   symtab_symbol_info (regexp, FUNCTIONS_NAMESPACE, from_tty);
 }
 
+
 static void
-types_info (regexp, from_tty)
-     char *regexp;
-     int from_tty;
+types_info (char *regexp, int from_tty)
 {
   symtab_symbol_info (regexp, TYPES_NAMESPACE, from_tty);
 }
@@ -4018,8 +3979,7 @@ types_info (regexp, from_tty)
 #if 0
 /* Tiemann says: "info methods was never implemented."  */
 static void
-methods_info (regexp)
-     char *regexp;
+methods_info (char *regexp)
 {
   symtab_symbol_info (regexp, METHODS_NAMESPACE, 0, from_tty);
 }
@@ -4028,24 +3988,20 @@ methods_info (regexp)
 /* Breakpoint all functions matching regular expression. */
 #ifdef UI_OUT
 void
-rbreak_command_wrapper (regexp, from_tty)
-     char *regexp;
-     int from_tty;
+rbreak_command_wrapper (char *regexp, int from_tty)
 {
   rbreak_command (regexp, from_tty);
 }
 #endif
 static void
-rbreak_command (regexp, from_tty)
-     char *regexp;
-     int from_tty;
+rbreak_command (char *regexp, int from_tty)
 {
   struct symbol_search *ss;
   struct symbol_search *p;
   struct cleanup *old_chain;
 
   search_symbols (regexp, FUNCTIONS_NAMESPACE, 0, (char **) NULL, &ss);
-  old_chain = make_cleanup ((make_cleanup_func) free_search_symbols, ss);
+  old_chain = make_cleanup_free_search_symbols (ss);
 
   for (p = ss; p != NULL; p = p->next)
     {
@@ -4081,8 +4037,7 @@ rbreak_command (regexp, from_tty)
    or if a and b have the same pc range.
    Return zero otherwise. */
 int
-contained_in (a, b)
-     struct block *a, *b;
+contained_in (struct block *a, struct block *b)
 {
   if (!a || !b)
     return 0;
@@ -4115,12 +4070,8 @@ static char **return_val;
    characters.  If so, add it to the current completion list. */
 
 static void
-completion_list_add_name (symname, sym_text, sym_text_len, text, word)
-     char *symname;
-     char *sym_text;
-     int sym_text_len;
-     char *text;
-     char *word;
+completion_list_add_name (char *symname, char *sym_text, int sym_text_len,
+                         char *text, char *word)
 {
   int newsize;
   int i;
@@ -4199,9 +4150,7 @@ completion_list_add_name (symname, sym_text, sym_text_len, text, word)
    I'm not going to worry about this; hopefully there won't be that many.  */
 
 char **
-make_symbol_completion_list (text, word)
-     char *text;
-     char *word;
+make_symbol_completion_list (char *text, char *word)
 {
   register struct symbol *sym;
   register struct symtab *s;
@@ -4390,9 +4339,7 @@ make_symbol_completion_list (text, word)
  */
 
 int
-in_prologue (pc, func_start)
-     CORE_ADDR pc;
-     CORE_ADDR func_start;
+in_prologue (CORE_ADDR pc, CORE_ADDR func_start)
 {
   struct symtab_and_line sal;
   CORE_ADDR func_addr, func_end;
@@ -4470,9 +4417,7 @@ static struct symbol **sym_return_val;
    characters.  If so, add it to the current completion list. */
 
 static void
-overload_list_add_symbol (sym, oload_name)
-     struct symbol *sym;
-     char *oload_name;
+overload_list_add_symbol (struct symbol *sym, char *oload_name)
 {
   int newsize;
   int i;
@@ -4521,8 +4466,7 @@ overload_list_add_symbol (sym, oload_name)
 
 
 struct symbol **
-make_symbol_overload_list (fsym)
-     struct symbol *fsym;
+make_symbol_overload_list (struct symbol *fsym)
 {
   register struct symbol *sym;
   register struct symtab *s;
@@ -4642,7 +4586,7 @@ make_symbol_overload_list (fsym)
 \f
 
 void
-_initialize_symtab ()
+_initialize_symtab (void)
 {
   add_info ("variables", variables_info,
         "All global and static variable names, or those matching REGEXP.");
@@ -4653,6 +4597,7 @@ _initialize_symtab ()
   add_info ("functions", functions_info,
            "All function names, or those matching REGEXP.");
 
+  
   /* FIXME:  This command has at least the following problems:
      1.  It prints builtin types (in a very strange and confusing fashion).
      2.  It doesn't print right, e.g. with
This page took 0.034841 seconds and 4 git commands to generate.