From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 10/14] gdb: remove BLOCK_CONTIGUOUS_P macro
Date: Thu, 21 Apr 2022 10:59:06 -0400 [thread overview]
Message-ID: <20220421145910.15335-10-simon.marchi@efficios.com> (raw)
In-Reply-To: <20220421145910.15335-1-simon.marchi@efficios.com>
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
next prev parent reply other threads:[~2022-04-21 14:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 14:58 [PATCH 01/14] gdb: remove BLOCK_{START,END} macros Simon Marchi
2022-04-21 14:58 ` [PATCH 02/14] gdb: remove BLOCK_FUNCTION macro Simon Marchi
2022-04-21 14:58 ` [PATCH 03/14] gdb: remove BLOCK_SUPERBLOCK macro Simon Marchi
2022-04-21 14:59 ` [PATCH 04/14] gdb: remove BLOCK_MULTIDICT macro Simon Marchi
2022-04-21 17:33 ` Lancelot SIX
2022-04-21 17:49 ` Simon Marchi
2022-04-21 14:59 ` [PATCH 05/14] gdb: remove BLOCK_NAMESPACE macro Simon Marchi
2022-04-21 14:59 ` [PATCH 06/14] gdb: remove BLOCK_RANGE_{START,END} macros Simon Marchi
2022-04-21 14:59 ` [PATCH 07/14] gdb: remove BLOCK_RANGES macro Simon Marchi
2022-04-21 18:16 ` Pedro Alves
2022-04-21 18:57 ` Simon Marchi
2022-04-28 10:47 ` Andrew Burgess
2022-04-21 14:59 ` [PATCH 08/14] gdb: remove BLOCK_NRANGES macro Simon Marchi
2022-04-21 17:38 ` Lancelot SIX
2022-04-21 17:52 ` Simon Marchi
2022-04-21 14:59 ` [PATCH 09/14] gdb: remove BLOCK_RANGE macro Simon Marchi
2022-04-21 14:59 ` Simon Marchi [this message]
2022-04-21 18:16 ` [PATCH 10/14] gdb: remove BLOCK_CONTIGUOUS_P macro Lancelot SIX
2022-04-21 18:59 ` Simon Marchi
2022-04-28 2:39 ` [PATCH 01/14] gdb: remove BLOCK_{START,END} macros Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220421145910.15335-10-simon.marchi@efficios.com \
--to=simon.marchi@efficios.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).