aboutsummaryrefslogtreecommitdiff
path: root/gdb/minsyms.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-09-22 13:47:48 -0600
committerTom Tromey <tom@tromey.com>2016-10-21 14:17:33 -0600
commit873a915e0ad44cb303b071638536f27569491030 (patch)
tree6209436a7e32b15b891764df1e5e2738e33a4ec5 /gdb/minsyms.h
parent4b6749b9a4680e79affdb9c02ea2f5ba39a54587 (diff)
downloadfsf-binutils-gdb-873a915e0ad44cb303b071638536f27569491030.zip
fsf-binutils-gdb-873a915e0ad44cb303b071638536f27569491030.tar.gz
fsf-binutils-gdb-873a915e0ad44cb303b071638536f27569491030.tar.bz2
Introduce minimal_symbol_reader
This patch introduced minimal_symbol_reader, a RAII-based class which replaces the current make_cleanup_discard_minimal_symbols. 2016-10-21 Tom Tromey <tom@tromey.com> * xcoffread.c (xcoff_initial_scan): Use minimal_symbol_reader. * mipsread.c (mipscoff_symfile_read): Use minimal_symbol_reader. * minsyms.h (minimal_symbol_reader): New class. (init_minimal_symbol_collection) (make_cleanup_discard_minimal_symbols, install_minimal_symbols): Don't declare. * minsyms.c (minimal_symbol_reader): Renamed from init_minimal_symbol_collection, turned into constructor. (~minimal_symbol_reader): Renamed from do_discard_minimal_symbols_cleanup, turned into destructor. (make_cleanup_discard_minimal_symbols): Remove. (minimal_symbol_reader::install): Rename form install_minimal_symbols. * mdebugread.c (elfmdebug_build_psymtabs): Use minimal_symbol_reader. * machoread.c (macho_symfile_read): Use minimal_symbol_reader. * elfread.c (elf_read_minimal_symbols): Use minimal_symbol_reader. * dbxread.c (dbx_symfile_read): Use minimal_symbol_reader. * coffread.c (coff_symfile_read): Use minimal_symbol_reader.
Diffstat (limited to 'gdb/minsyms.h')
-rw-r--r--gdb/minsyms.h43
1 files changed, 24 insertions, 19 deletions
diff --git a/gdb/minsyms.h b/gdb/minsyms.h
index 8857f1a..d75bd41 100644
--- a/gdb/minsyms.h
+++ b/gdb/minsyms.h
@@ -53,21 +53,33 @@ struct bound_minimal_symbol
as opaque and use functions provided by minsyms.c to inspect them.
*/
-/* Prepare to start collecting minimal symbols. This should be called
- by a symbol reader to initialize the minimal symbol module.
- Currently, minimal symbol table creation is not reentrant; it
- relies on global (static) variables in minsyms.c. */
+/* An RAII-based object that is used to record minimal symbols while
+ they are being read. */
+class minimal_symbol_reader
+{
+ public:
+
+ /* Prepare to start collecting minimal symbols. This should be called
+ by a symbol reader to initialize the minimal symbol module.
+ Currently, minimal symbol table creation is not reentrant; it
+ relies on global (static) variables in minsyms.c. */
+
+ explicit minimal_symbol_reader ();
+
+ ~minimal_symbol_reader ();
-void init_minimal_symbol_collection (void);
+ /* Install the minimal symbols that have been collected into the
+ given objfile. */
-/* Return a cleanup which is used to clean up the global state left
- over by minimal symbol creation. After calling
- init_minimal_symbol_collection, a symbol reader should call this
- function. Then, after all minimal symbols have been read,
- regardless of whether they are installed or not, the cleanup
- returned by this function should be run. */
+ void install (struct objfile *);
-struct cleanup *make_cleanup_discard_minimal_symbols (void);
+ private:
+
+ /* No need for these. They are intentionally not defined anywhere. */
+ minimal_symbol_reader &operator=
+ (const minimal_symbol_reader &);
+ minimal_symbol_reader (const minimal_symbol_reader &);
+};
/* Record a new minimal symbol. This is the "full" entry point;
simpler convenience entry points are also provided below.
@@ -122,13 +134,6 @@ struct minimal_symbol *prim_record_minimal_symbol_and_info
int section,
struct objfile *);
-/* Install the minimal symbols that have been collected into the given
- objfile. After this is called, the cleanup returned by
- make_cleanup_discard_minimal_symbols should be run in order to
- clean up global state. */
-
-void install_minimal_symbols (struct objfile *);
-
/* Create the terminating entry of OBJFILE's minimal symbol table.
If OBJFILE->msymbols is zero, allocate a single entry from
OBJFILE->objfile_obstack; otherwise, just initialize