public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Remove addrmap_create_mutable Date: Sun, 12 Jun 2022 16:55:51 +0000 (GMT) [thread overview] Message-ID: <20220612165551.22B95385608C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=10cce2c44190c0d822c593c221f7ffa2ea20f246 commit 10cce2c44190c0d822c593c221f7ffa2ea20f246 Author: Tom Tromey <tom@tromey.com> Date: Sat Apr 16 09:48:12 2022 -0600 Remove addrmap_create_mutable 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) } -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)) { }
reply other threads:[~2022-06-12 16:55 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220612165551.22B95385608C@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).