* symtab.h (domain_enum): Split in two...
authorTom Tromey <tromey@redhat.com>
Mon, 4 Apr 2011 14:10:12 +0000 (14:10 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 4 Apr 2011 14:10:12 +0000 (14:10 +0000)
(enum search_domain): New.
(search_symbols): Update.
* symtab.c (print_symbol_info, symtab_symbol_info): Remove
redundant declarations.
(search_symbols): Change 'kind' argument to search_domain.
Update.
(print_symbol_info): Likewise.
(symtab_symbol_info): Likewise.
* symfile.h (struct quick_symbol_functions)
<pre_expand_symtabs_matching>: Change type of 'kind' argument.
<expand_symtabs_matching>: Likewise.
* psymtab.c (pre_expand_symtabs_matching_psymtabs): Update.
(expand_symtabs_matching_via_partial): Update.
* dwarf2read.c (dw2_pre_expand_symtabs_matching): Update.
(dw2_expand_symtabs_for_function): Update.
* block.h: Moved anonymous enum...
* defs.h (enum block_enum): ... here.  Now named.

gdb/ChangeLog
gdb/block.h
gdb/defs.h
gdb/dwarf2read.c
gdb/psymtab.c
gdb/symfile.h
gdb/symtab.c
gdb/symtab.h

index a5d2aa1..186166a 100644 (file)
@@ -1,3 +1,24 @@
+2011-04-04  Tom Tromey  <tromey@redhat.com>
+
+       * symtab.h (domain_enum): Split in two...
+       (enum search_domain): New.
+       (search_symbols): Update.
+       * symtab.c (print_symbol_info, symtab_symbol_info): Remove
+       redundant declarations.
+       (search_symbols): Change 'kind' argument to search_domain.
+       Update.
+       (print_symbol_info): Likewise.
+       (symtab_symbol_info): Likewise.
+       * symfile.h (struct quick_symbol_functions)
+       <pre_expand_symtabs_matching>: Change type of 'kind' argument.
+       <expand_symtabs_matching>: Likewise.
+       * psymtab.c (pre_expand_symtabs_matching_psymtabs): Update.
+       (expand_symtabs_matching_via_partial): Update.
+       * dwarf2read.c (dw2_pre_expand_symtabs_matching): Update.
+       (dw2_expand_symtabs_for_function): Update.
+       * block.h: Moved anonymous enum...
+       * defs.h (enum block_enum): ... here.  Now named.
+
 2011-04-03  Joel Brobecker  <brobecker@adacore.com>
 
        GDB 7.3 branch created (branch timestamp: 2011-04-01 01:00 UTC)
index 07d5bc7..923013c 100644 (file)
@@ -129,10 +129,6 @@ struct blockvector
 #define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
 #define BLOCKVECTOR_MAP(blocklist) ((blocklist)->map)
 
-/* Special block numbers */
-
-enum { GLOBAL_BLOCK = 0, STATIC_BLOCK = 1, FIRST_LOCAL_BLOCK = 2 };
-
 extern struct symbol *block_linkage_function (const struct block *);
 
 extern int block_inlined_p (const struct block *block);
index 9531c5a..5379bc1 100644 (file)
@@ -1256,4 +1256,13 @@ void dummy_obstack_deallocate (void *object, void *data);
 extern void initialize_progspace (void);
 extern void initialize_inferiors (void);
 
+/* Special block numbers */
+
+enum block_enum
+{
+  GLOBAL_BLOCK = 0,
+  STATIC_BLOCK = 1,
+  FIRST_LOCAL_BLOCK = 2
+};
+
 #endif /* #ifndef DEFS_H */
index ca6c98b..591e474 100644 (file)
@@ -2426,7 +2426,7 @@ dw2_do_expand_symtabs_matching (struct objfile *objfile, const char *name)
 
 static void
 dw2_pre_expand_symtabs_matching (struct objfile *objfile,
-                                int kind, const char *name,
+                                enum block_enum block_kind, const char *name,
                                 domain_enum domain)
 {
   dw2_do_expand_symtabs_matching (objfile, name);
@@ -2572,7 +2572,7 @@ static void
 dw2_expand_symtabs_matching (struct objfile *objfile,
                             int (*file_matcher) (const char *, void *),
                             int (*name_matcher) (const char *, void *),
-                            domain_enum kind,
+                            enum search_domain kind,
                             void *data)
 {
   int i;
index a402a5d..a0647bc 100644 (file)
@@ -588,7 +588,8 @@ match_partial_symbol (struct partial_symtab *pst, int global,
 
 static void
 pre_expand_symtabs_matching_psymtabs (struct objfile *objfile,
-                                     int kind, const char *name,
+                                     enum block_enum block_kind,
+                                     const char *name,
                                      domain_enum domain)
 {
   /* Nothing.  */
@@ -1244,7 +1245,7 @@ expand_symtabs_matching_via_partial (struct objfile *objfile,
                                                          void *),
                                     int (*name_matcher) (const char *,
                                                          void *),
-                                    domain_enum kind,
+                                    enum search_domain kind,
                                     void *data)
 {
   struct partial_symtab *ps;
index a0151ea..8925482 100644 (file)
@@ -182,7 +182,8 @@ struct quick_symbol_functions
      doesn't make sense to implement both.)  The arguments are as for
      `lookup_symbol'.  */
   void (*pre_expand_symtabs_matching) (struct objfile *objfile,
-                                      int kind, const char *name,
+                                      enum block_enum block_kind,
+                                      const char *name,
                                       domain_enum domain);
 
   /* Print statistics about any indices loaded for OBJFILE.  The
@@ -265,7 +266,7 @@ struct quick_symbol_functions
   void (*expand_symtabs_matching) (struct objfile *objfile,
                                   int (*file_matcher) (const char *, void *),
                                   int (*name_matcher) (const char *, void *),
-                                  domain_enum kind,
+                                  enum search_domain kind,
                                   void *data);
 
   /* Return the symbol table from OBJFILE that contains PC and
index 8aa692d..96b0773 100644 (file)
@@ -110,13 +110,8 @@ struct symbol *lookup_symbol_aux_quick (struct objfile *objfile,
                                        const char *name,
                                        const domain_enum domain);
 
-static void print_symbol_info (domain_enum,
-                              struct symtab *, struct symbol *, int, char *);
-
 static void print_msymbol_info (struct minimal_symbol *);
 
-static void symtab_symbol_info (char *, domain_enum, int);
-
 void _initialize_symtab (void);
 
 /* */
@@ -2986,7 +2981,8 @@ search_symbols_name_matches (const char *symname, void *user_data)
    separately alphabetized.  */
 
 void
-search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[],
+search_symbols (char *regexp, enum search_domain kind,
+               int nfiles, char *files[],
                struct symbol_search **matches)
 {
   struct symtab *s;
@@ -3017,13 +3013,10 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[],
   struct cleanup *old_chain = NULL;
   struct search_symbols_data datum;
 
-  if (kind < VARIABLES_DOMAIN)
-    error (_("must search on specific domain"));
-
-  ourtype = types[(int) (kind - VARIABLES_DOMAIN)];
-  ourtype2 = types2[(int) (kind - VARIABLES_DOMAIN)];
-  ourtype3 = types3[(int) (kind - VARIABLES_DOMAIN)];
-  ourtype4 = types4[(int) (kind - VARIABLES_DOMAIN)];
+  ourtype = types[kind];
+  ourtype2 = types2[kind];
+  ourtype3 = types3[kind];
+  ourtype4 = types4[kind];
 
   sr = *matches = NULL;
   tail = NULL;
@@ -3257,7 +3250,8 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[],
    regarding the match to gdb_stdout.  */
 
 static void
-print_symbol_info (domain_enum kind, struct symtab *s, struct symbol *sym,
+print_symbol_info (enum search_domain kind,
+                  struct symtab *s, struct symbol *sym,
                   int block, char *last)
 {
   if (last == NULL || filename_cmp (last, s->filename) != 0)
@@ -3314,7 +3308,7 @@ print_msymbol_info (struct minimal_symbol *msymbol)
    matches.  */
 
 static void
-symtab_symbol_info (char *regexp, domain_enum kind, int from_tty)
+symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty)
 {
   static const char * const classnames[] =
     {"variable", "function", "type", "method"};
@@ -3331,7 +3325,7 @@ symtab_symbol_info (char *regexp, domain_enum kind, int from_tty)
   printf_filtered (regexp
                   ? "All %ss matching regular expression \"%s\":\n"
                   : "All defined %ss:\n",
-                  classnames[(int) (kind - VARIABLES_DOMAIN)], regexp);
+                  classnames[kind], regexp);
 
   for (p = symbols; p != NULL; p = p->next)
     {
index abe5e86..a1c61f0 100644 (file)
@@ -395,11 +395,13 @@ typedef enum domain_enum_tag
 
   /* LABEL_DOMAIN may be used for names of labels (for gotos).  */
 
-  LABEL_DOMAIN,
+  LABEL_DOMAIN
+} domain_enum;
 
-  /* Searching domains.  These overlap with VAR_DOMAIN, providing
-     some granularity with the search_symbols function.  */
+/* Searching domains, used for `search_symbols'.  */
 
+enum search_domain
+{
   /* Everything in VAR_DOMAIN minus FUNCTIONS_DOMAIN and
      TYPES_DOMAIN.  */
   VARIABLES_DOMAIN,
@@ -409,8 +411,7 @@ typedef enum domain_enum_tag
 
   /* All defined types */
   TYPES_DOMAIN
-}
-domain_enum;
+};
 
 /* An address-class says where to find the value of a symbol.  */
 
@@ -1263,7 +1264,7 @@ struct symbol_search
   struct symbol_search *next;
 };
 
-extern void search_symbols (char *, domain_enum, int, char **,
+extern void search_symbols (char *, enum search_domain, int, char **,
                            struct symbol_search **);
 extern void free_search_symbols (struct symbol_search *);
 extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search