From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id B37EB3858C54; Thu, 28 Apr 2022 02:40:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B37EB3858C54 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: remove BLOCKVECTOR_MAP macro X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: bad9471aab31d1b5aa733b8985b8e40e2a97b8e7 X-Git-Newrev: 414705d1c2d359694459d3991a0975d051ac70b5 Message-Id: <20220428024013.B37EB3858C54@sourceware.org> Date: Thu, 28 Apr 2022 02:40:13 +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: Thu, 28 Apr 2022 02:40:13 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D414705d1c2d3= 59694459d3991a0975d051ac70b5 commit 414705d1c2d359694459d3991a0975d051ac70b5 Author: Simon Marchi Date: Wed Apr 20 17:17:11 2022 -0400 gdb: remove BLOCKVECTOR_MAP macro =20 Replace with equivalent methods. =20 Change-Id: I4e56c76dfc363c1447686fb29c4212ea18b4dba0 Diff: --- gdb/block.c | 4 ++-- gdb/block.h | 18 ++++++++++++++---- gdb/buildsym.c | 6 +++--- gdb/inline-frame.c | 5 ++--- gdb/jit.c | 2 +- gdb/objfiles.c | 4 ++-- gdb/symtab.c | 4 ++-- 7 files changed, 26 insertions(+), 17 deletions(-) diff --git a/gdb/block.c b/gdb/block.c index 1c3a0030fd4..39a39df9454 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -138,8 +138,8 @@ find_block_in_blockvector (const struct blockvector *bl= , CORE_ADDR pc) =20 /* If we have an addrmap mapping code addresses to blocks, then use that. */ - if (BLOCKVECTOR_MAP (bl)) - return (const struct block *) addrmap_find (BLOCKVECTOR_MAP (bl), pc); + if (bl->map () !=3D nullptr) + return (const struct block *) addrmap_find (bl->map (), pc); =20 /* Otherwise, use binary search to find the last block that starts before PC. diff --git a/gdb/block.h b/gdb/block.h index b6b8b86f333..b9f4e974c04 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -296,12 +296,24 @@ struct blockvector const struct block *static_block () const { return this->block (STATIC_BLOCK); } =20 + /* Return the address -> block map of this blockvector. */ + addrmap *map () + { return m_map; } + + /* Const version of the above. */ + const addrmap *map () const + { return m_map; } + + /* Set this blockvector's address -> block map. */ + void set_map (addrmap *map) + { m_map =3D map; } + +private: /* An address map mapping addresses to blocks in this blockvector. This pointer is zero if the blocks' start and end addresses are enough. */ - struct addrmap *map; + struct addrmap *m_map; =20 -private: /* Number of blocks in the list. */ int m_num_blocks; =20 @@ -309,8 +321,6 @@ private: struct block *m_blocks[1]; }; =20 -#define BLOCKVECTOR_MAP(blocklist) ((blocklist)->map) - /* Return the objfile of BLOCK, which must be non-NULL. */ =20 extern struct objfile *block_objfile (const struct block *block); diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 48cd9679b8f..c54e6586ced 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -457,10 +457,10 @@ buildsym_compunit::make_blockvector () /* If we needed an address map for this symtab, record it in the blockvector. */ if (m_pending_addrmap !=3D nullptr && m_pending_addrmap_interesting) - BLOCKVECTOR_MAP (blockvector) - =3D addrmap_create_fixed (m_pending_addrmap, &m_objfile->objfile_obs= tack); + blockvector->set_map + (addrmap_create_fixed (m_pending_addrmap, &m_objfile->objfile_obstac= k)); else - BLOCKVECTOR_MAP (blockvector) =3D 0; + blockvector->set_map (nullptr); =20 /* Some compilers output blocks in the wrong order, but we depend on their being in the right order so we can binary search. Check the diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c index c502674b1d4..57b58f38c22 100644 --- a/gdb/inline-frame.c +++ b/gdb/inline-frame.c @@ -286,11 +286,10 @@ block_starting_point_at (CORE_ADDR pc, const struct b= lock *block) const struct block *new_block; =20 bv =3D blockvector_for_pc (pc, NULL); - if (BLOCKVECTOR_MAP (bv) =3D=3D NULL) + if (bv->map () =3D=3D nullptr) return 0; =20 - new_block =3D (const struct block *) addrmap_find (BLOCKVECTOR_MAP (bv), - pc - 1); + new_block =3D (const struct block *) addrmap_find (bv->map (), pc - 1); if (new_block =3D=3D NULL) return 1; =20 diff --git a/gdb/jit.c b/gdb/jit.c index 9f2df719a8d..b4a070bb879 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -562,7 +562,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfil= e *objfile) =20 /* At the end of this function, (begin, end) will contain the PC range t= his entire blockvector spans. */ - BLOCKVECTOR_MAP (bv) =3D NULL; + bv->set_map (nullptr); begin =3D stab->blocks.front ().begin; end =3D stab->blocks.front ().end; bv->set_num_blocks (actual_nblocks); diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 0fec5231106..3f18e98710b 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -667,8 +667,8 @@ objfile_relocate1 (struct objfile *objfile, struct blockvector *bv =3D cust->blockvector (); int block_line_section =3D cust->block_line_section (); =20 - if (BLOCKVECTOR_MAP (bv)) - addrmap_relocate (BLOCKVECTOR_MAP (bv), delta[block_line_section]); + if (bv->map () !=3D nullptr) + addrmap_relocate (bv->map (), delta[block_line_section]); =20 for (block *b : bv->blocks ()) { diff --git a/gdb/symtab.c b/gdb/symtab.c index 31e7160a186..4b33d6c91af 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2987,9 +2987,9 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct ob= j_section *section) if (!in_range_p) continue; =20 - if (BLOCKVECTOR_MAP (bv)) + if (bv->map () !=3D nullptr) { - if (addrmap_find (BLOCKVECTOR_MAP (bv), pc) =3D=3D nullptr) + if (addrmap_find (bv->map (), pc) =3D=3D nullptr) continue; =20 return cust;