From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 1164C3853835; Mon, 31 Oct 2022 15:08:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1164C3853835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667228905; bh=p/DAQELr3A39/V9J01Xw4mLEX0pFyUnkJLcK23vlX0k=; h=From:To:Subject:Date:From; b=PnnEAPephq4Vgd/TLJVrJ9noh1XfyqPvqMQlhXNz6cDVeF/JtxLchWhX84hJ+xAtz CpsH3Z5MSSw3gupZpVzRROdso2P0+Q4wyDl1G65GiGk/h15Ld5IdWjw47rdZlkmXGE 01Ni5SDGlbEu1T2YTR0NuPM0SWT+PnyiJibsSOPI= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Use enum for gdbarch's call_dummy_location X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 6c8912c64bcbfd109af0500577409690074e9d27 X-Git-Newrev: 7807dfae36d5c0435ac58711a5028f217800db60 Message-Id: <20221031150825.1164C3853835@sourceware.org> Date: Mon, 31 Oct 2022 15:08:24 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7807dfae36d5= c0435ac58711a5028f217800db60 commit 7807dfae36d5c0435ac58711a5028f217800db60 Author: Tom Tromey Date: Mon Sep 12 07:04:21 2022 -0600 Use enum for gdbarch's call_dummy_location =20 This changes gdbarch to use an enum for call_dummy_location, providing a little more type safety. Diff: --- gdb/gdbarch-components.py | 2 +- gdb/gdbarch-gen.h | 4 ++-- gdb/gdbarch.c | 6 +++--- gdb/gdbarch.h | 7 +++++++ gdb/inferior.h | 3 --- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/gdb/gdbarch-components.py b/gdb/gdbarch-components.py index c997a709cbb..b2c7b784761 100644 --- a/gdb/gdbarch-components.py +++ b/gdb/gdbarch-components.py @@ -647,7 +647,7 @@ Method( ) =20 Value( - type=3D"int", + type=3D"enum call_dummy_location_type", name=3D"call_dummy_location", predefault=3D"AT_ENTRY_POINT", invalid=3DFalse, diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h index 840de585869..e0d7a08ff6a 100644 --- a/gdb/gdbarch-gen.h +++ b/gdb/gdbarch-gen.h @@ -331,8 +331,8 @@ typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (stru= ct gdbarch *gdbarch, stru extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct = value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, s= truct value **args, CORE_ADDR sp, function_call_return_method return_method= , CORE_ADDR struct_addr); extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_= push_dummy_call_ftype *push_dummy_call); =20 -extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch); -extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int = call_dummy_location); +extern enum call_dummy_location_type gdbarch_call_dummy_location (struct g= dbarch *gdbarch); +extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, enum= call_dummy_location_type call_dummy_location); =20 extern bool gdbarch_push_dummy_code_p (struct gdbarch *gdbarch); =20 diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 6ff4fee5b3f..9d929da6da9 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -97,7 +97,7 @@ struct gdbarch gdbarch_dummy_id_ftype *dummy_id =3D default_dummy_id; int deprecated_fp_regnum =3D -1; gdbarch_push_dummy_call_ftype *push_dummy_call =3D nullptr; - int call_dummy_location =3D AT_ENTRY_POINT; + enum call_dummy_location_type call_dummy_location =3D AT_ENTRY_POINT; gdbarch_push_dummy_code_ftype *push_dummy_code =3D nullptr; gdbarch_code_of_frame_writable_ftype *code_of_frame_writable =3D default= _code_of_frame_writable; gdbarch_print_registers_info_ftype *print_registers_info =3D default_pri= nt_registers_info; @@ -2229,7 +2229,7 @@ set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch->push_dummy_call =3D push_dummy_call; } =20 -int +enum call_dummy_location_type gdbarch_call_dummy_location (struct gdbarch *gdbarch) { gdb_assert (gdbarch !=3D NULL); @@ -2241,7 +2241,7 @@ gdbarch_call_dummy_location (struct gdbarch *gdbarch) =20 void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, - int call_dummy_location) + enum call_dummy_location_type call_dummy_= location) { gdbarch->call_dummy_location =3D call_dummy_location; } diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 2f1c7399d78..f2ba5f97765 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -149,6 +149,13 @@ using read_core_file_mappings_loop_ftype =3D const char *filename, const bfd_build_id *build_id)>; =20 +/* Possible values for gdbarch_call_dummy_location. */ +enum call_dummy_location_type +{ + ON_STACK, + AT_ENTRY_POINT, +}; + #include "gdbarch-gen.h" =20 /* An internal function that should _only_ be called from gdbarch_tdep. diff --git a/gdb/inferior.h b/gdb/inferior.h index 8877be38e36..69525a2e053 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -282,9 +282,6 @@ enum stop_kind }; =20 =0C -/* Possible values for gdbarch_call_dummy_location. */ -#define ON_STACK 1 -#define AT_ENTRY_POINT 4 =20 /* Base class for target-specific inferior data. */