diff options
author | Tom Tromey <tom@tromey.com> | 2022-04-16 10:12:49 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-06-12 10:49:48 -0600 |
commit | 93b527ef787b7c98611abd21bdd77de6c41769f1 (patch) | |
tree | 2ed7039b479e080e108387a9e7a53c2050d73f44 /gdb/buildsym.c | |
parent | d89120e9493281a60d6e7280e9cfa3741ea7e379 (diff) | |
download | binutils-93b527ef787b7c98611abd21bdd77de6c41769f1.zip binutils-93b527ef787b7c98611abd21bdd77de6c41769f1.tar.gz binutils-93b527ef787b7c98611abd21bdd77de6c41769f1.tar.bz2 |
Use malloc for mutable addrmaps
Mutable addrmaps currently require an obstack. This was probably done
to avoid having to call splay_tree_delete, but examination of the code
shows that all mutable obstacks have a limited lifetime -- now it's
simple to treat them as ordinary C++ objects, in some cases
stack-allocating them, and have a destructor to make the needed call.
This patch implements this change.
Diffstat (limited to 'gdb/buildsym.c')
-rw-r--r-- | gdb/buildsym.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 019c205..65c2ac5 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -33,7 +33,6 @@ #include "block.h" #include "cp-support.h" #include "dictionary.h" -#include "addrmap.h" #include <algorithm> /* For cleanup_undefined_stabs_types and finish_global_stabs (somewhat @@ -418,12 +417,7 @@ buildsym_compunit::record_block_range (struct block *block, || end_inclusive + 1 != block->end ()) m_pending_addrmap_interesting = true; - if (m_pending_addrmap == nullptr) - m_pending_addrmap - = (new (&m_pending_addrmap_obstack) addrmap_mutable - (&m_pending_addrmap_obstack)); - - m_pending_addrmap->set_empty (start, end_inclusive, block); + m_pending_addrmap.set_empty (start, end_inclusive, block); } struct blockvector * @@ -458,10 +452,10 @@ buildsym_compunit::make_blockvector () /* If we needed an address map for this symtab, record it in the blockvector. */ - if (m_pending_addrmap != nullptr && m_pending_addrmap_interesting) + if (m_pending_addrmap_interesting) blockvector->set_map (new (&m_objfile->objfile_obstack) addrmap_fixed - (&m_objfile->objfile_obstack, m_pending_addrmap)); + (&m_objfile->objfile_obstack, &m_pending_addrmap)); else blockvector->set_map (nullptr); |