From 540c2971fa25a14ae16a9bb14ba2f424b5f1ea96 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Tue, 14 Jan 2014 18:19:51 -0800 Subject: [PATCH] psymtab cleanup patch 1/3 This is the first of a set of three patches to cleanup psymtab.c a bit. Basically, these two functions do not belong in psymtab.c: expand_partial_symbol_names, map_partial_symbol_filenames, and "partial" does not belong in the function name. This first patch moves them to a better location. The second patch adds some typedefs for function parameters to quick_symbol_functions.expand_symtabs_matching. The third patch removes "partial" from the function names and uses them in more places. * psymtab.c (expand_partial_symbol_names): Delete, moved to symfile.c. (map_partial_symbol_filenames): Ditto. * psymtab.h (expand_partial_symbol_names): Delete, moved to symfile.h. (map_partial_symbol_filenames): Ditto. * symfile.c (expand_partial_symbol_names): Moved here from psymtab.c. (map_partial_symbol_filenames): Ditto. * symfile.h (expand_partial_symbol_names): Moved here from psymtab.h. (map_partial_symbol_filenames): Ditto. * symtab.c: Delete #include "psymtab.h". --- gdb/ChangeLog | 12 ++++++++++++ gdb/psymtab.c | 28 ---------------------------- gdb/psymtab.h | 6 ------ gdb/symfile.c | 36 ++++++++++++++++++++++++++++++++++++ gdb/symfile.h | 6 ++++++ gdb/symtab.c | 1 - 6 files changed, 54 insertions(+), 35 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3daf77fa4ee..015e4cc8062 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2014-01-14 Doug Evans + + * psymtab.c (expand_partial_symbol_names): Delete, moved to symfile.c. + (map_partial_symbol_filenames): Ditto. + * psymtab.h (expand_partial_symbol_names): Delete, moved to symfile.h. + (map_partial_symbol_filenames): Ditto. + * symfile.c (expand_partial_symbol_names): Moved here from psymtab.c. + (map_partial_symbol_filenames): Ditto. + * symfile.h (expand_partial_symbol_names): Moved here from psymtab.h. + (map_partial_symbol_filenames): Ditto. + * symtab.c: Delete #include "psymtab.h". + 2014-01-14 Pedro Alves Tom Tromey diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 56fe409ae68..ce45589396a 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -2088,34 +2088,6 @@ maintenance_check_psymtabs (char *ignore, int from_tty) -void -expand_partial_symbol_names (int (*fun) (const char *, void *), - void *data) -{ - struct objfile *objfile; - - ALL_OBJFILES (objfile) - { - if (objfile->sf) - objfile->sf->qf->expand_symtabs_matching (objfile, NULL, fun, - ALL_DOMAIN, data); - } -} - -void -map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data, - int need_fullname) -{ - struct objfile *objfile; - - ALL_OBJFILES (objfile) - { - if (objfile->sf) - objfile->sf->qf->map_symbol_filenames (objfile, fun, data, - need_fullname); - } -} - extern initialize_file_ftype _initialize_psymtab; void diff --git a/gdb/psymtab.h b/gdb/psymtab.h index 688e31e323e..d3d8c094f25 100644 --- a/gdb/psymtab.h +++ b/gdb/psymtab.h @@ -30,12 +30,6 @@ extern struct psymbol_bcache *psymbol_bcache_init (void); extern void psymbol_bcache_free (struct psymbol_bcache *); extern struct bcache *psymbol_bcache_get_bcache (struct psymbol_bcache *); -void expand_partial_symbol_names (int (*fun) (const char *, void *), - void *data); - -void map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data, - int need_fullname); - extern const struct quick_symbol_functions psym_functions; extern const struct quick_symbol_functions dwarf2_gdb_index_functions; diff --git a/gdb/symfile.c b/gdb/symfile.c index a8bc3d8a5d3..607a648e332 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3838,6 +3838,42 @@ symfile_free_objfile (struct objfile *objfile) remove_target_sections ((void *) objfile); } +/* Wrapper around the quick_symbol_functions expand_symtabs_matching "method". + Expand all symtabs that match the specified criteria. + See quick_symbol_functions.expand_symtabs_matching for details. */ + +void +expand_partial_symbol_names (int (*fun) (const char *, void *), + void *data) +{ + struct objfile *objfile; + + ALL_OBJFILES (objfile) + { + if (objfile->sf) + objfile->sf->qf->expand_symtabs_matching (objfile, NULL, fun, + ALL_DOMAIN, data); + } +} + +/* Wrapper around the quick_symbol_functions map_symbol_filenames "method". + Map function FUN over every file. + See quick_symbol_functions.map_symbol_filenames for details. */ + +void +map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data, + int need_fullname) +{ + struct objfile *objfile; + + ALL_OBJFILES (objfile) + { + if (objfile->sf) + objfile->sf->qf->map_symbol_filenames (objfile, fun, data, + need_fullname); + } +} + void _initialize_symfile (void) { diff --git a/gdb/symfile.h b/gdb/symfile.h index ff6f1524cc9..380c8cdfe69 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -554,6 +554,12 @@ void free_symfile_segment_data (struct symfile_segment_data *data); extern struct cleanup *increment_reading_symtab (void); +void expand_partial_symbol_names (int (*fun) (const char *, void *), + void *data); + +void map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data, + int need_fullname); + /* From dwarf2read.c */ /* Names for a dwarf2 debugging section. The field NORMAL is the normal diff --git a/gdb/symtab.c b/gdb/symtab.c index acfdd46d018..97cec587f5b 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -61,7 +61,6 @@ #include "macrotab.h" #include "macroscope.h" -#include "psymtab.h" #include "parser-defs.h" /* Prototypes for local functions */ -- 2.30.2