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 8F8503856245 for ; Thu, 21 Apr 2022 14:59:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F8503856245 X-ASG-Debug-ID: 1650553152-0c856e06abc593f0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id bxZ7qw320bfap1c4 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 21 Apr 2022 10:59:12 -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 7498C441D69; 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 06/14] gdb: remove BLOCK_RANGE_{START,END} macros Date: Thu, 21 Apr 2022 10:59:02 -0400 X-ASG-Orig-Subj: [PATCH 06/14] gdb: remove BLOCK_RANGE_{START,END} macros Message-Id: <20220421145910.15335-6-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: 1650553152 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: 4883 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.97504 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 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:22 -0000 Replace with equivalent methods on blockrange. Change-Id: I20fd8f624e0129782c36768291891e7582d77c74 --- gdb/block.h | 32 ++++++++++++++++++-------------- gdb/blockframe.c | 16 ++++++++-------- gdb/cli/cli-cmds.c | 4 ++-- gdb/objfiles.c | 5 +++-- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/gdb/block.h b/gdb/block.h index 4d513782ce3f..473abde5b3d9 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -38,19 +38,31 @@ struct addrmap; struct blockrange { - blockrange (CORE_ADDR startaddr_, CORE_ADDR endaddr_) - : startaddr (startaddr_), - endaddr (endaddr_) + blockrange (CORE_ADDR start, CORE_ADDR end) + : m_start (start), + m_end (end) { } + CORE_ADDR start () const + { return m_start; } + + void set_start (CORE_ADDR start) + { m_start = start; } + + CORE_ADDR end () const + { return m_end; } + + void set_end (CORE_ADDR end) + { m_end = end; } + /* Lowest address in this range. */ - CORE_ADDR startaddr; + CORE_ADDR m_start; /* One past the highest address in the range. */ - CORE_ADDR endaddr; + CORE_ADDR m_end; }; /* Two or more non-contiguous ranges in the same order as that provided @@ -215,14 +227,6 @@ struct global_block #define BLOCK_CONTIGUOUS_P(bl) (BLOCK_RANGES (bl) == nullptr \ || BLOCK_NRANGES (bl) <= 1) -/* Obtain the start address of the Nth range for block BL. */ - -#define BLOCK_RANGE_START(bl,n) (BLOCK_RANGE (bl)[n].startaddr) - -/* Obtain the end address of the Nth range for block BL. */ - -#define BLOCK_RANGE_END(bl,n) (BLOCK_RANGE (bl)[n].endaddr) - /* 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 @@ -239,7 +243,7 @@ struct global_block #define BLOCK_ENTRY_PC(bl) (BLOCK_CONTIGUOUS_P (bl) \ ? bl->start () \ - : BLOCK_RANGE_START (bl,0)) + : BLOCK_RANGE (bl)[0].start ()) struct blockvector { diff --git a/gdb/blockframe.c b/gdb/blockframe.c index cfc4fd2fd704..e91faaa98b1b 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -286,11 +286,11 @@ find_pc_partial_function_sym (CORE_ADDR pc, int i; for (i = 0; i < BLOCK_NRANGES (b); i++) { - if (BLOCK_RANGE_START (b, i) <= mapped_pc - && mapped_pc < BLOCK_RANGE_END (b, i)) + if (BLOCK_RANGE (b)[i].start () <= mapped_pc + && mapped_pc < BLOCK_RANGE (b)[i].end ()) { - cache_pc_function_low = BLOCK_RANGE_START (b, i); - cache_pc_function_high = BLOCK_RANGE_END (b, i); + cache_pc_function_low = BLOCK_RANGE (b)[i].start (); + cache_pc_function_high = BLOCK_RANGE (b)[i].end (); break; } } @@ -396,14 +396,14 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const char **name, for (int i = 0; i < BLOCK_NRANGES (block); i++) { - if (BLOCK_RANGE_START (block, i) <= entry_pc - && entry_pc < BLOCK_RANGE_END (block, i)) + if (BLOCK_RANGE (block)[i].start () <= entry_pc + && entry_pc < BLOCK_RANGE (block)[i].end ()) { if (address != nullptr) - *address = BLOCK_RANGE_START (block, i); + *address = BLOCK_RANGE (block)[i].start (); if (endaddr != nullptr) - *endaddr = BLOCK_RANGE_END (block, i); + *endaddr = BLOCK_RANGE (block)[i].end (); return status; } diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 2b4becc97b22..f7c556a4e0cf 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1444,8 +1444,8 @@ print_disassembly (struct gdbarch *gdbarch, const char *name, { for (int i = 0; i < BLOCK_NRANGES (block); i++) { - CORE_ADDR range_low = BLOCK_RANGE_START (block, i); - CORE_ADDR range_high = BLOCK_RANGE_END (block, i); + CORE_ADDR range_low = BLOCK_RANGE (block)[i].start (); + CORE_ADDR range_high = BLOCK_RANGE (block)[i].end (); gdb_printf (_("Address range %ps to %ps:\n"), styled_string (address_style.style (), paddress (gdbarch, range_low)), diff --git a/gdb/objfiles.c b/gdb/objfiles.c index a709d947da00..9c7a30d9a60d 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -683,8 +683,9 @@ objfile_relocate1 (struct objfile *objfile, if (BLOCK_RANGES (b) != nullptr) for (int j = 0; j < BLOCK_NRANGES (b); j++) { - BLOCK_RANGE_START (b, j) += delta[block_line_section]; - BLOCK_RANGE_END (b, j) += delta[block_line_section]; + blockrange &r = BLOCK_RANGE (b)[j]; + r.set_start (r.start () + delta[block_line_section]); + r.set_end (r.end () + delta[block_line_section]); } /* We only want to iterate over the local symbols, not any -- 2.26.2