From: Tom Tromey Date: Mon, 4 Apr 2011 14:10:12 +0000 (+0000) Subject: * symtab.h (domain_enum): Split in two... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8903c50da7496b9e04c3db262ec7020a206cab79;p=binutils-gdb.git * 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) : Change type of 'kind' argument. : 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a5d2aa14ebb..186166a0fe4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,24 @@ +2011-04-04 Tom Tromey + + * 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) + : Change type of 'kind' argument. + : 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 GDB 7.3 branch created (branch timestamp: 2011-04-01 01:00 UTC) diff --git a/gdb/block.h b/gdb/block.h index 07d5bc7220b..923013ca38a 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -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); diff --git a/gdb/defs.h b/gdb/defs.h index 9531c5adadd..5379bc1470f 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -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 */ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index ca6c98b5b5f..591e4740af9 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -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; diff --git a/gdb/psymtab.c b/gdb/psymtab.c index a402a5da6f6..a0647bcca3f 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -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; diff --git a/gdb/symfile.h b/gdb/symfile.h index a0151eafadb..89254829bd3 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -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 diff --git a/gdb/symtab.c b/gdb/symtab.c index 8aa692d6c3b..96b07735f48 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -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) { diff --git a/gdb/symtab.h b/gdb/symtab.h index abe5e8610ef..a1c61f0e5da 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -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