From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 22B95385608C; Sun, 12 Jun 2022 16:55:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22B95385608C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Remove addrmap_create_mutable X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 769520b7e5c3a6a941969b3b3c52fa04edf73295 X-Git-Newrev: 10cce2c44190c0d822c593c221f7ffa2ea20f246 Message-Id: <20220612165551.22B95385608C@sourceware.org> Date: Sun, 12 Jun 2022 16:55:51 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jun 2022 16:55:51 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D10cce2c44190= c0d822c593c221f7ffa2ea20f246 commit 10cce2c44190c0d822c593c221f7ffa2ea20f246 Author: Tom Tromey Date: Sat Apr 16 09:48:12 2022 -0600 Remove addrmap_create_mutable =20 This removes addrmap_create_mutable in favor of using 'new' at the spots where the addrmap is created. Diff: --- gdb/addrmap.c | 9 ++------- gdb/addrmap.h | 4 ---- gdb/buildsym.c | 4 +++- gdb/buildsym.h | 2 +- gdb/dwarf2/read.c | 15 ++++++++------- 5 files changed, 14 insertions(+), 20 deletions(-) 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) } =20 =20 -struct addrmap * -addrmap_create_mutable (struct obstack *obstack) -{ - return new (obstack) struct addrmap_mutable (obstack); -} - /* See addrmap.h. */ =20 void @@ -483,7 +477,8 @@ test_addrmap () /* Create mutable addrmap. */ struct obstack temp_obstack; obstack_init (&temp_obstack); - struct addrmap *map =3D addrmap_create_mutable (&temp_obstack); + struct addrmap_mutable *map + =3D new (&temp_obstack) addrmap_mutable (&temp_obstack); SELF_CHECK (map !=3D nullptr); =20 /* 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: }; =20 =20 -/* 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 *bl= ock, m_pending_addrmap_interesting =3D true; =20 if (m_pending_addrmap =3D=3D nullptr) - m_pending_addrmap =3D addrmap_create_mutable (&m_pending_addrmap_obsta= ck); + m_pending_addrmap + =3D (new (&m_pending_addrmap_obstack) addrmap_mutable + (&m_pending_addrmap_obstack)); =20 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 =3D nullptr; + struct addrmap_mutable *m_pending_addrmap =3D nullptr; =20 /* 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 =3D per_objfile->per_bfd; struct gdbarch *gdbarch =3D objfile->arch (); const gdb_byte *iter, *end; - struct addrmap *mutable_map; + struct addrmap_mutable *mutable_map; CORE_ADDR baseaddr; =20 auto_obstack temp_obstack; =20 - mutable_map =3D addrmap_create_mutable (&temp_obstack); + mutable_map =3D new (&temp_obstack) addrmap_mutable (&temp_obstack); =20 iter =3D index->address_table.data (); end =3D iter + index->address_table.size (); @@ -2496,7 +2496,8 @@ create_addrmap_from_aranges (dwarf2_per_objfile *per_= objfile, dwarf2_per_bfd *per_bfd =3D per_objfile->per_bfd; =20 auto_obstack temp_obstack; - addrmap *mutable_map =3D addrmap_create_mutable (&temp_obstack); + addrmap_mutable *mutable_map + =3D new (&temp_obstack) addrmap_mutable (&temp_obstack); =20 if (read_addrmap_from_aranges (per_objfile, section, mutable_map)) per_bfd->index_addrmap =3D mutable_map->create_fixed (&per_bfd->obstac= k); @@ -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_stor= age)) { } =20 @@ -6607,7 +6608,7 @@ public: } =20 /* 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; }; =20 /* 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)) { }