From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by sourceware.org (Postfix) with ESMTPS id A45FF3858C50 for ; Tue, 18 Oct 2022 16:15:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A45FF3858C50 Received: by mail-io1-xd2d.google.com with SMTP id 187so12137176iov.10 for ; Tue, 18 Oct 2022 09:15:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fmj9+5ne9T/sLbxl5NUcuQqWR8iELZ/mS/qHRGILx2o=; b=l86ClRzZQzvk5QTsOJBOSI9HHjfThYZAFS0pGd52Wegn8L0N183yskPfCjXS2CuMr6 ZK3A2t3oRYcg4t6PJDlU9ESznv9QnyNgL+cGya9EOPjwpwq2CdAtE3Fqswxo1F4UVDLx 1JFM6o9WpWZGb3hPsW3uIJ52qQLaN8o8OfZHeeP+ONjed7RxpEiRrU/98pLQTG5lMJ+5 epo0aZ03T1Zv1dt1JOU/8XYl9u/ivyQXPcm3np5XSlq8dbgJCI03XLTyYAnU50m5indV GbvNoHUUQVg4wftR9FcWrsJzxP3pPOXBwFmgjLF9tt5mTxRQWg2B9FUZwM8WXM1e4KyG 09CQ== X-Gm-Message-State: ACrzQf0hBXc3vtrzh2TuLQCkRFyBHpp6ITKMVdRwa8x49KL3sZzU/PlG jgxFgJ2bxOmdurWWJ8QXMtLYAbAJlBdKnw== X-Google-Smtp-Source: AMsMyM6Gfrz+UDkEYf6LyASpFCv1UINPYTYg+EUZn2nu+LC/c+wEQTfTwjVzS/9Rl1bTQ6dHfDosOg== X-Received: by 2002:a5d:9d88:0:b0:6bb:af14:4992 with SMTP id ay8-20020a5d9d88000000b006bbaf144992mr1999094iob.53.1666109744561; Tue, 18 Oct 2022 09:15:44 -0700 (PDT) Received: from localhost.localdomain (71-211-181-169.hlrn.qwest.net. [71.211.181.169]) by smtp.gmail.com with ESMTPSA id r11-20020a92d44b000000b002fc165318basm1123514ilm.30.2022.10.18.09.15.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Oct 2022 09:15:44 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/2] Use enum for gdbarch's call_dummy_location Date: Tue, 18 Oct 2022 10:15:33 -0600 Message-Id: <20221018161533.3089756-3-tromey@adacore.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20221018161533.3089756-1-tromey@adacore.com> References: <20221018161533.3089756-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2022 16:15:47 -0000 This changes gdbarch to use an enum for call_dummy_location, providing a little more type safety. --- 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( ) Value( - type="int", + type="enum call_dummy_location_type", name="call_dummy_location", predefault="AT_ENTRY_POINT", invalid=False, 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) (struct 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, struct 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); -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 gdbarch *gdbarch); +extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, enum call_dummy_location_type call_dummy_location); extern bool gdbarch_push_dummy_code_p (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 5545cfdad8e..6d6e61006f5 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -97,7 +97,7 @@ struct gdbarch gdbarch_dummy_id_ftype *dummy_id = default_dummy_id; int deprecated_fp_regnum = -1; gdbarch_push_dummy_call_ftype *push_dummy_call = nullptr; - int call_dummy_location = AT_ENTRY_POINT; + enum call_dummy_location_type call_dummy_location = AT_ENTRY_POINT; gdbarch_push_dummy_code_ftype *push_dummy_code = nullptr; gdbarch_code_of_frame_writable_ftype *code_of_frame_writable = default_code_of_frame_writable; gdbarch_print_registers_info_ftype *print_registers_info = default_print_registers_info; @@ -2230,7 +2230,7 @@ set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch->push_dummy_call = push_dummy_call; } -int +enum call_dummy_location_type gdbarch_call_dummy_location (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); @@ -2242,7 +2242,7 @@ gdbarch_call_dummy_location (struct gdbarch *gdbarch) 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 = 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 = const char *filename, const bfd_build_id *build_id)>; +/* Possible values for gdbarch_call_dummy_location. */ +enum call_dummy_location_type +{ + ON_STACK, + AT_ENTRY_POINT, +}; + #include "gdbarch-gen.h" /* 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 }; -/* Possible values for gdbarch_call_dummy_location. */ -#define ON_STACK 1 -#define AT_ENTRY_POINT 4 /* Base class for target-specific inferior data. */ -- 2.34.3