From 652788a73137d8c16ac67a0cf9a8e51dd336d09e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 20 May 2018 22:45:44 -0600 Subject: [PATCH] Make free_pending_blocks static free_pending_blocks can be static because scoped_free_pendings (et al) arrange for it to be NULL in the "steady state". This removes a couple of unnecessary calls to free_pending_blocks and changes it to be static. gdb/ChangeLog 2018-07-16 Tom Tromey * xcoffread.c (xcoff_initial_scan): Don't call free_pending_blocks. * dbxread.c (dbx_symfile_read): Don't call free_pending_blocks. * buildsym.h (class scoped_free_pendings): Add constructor. (free_pending_blocks): Don't declare. * buildsym.c (scoped_free_pendings::scoped_free_pendings): New. (free_pending_blocks): Now static. --- gdb/ChangeLog | 10 ++++++++++ gdb/buildsym.c | 11 +++++++++-- gdb/buildsym.h | 4 +--- gdb/dbxread.c | 1 - gdb/xcoffread.c | 2 -- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7d12bee..0fb3496 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2018-07-16 Tom Tromey + * xcoffread.c (xcoff_initial_scan): Don't call + free_pending_blocks. + * dbxread.c (dbx_symfile_read): Don't call free_pending_blocks. + * buildsym.h (class scoped_free_pendings): Add constructor. + (free_pending_blocks): Don't declare. + * buildsym.c (scoped_free_pendings::scoped_free_pendings): New. + (free_pending_blocks): Now static. + +2018-07-16 Tom Tromey + * buildsym.h (push_subfile, pop_subfile): Update declarations. * buildsym.c (struct buildsym_compunit) : New member. diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 8d06cec..4e5da07 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -263,6 +263,8 @@ static void record_pending_block (struct objfile *objfile, struct block *block, struct pending_block *opblock); +static void free_pending_blocks (); + /* Initial sizes of data structures. These are realloc'd larger if needed, and realloc'd down to the size actually used, when completed. */ @@ -331,6 +333,11 @@ find_symbol_in_list (struct pending *list, char *name, int length) return (NULL); } +scoped_free_pendings::scoped_free_pendings () +{ + gdb_assert (pending_blocks == nullptr); +} + /* At end of reading syms, or in case of quit, ensure everything associated with building symtabs is freed. @@ -373,8 +380,8 @@ scoped_free_pendings::~scoped_free_pendings () /* This function is called to discard any pending blocks. */ -void -free_pending_blocks (void) +static void +free_pending_blocks () { if (pending_blocks != NULL) { diff --git a/gdb/buildsym.h b/gdb/buildsym.h index b5ea63d..512d926 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -176,7 +176,7 @@ class scoped_free_pendings { public: - scoped_free_pendings () = default; + scoped_free_pendings (); ~scoped_free_pendings (); DISABLE_COPY_AND_ASSIGN (scoped_free_pendings); @@ -222,8 +222,6 @@ extern struct compunit_symtab *start_symtab (struct objfile *objfile, extern void restart_symtab (struct compunit_symtab *cust, const char *name, CORE_ADDR start_addr); -extern void free_pending_blocks (void); - /* Record the name of the debug format in the current pending symbol table. FORMAT must be a string with a lifetime at least as long as the symtab's objfile. */ diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 7729315..5d4b978 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -545,7 +545,6 @@ dbx_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) symbol_size = DBX_SYMBOL_SIZE (objfile); symbol_table_offset = DBX_SYMTAB_OFFSET (objfile); - free_pending_blocks (); scoped_free_pendings free_pending; minimal_symbol_reader reader (objfile); diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 31ba503..f9f19e7 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -3018,8 +3018,6 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) include N_SLINE. */ init_psymbol_list (objfile, num_symbols); - free_pending_blocks (); - scoped_free_pendings free_pending; minimal_symbol_reader reader (objfile); -- 2.7.4