From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 1/2] gdb/gdbarch: remove the predicate function for gdbarch_register_type
Date: Thu, 10 Mar 2022 13:31:23 +0000 [thread overview]
Message-ID: <e7bda06f4dffabacbbacf75ca771f1ea86de373e.1646918997.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1646918997.git.aburgess@redhat.com>
I don't believe that the gdbarch_register_type_p predicate is called
anywhere in GDB, and the gdbarch_register_type function is called
without checking the gdbarch_register_type_p predicate function
everywhere it is used, for example in
init_regcache_descr (regcache.c).
My claim is that the gdbarch_register_type function is required for
every architecture, and GDB will not work if this function is not
supplied.
And so, in this commit, I remove the 'predicate=True' from
gdbarch-components.py for the 'register_type' field, and regenerate
the gdbarch files.
There should be no user visible changes after this commit.
---
gdb/gdbarch-components.py | 1 -
gdb/gdbarch-gen.h | 2 --
gdb/gdbarch.c | 11 -----------
3 files changed, 14 deletions(-)
diff --git a/gdb/gdbarch-components.py b/gdb/gdbarch-components.py
index bc09d35f9de..aa0b3682593 100644
--- a/gdb/gdbarch-components.py
+++ b/gdb/gdbarch-components.py
@@ -574,7 +574,6 @@ use "register_type".
type="struct type *",
name="register_type",
params=[("int", "reg_nr")],
- predicate=True,
invalid=True,
)
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index b7beb73d36d..7a8721328ab 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -296,8 +296,6 @@ extern void set_gdbarch_register_name (struct gdbarch *gdbarch, gdbarch_register
the register cache should call this function directly; others should
use "register_type". */
-extern bool gdbarch_register_type_p (struct gdbarch *gdbarch);
-
typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, int reg_nr);
extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr);
extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 55dd602b27f..28e1fbc2c71 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -443,7 +443,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */
if (gdbarch->register_name == 0)
log.puts ("\n\tregister_name");
- /* Skip verify of register_type, has predicate. */
/* Skip verify of dummy_id, invalid_p == 0 */
/* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
/* Skip verify of push_dummy_call, has predicate. */
@@ -780,9 +779,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
fprintf_filtered (file,
"gdbarch_dump: register_name = <%s>\n",
host_address_to_string (gdbarch->register_name));
- fprintf_filtered (file,
- "gdbarch_dump: gdbarch_register_type_p() = %d\n",
- gdbarch_register_type_p (gdbarch));
fprintf_filtered (file,
"gdbarch_dump: register_type = <%s>\n",
host_address_to_string (gdbarch->register_type));
@@ -2219,13 +2215,6 @@ set_gdbarch_register_name (struct gdbarch *gdbarch,
gdbarch->register_name = register_name;
}
-bool
-gdbarch_register_type_p (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- return gdbarch->register_type != NULL;
-}
-
struct type *
gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr)
{
--
2.25.4
next prev parent reply other threads:[~2022-03-10 13:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 13:31 [PATCH 0/2] Some changes to the gdbarch*.py scripts Andrew Burgess
2022-03-10 13:31 ` Andrew Burgess [this message]
2022-03-10 17:06 ` [PATCH 1/2] gdb/gdbarch: remove the predicate function for gdbarch_register_type Tom Tromey
2022-03-10 13:31 ` [PATCH 2/2] gdb/gdbarch: compare some fields against 0 verify_gdbarch Andrew Burgess
2022-03-10 17:09 ` Tom Tromey
2022-03-14 14:10 ` Andrew Burgess
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=e7bda06f4dffabacbbacf75ca771f1ea86de373e.1646918997.git.aburgess@redhat.com \
--to=aburgess@redhat.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).