diff options
author | 2018-05-10 16:23:47 -0600 | |
---|---|---|
committer | 2019-01-10 07:08:11 -0700 | |
commit | 6eee24ce30f8e95335c2ad8586f9a64398eb2cd4 (patch) | |
tree | 621616df26c1fd059c70b00ebdb83cd397ba8371 /gdb/psymtab.c | |
parent | Change add_psymbol_to_list to use an enum (diff) | |
download | binutils-gdb-6eee24ce30f8e95335c2ad8586f9a64398eb2cd4.tar.gz binutils-gdb-6eee24ce30f8e95335c2ad8586f9a64398eb2cd4.tar.bz2 binutils-gdb-6eee24ce30f8e95335c2ad8586f9a64398eb2cd4.zip |
Simplify calls to init_psymbol_list
Existing callers to init_psymbol_list were checking to see if psymbols
had already been initialized. It seemed better to me to do this check
directly in init_psymbol_list, simplifying the callers.
gdb/ChangeLog
2019-01-10 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_initial_scan): Unconditionally call
init_psymbol_list.
* psymtab.c (init_psymbol_list): Do nothing if already called.
* psympriv.h (init_psymbol_list): Add comment.
* dwarf2read.c (dwarf2_build_psymtabs): Unconditionally call
init_psymbol_list.
* dbxread.c (dbx_symfile_read): Unconditionally call
init_psymbol_list.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r-- | gdb/psymtab.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c index ddb8e767bb4..356901f14b7 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1662,20 +1662,21 @@ add_psymbol_to_list (const char *name, int namelength, int copy_name, append_psymbol_to_list (list, psym, objfile); } -/* Initialize storage for partial symbols. */ +/* See psympriv.h. */ void init_psymbol_list (struct objfile *objfile, int total_symbols) { - /* Free any previously allocated psymbol lists. */ - objfile->global_psymbols.clear (); - objfile->static_psymbols.clear (); - - /* Current best guess is that approximately a twentieth - of the total symbols (in a debugging file) are global or static - oriented symbols, then multiply that by slop factor of two. */ - objfile->global_psymbols.reserve (total_symbols / 10); - objfile->static_psymbols.reserve (total_symbols / 10); + if (objfile->global_psymbols.capacity () == 0 + && objfile->static_psymbols.capacity () == 0) + { + /* Current best guess is that approximately a twentieth of the + total symbols (in a debugging file) are global or static + oriented symbols, then multiply that by slop factor of + two. */ + objfile->global_psymbols.reserve (total_symbols / 10); + objfile->static_psymbols.reserve (total_symbols / 10); + } } /* See psympriv.h. */ |