From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 340C53856080; Sun, 12 Jun 2022 16:55:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 340C53856080 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_fixed X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 10cce2c44190c0d822c593c221f7ffa2ea20f246 X-Git-Newrev: d89120e9493281a60d6e7280e9cfa3741ea7e379 Message-Id: <20220612165556.340C53856080@sourceware.org> Date: Sun, 12 Jun 2022 16:55:56 +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:56 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dd89120e94932= 81a60d6e7280e9cfa3741ea7e379 commit d89120e9493281a60d6e7280e9cfa3741ea7e379 Author: Tom Tromey Date: Sat Apr 16 09:53:39 2022 -0600 Remove addrmap::create_fixed =20 addrmap::create_fixed is just a simple wrapper for 'new', so remove it in favor of uses of 'new'. Diff: --- gdb/addrmap.c | 19 ++----------------- gdb/addrmap.h | 6 ------ gdb/buildsym.c | 3 ++- gdb/dwarf2/cooked-index.h | 4 ++-- gdb/dwarf2/read.c | 7 +++++-- 5 files changed, 11 insertions(+), 28 deletions(-) diff --git a/gdb/addrmap.c b/gdb/addrmap.c index 29e6b2e8a31..51a6c676ec6 100644 --- a/gdb/addrmap.c +++ b/gdb/addrmap.c @@ -72,15 +72,6 @@ addrmap_fixed::find (CORE_ADDR addr) const } =20 =20 -struct addrmap * -addrmap_fixed::create_fixed (struct obstack *obstack) -{ - internal_error (__FILE__, __LINE__, - _("addrmap_create_fixed is not implemented yet " - "for fixed addrmaps")); -} - - void addrmap_fixed::relocate (CORE_ADDR offset) { @@ -306,13 +297,6 @@ addrmap_fixed::addrmap_fixed (struct obstack *obstack,= addrmap_mutable *mut) } =20 =20 -struct addrmap * -addrmap_mutable::create_fixed (struct obstack *obstack) -{ - return new (obstack) struct addrmap_fixed (obstack, this); -} - - void addrmap_mutable::relocate (CORE_ADDR offset) { @@ -491,7 +475,8 @@ test_addrmap () CHECK_ADDRMAP_FIND (map, array, 13, 19, nullptr); =20 /* Create corresponding fixed addrmap. */ - struct addrmap *map2 =3D map->create_fixed (&temp_obstack); + struct addrmap *map2 + =3D new (&temp_obstack) addrmap_fixed (&temp_obstack, map); SELF_CHECK (map2 !=3D nullptr); CHECK_ADDRMAP_FIND (map2, array, 0, 9, nullptr); CHECK_ADDRMAP_FIND (map2, array, 10, 12, val1); diff --git a/gdb/addrmap.h b/gdb/addrmap.h index 8794f1fefbf..a3b1d6ad4a8 100644 --- a/gdb/addrmap.h +++ b/gdb/addrmap.h @@ -87,10 +87,6 @@ struct addrmap : public allocate_on_obstack /* Return the object associated with ADDR in MAP. */ virtual void *find (CORE_ADDR addr) const =3D 0; =20 - /* Create a fixed address map which is a copy of this mutable - address map. Allocate entries in OBSTACK. */ - virtual struct addrmap *create_fixed (struct obstack *obstack) =3D 0; - /* Relocate all the addresses in MAP by OFFSET. (This can be applied to either mutable or immutable maps.) */ virtual void relocate (CORE_ADDR offset) =3D 0; @@ -115,7 +111,6 @@ public: void set_empty (CORE_ADDR start, CORE_ADDR end_inclusive, void *obj) override; void *find (CORE_ADDR addr) const override; - struct addrmap *create_fixed (struct obstack *obstack) override; void relocate (CORE_ADDR offset) override; int foreach (addrmap_foreach_fn fn) override; =20 @@ -153,7 +148,6 @@ public: void set_empty (CORE_ADDR start, CORE_ADDR end_inclusive, void *obj) override; void *find (CORE_ADDR addr) const override; - struct addrmap *create_fixed (struct obstack *obstack) override; void relocate (CORE_ADDR offset) override; int foreach (addrmap_foreach_fn fn) override; =20 diff --git a/gdb/buildsym.c b/gdb/buildsym.c index d4a90abcee4..019c2055f60 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -460,7 +460,8 @@ buildsym_compunit::make_blockvector () blockvector. */ if (m_pending_addrmap !=3D nullptr && m_pending_addrmap_interesting) blockvector->set_map - (m_pending_addrmap->create_fixed (&m_objfile->objfile_obstack)); + (new (&m_objfile->objfile_obstack) addrmap_fixed + (&m_objfile->objfile_obstack, m_pending_addrmap)); else blockvector->set_map (nullptr); =20 diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index 4fc2a9411d4..439cbb19fa7 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -185,10 +185,10 @@ public: dwarf2_per_cu_data *per_cu); =20 /* Install a new fixed addrmap from the given mutable addrmap. */ - void install_addrmap (addrmap *map) + void install_addrmap (addrmap_mutable *map) { gdb_assert (m_addrmap =3D=3D nullptr); - m_addrmap =3D map->create_fixed (&m_storage); + m_addrmap =3D new (&m_storage) addrmap_fixed (&m_storage, map); } =20 /* Finalize the index. This should be called a single time, when diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 216b211bf9d..96378c3a09f 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -2308,7 +2308,8 @@ create_addrmap_from_index (dwarf2_per_objfile *per_ob= jfile, mutable_map->set_empty (lo, hi - 1, per_bfd->get_cu (cu_index)); } =20 - per_bfd->index_addrmap =3D mutable_map->create_fixed (&per_bfd->obstack); + per_bfd->index_addrmap + =3D new (&per_bfd->obstack) addrmap_fixed (&per_bfd->obstack, mutable_= map); } =20 /* Read the address map data from DWARF-5 .debug_aranges, and use it @@ -2500,7 +2501,9 @@ create_addrmap_from_aranges (dwarf2_per_objfile *per_= objfile, =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); + per_bfd->index_addrmap + =3D new (&per_bfd->obstack) addrmap_fixed (&per_bfd->obstack, + mutable_map); } =20 /* A helper function that reads the .gdb_index from BUFFER and fills