diff options
author | Tom Tromey <tom@tromey.com> | 2019-10-22 16:51:55 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-01-26 16:40:21 -0700 |
commit | abaa2f2340a400fd19aea2973f705fe813d620d4 (patch) | |
tree | f780f6ee634c37effc7a41a087e497387d6f8bf9 /gdb/psymtab.c | |
parent | 6d94535fc68e1fd06816c5685166ebcec56119ce (diff) | |
download | binutils-abaa2f2340a400fd19aea2973f705fe813d620d4.zip binutils-abaa2f2340a400fd19aea2973f705fe813d620d4.tar.gz binutils-abaa2f2340a400fd19aea2973f705fe813d620d4.tar.bz2 |
Do not allocate psymtabs via psymtab_storage
Currently, partial symbol tables are allocated by a method in
psymtab_storage. However, eventually we want to subclass partial
symtabs in the symbol readers, so the calls to "new" will have to
happen there. This patch is a first step, moving the allocation from
psymtab_storage and into allocate_psymtab.
gdb/ChangeLog
2020-01-26 Tom Tromey <tom@tromey.com>
* psymtab.h (class psymtab_storage) <install_psymtab>: Rename from
allocate_psymtab. Update documentation.
* psymtab.c (psymtab_storage::install_psymtab): Rename from
allocate_psymtab. Do not use new.
(allocate_psymtab): Use new. Update.
Change-Id: Iba6a9bf3ee1e78062fdb9f007c3010f826f64bc8
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r-- | gdb/psymtab.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 037ed19..975737c 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -75,15 +75,11 @@ psymtab_storage::~psymtab_storage () /* See psymtab.h. */ -struct partial_symtab * -psymtab_storage::allocate_psymtab () +void +psymtab_storage::install_psymtab (partial_symtab *pst) { - struct partial_symtab *psymtab = new struct partial_symtab; - - psymtab->next = psymtabs; - psymtabs = psymtab; - - return psymtab; + pst->next = psymtabs; + psymtabs = pst; } @@ -1653,8 +1649,8 @@ init_psymbol_list (struct objfile *objfile, int total_symbols) struct partial_symtab * allocate_psymtab (const char *filename, struct objfile *objfile) { - struct partial_symtab *psymtab - = objfile->partial_symtabs->allocate_psymtab (); + struct partial_symtab *psymtab = new partial_symtab; + objfile->partial_symtabs->install_psymtab (psymtab); psymtab->filename = ((const char *) objfile->per_bfd->filename_cache.insert |