From: Tom Tromey Date: Sat, 16 Apr 2022 15:48:12 +0000 (-0600) Subject: Remove addrmap_create_mutable X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=10cce2c44190c0d822c593c221f7ffa2ea20f246;p=binutils-gdb.git Remove addrmap_create_mutable This removes addrmap_create_mutable in favor of using 'new' at the spots where the addrmap is created. --- diff --git a/gdb/addrmap.c b/gdb/addrmap.c index b9a787135b8..29e6b2e8a31 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 01569d3fa0a..8794f1fefbf 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 f057f5c4b3f..d4a90abcee4 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 ee75e6fd95d..c1cd5192a79 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 2af1a49f45d..216b211bf9d 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)) { }