From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id CFB563857829; Mon, 14 Mar 2022 14:08:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CFB563857829 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/gdbarch: remove the predicate function for gdbarch_register_type X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: fb85cece22a2cb3c0185e61cfc1323e9c5a6466e X-Git-Newrev: 23bade95de322dead7fbd33368dce271c2911773 Message-Id: <20220314140821.CFB563857829@sourceware.org> Date: Mon, 14 Mar 2022 14:08:21 +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: Mon, 14 Mar 2022 14:08:21 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D23bade95de32= 2dead7fbd33368dce271c2911773 commit 23bade95de322dead7fbd33368dce271c2911773 Author: Andrew Burgess Date: Thu Mar 10 10:57:18 2022 +0000 gdb/gdbarch: remove the predicate function for gdbarch_register_type =20 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). =20 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. =20 And so, in this commit, I remove the 'predicate=3DTrue' from gdbarch-components.py for the 'register_type' field, and regenerate the gdbarch files. =20 There should be no user visible changes after this commit. Diff: --- 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=3D"struct type *", name=3D"register_type", params=3D[("int", "reg_nr")], - predicate=3DTrue, invalid=3DTrue, ) =20 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". */ =20 -extern bool gdbarch_register_type_p (struct gdbarch *gdbarch); - typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbar= ch, int reg_nr); extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int r= eg_nr); extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_re= gister_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 =3D=3D 0 */ if (gdbarch->register_name =3D=3D 0) log.puts ("\n\tregister_name"); - /* Skip verify of register_type, has predicate. */ /* Skip verify of dummy_id, invalid_p =3D=3D 0 */ /* Skip verify of deprecated_fp_regnum, invalid_p =3D=3D 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 =3D <%s>\n", host_address_to_string (gdbarch->register_name)); - fprintf_filtered (file, - "gdbarch_dump: gdbarch_register_type_p() =3D %d\n", - gdbarch_register_type_p (gdbarch)); fprintf_filtered (file, "gdbarch_dump: register_type =3D <%s>\n", host_address_to_string (gdbarch->register_type)); @@ -2219,13 +2215,6 @@ set_gdbarch_register_name (struct gdbarch *gdbarch, gdbarch->register_name =3D register_name; } =20 -bool -gdbarch_register_type_p (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch !=3D NULL); - return gdbarch->register_type !=3D NULL; -} - struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr) {