From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 2A9CF3857C49; Thu, 28 Apr 2022 02:39:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A9CF3857C49 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_RANGE_{START,END} macros X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 3fe38936f6c0fe5d724806a1646fb7b67638b420 X-Git-Newrev: 6dd5a4bd44b7b7d2daf195dd5e48faeaf7231c17 Message-Id: <20220428023933.2A9CF3857C49@sourceware.org> Date: Thu, 28 Apr 2022 02:39:33 +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:33 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D6dd5a4bd44b7= b7d2daf195dd5e48faeaf7231c17 commit 6dd5a4bd44b7b7d2daf195dd5e48faeaf7231c17 Author: Simon Marchi Date: Sun Feb 6 22:21:21 2022 -0500 gdb: remove BLOCK_RANGE_{START,END} macros =20 Replace with equivalent methods on blockrange. =20 Change-Id: I20fd8f624e0129782c36768291891e7582d77c74 Diff: --- gdb/block.h | 36 ++++++++++++++++++++++-------------- gdb/blockframe.c | 16 ++++++++-------- gdb/cli/cli-cmds.c | 4 ++-- gdb/objfiles.c | 5 +++-- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/gdb/block.h b/gdb/block.h index 2f71f3c8b21..60e53c641a2 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -38,19 +38,35 @@ struct addrmap; =20 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) { } =20 + /* Return this blockrange's start address. */ + CORE_ADDR start () const + { return m_start; } + + /* Set this blockrange's start address. */ + void set_start (CORE_ADDR start) + { m_start =3D start; } + + /* Return this blockrange's end address. */ + CORE_ADDR end () const + { return m_end; } + + /* Set this blockrange's end address. */ + void set_end (CORE_ADDR end) + { m_end =3D end; } + /* Lowest address in this range. */ =20 - CORE_ADDR startaddr; + CORE_ADDR m_start; =20 /* One past the highest address in the range. */ =20 - CORE_ADDR endaddr; + CORE_ADDR m_end; }; =20 /* Two or more non-contiguous ranges in the same order as that provided @@ -203,14 +219,6 @@ struct global_block #define BLOCK_CONTIGUOUS_P(bl) (BLOCK_RANGES (bl) =3D=3D nullptr \ || BLOCK_NRANGES (bl) <=3D 1) =20 -/* 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 @@ -227,7 +235,7 @@ struct global_block =20 #define BLOCK_ENTRY_PC(bl) (BLOCK_CONTIGUOUS_P (bl) \ ? bl->start () \ - : BLOCK_RANGE_START (bl,0)) + : BLOCK_RANGE (bl)[0].start ()) =20 struct blockvector { diff --git a/gdb/blockframe.c b/gdb/blockframe.c index cfc4fd2fd70..e91faaa98b1 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 =3D 0; i < BLOCK_NRANGES (b); i++) { - if (BLOCK_RANGE_START (b, i) <=3D mapped_pc - && mapped_pc < BLOCK_RANGE_END (b, i)) + if (BLOCK_RANGE (b)[i].start () <=3D mapped_pc + && mapped_pc < BLOCK_RANGE (b)[i].end ()) { - cache_pc_function_low =3D BLOCK_RANGE_START (b, i); - cache_pc_function_high =3D BLOCK_RANGE_END (b, i); + cache_pc_function_low =3D BLOCK_RANGE (b)[i].start (); + cache_pc_function_high =3D BLOCK_RANGE (b)[i].end (); break; } } @@ -396,14 +396,14 @@ find_function_entry_range_from_pc (CORE_ADDR pc, cons= t char **name, =20 for (int i =3D 0; i < BLOCK_NRANGES (block); i++) { - if (BLOCK_RANGE_START (block, i) <=3D entry_pc - && entry_pc < BLOCK_RANGE_END (block, i)) + if (BLOCK_RANGE (block)[i].start () <=3D entry_pc + && entry_pc < BLOCK_RANGE (block)[i].end ()) { if (address !=3D nullptr) - *address =3D BLOCK_RANGE_START (block, i); + *address =3D BLOCK_RANGE (block)[i].start (); =20 if (endaddr !=3D nullptr) - *endaddr =3D BLOCK_RANGE_END (block, i); + *endaddr =3D BLOCK_RANGE (block)[i].end (); =20 return status; } diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 2b4becc97b2..f7c556a4e0c 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1444,8 +1444,8 @@ print_disassembly (struct gdbarch *gdbarch, const cha= r *name, { for (int i =3D 0; i < BLOCK_NRANGES (block); i++) { - CORE_ADDR range_low =3D BLOCK_RANGE_START (block, i); - CORE_ADDR range_high =3D BLOCK_RANGE_END (block, i); + CORE_ADDR range_low =3D BLOCK_RANGE (block)[i].start (); + CORE_ADDR range_high =3D 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 a709d947da0..9c7a30d9a60 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -683,8 +683,9 @@ objfile_relocate1 (struct objfile *objfile, if (BLOCK_RANGES (b) !=3D nullptr) for (int j =3D 0; j < BLOCK_NRANGES (b); j++) { - BLOCK_RANGE_START (b, j) +=3D delta[block_line_section]; - BLOCK_RANGE_END (b, j) +=3D delta[block_line_section]; + blockrange &r =3D BLOCK_RANGE (b)[j]; + r.set_start (r.start () + delta[block_line_section]); + r.set_end (r.end () + delta[block_line_section]); } =20 /* We only want to iterate over the local symbols, not any