From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 6F0553856DE1 for ; Thu, 21 Apr 2022 14:59:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6F0553856DE1 X-ASG-Debug-ID: 1650553153-0c856e06adc5c130001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id 3WzFLiWwIBmPGnjN (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 21 Apr 2022 10:59:13 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from smarchi-efficios.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by smtp.ebox.ca (Postfix) with ESMTP id D6BA4441D6C; Thu, 21 Apr 2022 10:59:12 -0400 (EDT) From: Simon Marchi X-Barracuda-RBL-IP: 192.222.180.24 X-Barracuda-Effective-Source-IP: 192-222-180-24.qc.cable.ebox.net[192.222.180.24] X-Barracuda-Apparent-Source-IP: 192.222.180.24 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 10/14] gdb: remove BLOCK_CONTIGUOUS_P macro Date: Thu, 21 Apr 2022 10:59:06 -0400 X-ASG-Orig-Subj: [PATCH 10/14] gdb: remove BLOCK_CONTIGUOUS_P macro Message-Id: <20220421145910.15335-10-simon.marchi@efficios.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220421145910.15335-1-simon.marchi@efficios.com> References: <20220421145910.15335-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1650553153 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 3016 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.97504 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M X-Spam-Status: No, score=-3498.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2022 14:59:18 -0000 Replace with an equivalent method. Change-Id: I60fd3be7b4c2601c2a74328f635fa48ed80eb7f5 --- gdb/block.h | 14 ++++++++------ gdb/blockframe.c | 4 ++-- gdb/cli/cli-cmds.c | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gdb/block.h b/gdb/block.h index b0f1ff04ff74..96ceea23020e 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -176,6 +176,13 @@ struct block m_ranges = ranges; } + /* Are all addresses within a block contiguous? */ + + bool is_contiguous () const + { + return this->ranges ().size () == 0 || this->ranges ().size () == 1; + } + /* Addresses in the executable code that are in this block. */ CORE_ADDR m_start; @@ -224,11 +231,6 @@ struct global_block struct compunit_symtab *compunit_symtab; }; -/* Are all addresses within a block contiguous? */ - -#define BLOCK_CONTIGUOUS_P(bl) ((bl)->ranges ().size () == 0 \ - || (bl)->ranges ().size () == 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 @@ -243,7 +245,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. */ -#define BLOCK_ENTRY_PC(bl) (BLOCK_CONTIGUOUS_P (bl) \ +#define BLOCK_ENTRY_PC(bl) (bl->is_contiguous () \ ? bl->start () \ : bl->ranges ()[0].start ()) diff --git a/gdb/blockframe.c b/gdb/blockframe.c index b3265f2b032c..1b7381b5617e 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. */ - if (BLOCK_CONTIGUOUS_P (b)) + if (b->is_contiguous ()) { cache_pc_function_low = b->start (); cache_pc_function_high = b->end (); @@ -390,7 +390,7 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const char **name, const struct block *block; bool status = find_pc_partial_function (pc, name, address, endaddr, &block); - if (status && block != nullptr && !BLOCK_CONTIGUOUS_P (block)) + if (status && block != nullptr && !block->is_contiguous ()) { CORE_ADDR entry_pc = BLOCK_ENTRY_PC (block); diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 3d49166c971c..d8627680a9e3 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1428,7 +1428,7 @@ print_disassembly (struct gdbarch *gdbarch, const char *name, if (name != NULL) gdb_printf (_("for function %ps:\n"), styled_string (function_name_style.style (), name)); - if (block == nullptr || BLOCK_CONTIGUOUS_P (block)) + if (block == nullptr || block->is_contiguous ()) { if (name == NULL) gdb_printf (_("from %ps to %ps:\n"), -- 2.26.2