From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 6E7623858C2C; Thu, 28 Apr 2022 02:39:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E7623858C2C 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 BLOCK_CONTIGUOUS_P macro X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 59197b8a96d69b49044d722b4bf097a9cc46a912 X-Git-Newrev: 086d03c91ec1487ed3cc96554d29b2120dd37b5b Message-Id: <20220428023953.6E7623858C2C@sourceware.org> Date: Thu, 28 Apr 2022 02:39:53 +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:39:53 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D086d03c91ec1= 487ed3cc96554d29b2120dd37b5b commit 086d03c91ec1487ed3cc96554d29b2120dd37b5b Author: Simon Marchi Date: Sun Feb 6 22:38:14 2022 -0500 gdb: remove BLOCK_CONTIGUOUS_P macro =20 Replace with an equivalent method. =20 Change-Id: I60fd3be7b4c2601c2a74328f635fa48ed80eb7f5 Diff: --- gdb/block.h | 11 +++++------ gdb/blockframe.c | 4 ++-- gdb/cli/cli-cmds.c | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gdb/block.h b/gdb/block.h index eb77f746037..80b0616116d 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -167,6 +167,10 @@ struct block void set_ranges (blockranges *ranges) { m_ranges =3D ranges; } =20 + /* Return true if all addresses within this block are contiguous. */ + bool is_contiguous () const + { return this->ranges ().size () <=3D 1; } + /* Addresses in the executable code that are in this block. */ =20 CORE_ADDR m_start; @@ -215,11 +219,6 @@ struct global_block struct compunit_symtab *compunit_symtab; }; =20 -/* Are all addresses within a block contiguous? */ - -#define BLOCK_CONTIGUOUS_P(bl) ((bl)->ranges ().size () =3D=3D 0 \ - || (bl)->ranges ().size () =3D=3D 1) - /* Define the "entry pc" for a block BL to be the lowest (start) address for the block when all addresses within the block are contiguous. If non-contiguous, then use the start address for the first range in the @@ -234,7 +233,7 @@ struct global_block the entry_pc field can be set from the dwarf reader (and other readers too). BLOCK_ENTRY_PC can then be redefined to be less DWARF-centric. = */ =20 -#define BLOCK_ENTRY_PC(bl) (BLOCK_CONTIGUOUS_P (bl) \ +#define BLOCK_ENTRY_PC(bl) (bl->is_contiguous () \ ? bl->start () \ : bl->ranges ()[0].start ()) =20 diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 78c9daabf23..694cd047c75 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -276,7 +276,7 @@ find_pc_partial_function_sym (CORE_ADDR pc, comment preceding declaration of find_pc_partial_function in symtab.h for more information. */ =20 - if (BLOCK_CONTIGUOUS_P (b)) + if (b->is_contiguous ()) { cache_pc_function_low =3D b->start (); cache_pc_function_high =3D b->end (); @@ -390,7 +390,7 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const = char **name, const struct block *block; bool status =3D find_pc_partial_function (pc, name, address, endaddr, &b= lock); =20 - if (status && block !=3D nullptr && !BLOCK_CONTIGUOUS_P (block)) + if (status && block !=3D nullptr && !block->is_contiguous ()) { CORE_ADDR entry_pc =3D BLOCK_ENTRY_PC (block); =20 diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 7a6a8ea20a1..31911ebe61f 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1428,7 +1428,7 @@ print_disassembly (struct gdbarch *gdbarch, const cha= r *name, if (name !=3D NULL) gdb_printf (_("for function %ps:\n"), styled_string (function_name_style.style (), name)); - if (block =3D=3D nullptr || BLOCK_CONTIGUOUS_P (block)) + if (block =3D=3D nullptr || block->is_contiguous ()) { if (name =3D=3D NULL) gdb_printf (_("from %ps to %ps:\n"),