diff options
author | Tom Tromey <tom@tromey.com> | 2022-04-16 09:48:12 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-06-12 10:49:48 -0600 |
commit | 10cce2c44190c0d822c593c221f7ffa2ea20f246 (patch) | |
tree | f0656de9650de9ea225a273c5c04f3ddcbd42cbe /gdb | |
parent | 769520b7e5c3a6a941969b3b3c52fa04edf73295 (diff) | |
download | gdb-10cce2c44190c0d822c593c221f7ffa2ea20f246.zip gdb-10cce2c44190c0d822c593c221f7ffa2ea20f246.tar.gz gdb-10cce2c44190c0d822c593c221f7ffa2ea20f246.tar.bz2 |
Remove addrmap_create_mutable
This removes addrmap_create_mutable in favor of using 'new' at the
spots where the addrmap is created.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/addrmap.c | 9 | ||||
-rw-r--r-- | gdb/addrmap.h | 4 | ||||
-rw-r--r-- | gdb/buildsym.c | 4 | ||||
-rw-r--r-- | gdb/buildsym.h | 2 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 15 |
5 files changed, 14 insertions, 20 deletions
diff --git a/gdb/addrmap.c b/gdb/addrmap.c index b9a7871..29e6b2e 100644 --- a/gdb/addrmap.c +++ b/gdb/addrmap.c @@ -406,12 +406,6 @@ addrmap_mutable::addrmap_mutable (struct obstack *obs) } -struct addrmap * -addrmap_create_mutable (struct obstack *obstack) -{ - return new (obstack) struct addrmap_mutable (obstack); -} - /* See addrmap.h. */ void @@ -483,7 +477,8 @@ test_addrmap () /* Create mutable addrmap. */ struct obstack temp_obstack; obstack_init (&temp_obstack); - struct addrmap *map = addrmap_create_mutable (&temp_obstack); + struct addrmap_mutable *map + = new (&temp_obstack) addrmap_mutable (&temp_obstack); SELF_CHECK (map != nullptr); /* Check initial state. */ diff --git a/gdb/addrmap.h b/gdb/addrmap.h index 01569d3..8794f1f 100644 --- a/gdb/addrmap.h +++ b/gdb/addrmap.h @@ -202,10 +202,6 @@ private: }; -/* Create a mutable address map which maps every address to NULL. - Allocate entries in OBSTACK. */ -struct addrmap *addrmap_create_mutable (struct obstack *obstack); - /* Dump the addrmap to OUTFILE. If PAYLOAD is non-NULL, only dump any components that map to PAYLOAD. (If PAYLOAD is NULL, the entire map is dumped.) */ diff --git a/gdb/buildsym.c b/gdb/buildsym.c index f057f5c..d4a90ab 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -419,7 +419,9 @@ buildsym_compunit::record_block_range (struct block *block, m_pending_addrmap_interesting = true; if (m_pending_addrmap == nullptr) - m_pending_addrmap = addrmap_create_mutable (&m_pending_addrmap_obstack); + m_pending_addrmap + = (new (&m_pending_addrmap_obstack) addrmap_mutable + (&m_pending_addrmap_obstack)); m_pending_addrmap->set_empty (start, end_inclusive, block); } diff --git a/gdb/buildsym.h b/gdb/buildsym.h index ee75e6f..c1cd519 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -385,7 +385,7 @@ private: /* The mutable address map for the compilation unit whose symbols we're currently reading. The symtabs' shared blockvector will point to a fixed copy of this. */ - struct addrmap *m_pending_addrmap = nullptr; + struct addrmap_mutable *m_pending_addrmap = nullptr; /* The obstack on which we allocate pending_addrmap. If pending_addrmap is NULL, this is uninitialized; otherwise, it is diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 2af1a49..216b211 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -2267,12 +2267,12 @@ create_addrmap_from_index (dwarf2_per_objfile *per_objfile, dwarf2_per_bfd *per_bfd = per_objfile->per_bfd; struct gdbarch *gdbarch = objfile->arch (); const gdb_byte *iter, *end; - struct addrmap *mutable_map; + struct addrmap_mutable *mutable_map; CORE_ADDR baseaddr; auto_obstack temp_obstack; - mutable_map = addrmap_create_mutable (&temp_obstack); + mutable_map = new (&temp_obstack) addrmap_mutable (&temp_obstack); iter = index->address_table.data (); end = iter + index->address_table.size (); @@ -2496,7 +2496,8 @@ create_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, dwarf2_per_bfd *per_bfd = per_objfile->per_bfd; auto_obstack temp_obstack; - addrmap *mutable_map = addrmap_create_mutable (&temp_obstack); + addrmap_mutable *mutable_map + = new (&temp_obstack) addrmap_mutable (&temp_obstack); if (read_addrmap_from_aranges (per_objfile, section, mutable_map)) per_bfd->index_addrmap = mutable_map->create_fixed (&per_bfd->obstack); @@ -6552,7 +6553,7 @@ public: xcalloc, xfree)), m_index (new cooked_index), m_addrmap_storage (), - m_addrmap (addrmap_create_mutable (&m_addrmap_storage)) + m_addrmap (new (&m_addrmap_storage) addrmap_mutable (&m_addrmap_storage)) { } @@ -6607,7 +6608,7 @@ public: } /* Return the mutable addrmap that is currently being created. */ - addrmap *get_addrmap () + addrmap_mutable *get_addrmap () { return m_addrmap; } @@ -6639,7 +6640,7 @@ private: /* Storage for the writeable addrmap. */ auto_obstack m_addrmap_storage; /* A writeable addrmap being constructed by this scanner. */ - addrmap *m_addrmap; + addrmap_mutable *m_addrmap; }; /* An instance of this is created to index a CU. */ @@ -6655,7 +6656,7 @@ public: m_per_cu (per_cu), m_language (language), m_obstack (), - m_die_range_map (addrmap_create_mutable (&m_obstack)) + m_die_range_map (new (&m_obstack) addrmap_mutable (&m_obstack)) { } |