From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id C299D3857013 for ; Wed, 26 Oct 2022 11:57:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C299D3857013 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666785468; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H1sHMaapyJnUk4t9YwOmTeilhQDh2i0LaR1n++zMfqM=; b=YbnmB83A9rUjFTmLBEXZ+CA/TlTt8VR3ZPLbCddKg8i+NnBrv9XJf9g+2V8Dzia8kMRDV4 +n1tkbls+QnnU/cxRssPPyfvCk9uYaFzPu4M+uYaW8eYtGogimGq4aks0woiofKuA9Mgdb NbI9ZfFdUsSdM+LGDsbtFnc6SNMfcnA= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-307-dPqMOKkdO5udsD7ZhbOgog-1; Wed, 26 Oct 2022 07:57:47 -0400 X-MC-Unique: dPqMOKkdO5udsD7ZhbOgog-1 Received: by mail-ej1-f72.google.com with SMTP id qk31-20020a1709077f9f00b00791a3e02c80so4442398ejc.21 for ; Wed, 26 Oct 2022 04:57:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MkknnEbYaxZqKNYgfkxAgl3L4Yj3PmK2ctNcO/1uLeQ=; b=wMLN+GAiVTmiXLxUa0iyxyJ1F/JOuohPjLE3JQ9jDKF+zI+7Kp41f+kntFgCsJ/MeU omy3nV6aS4uHxG7usC6VCdPWzk1oP/Ixxqr9/tcEO9xSM6bfBgwXhk+AxkzG3hPkfxUj U9KMR6ozR7cEja62qdbmPAOFA0x6hima29Q+DdEPGRT+IlZ0/WyxrWyaJwT4TIQuiAT2 WXqAzVUcwCrB1O3gwYY2U1Wh8oZGz1Hnd8U3oXY+sAupdgjGwsHJO9fyJGDdynEytooS pfWCPgQMyEfnOnIEx2fC6B1qCsMkVkGpofipfZByjgx+2kssy8gn3MFc0OBrCagrkxEa TyCg== X-Gm-Message-State: ACrzQf0NFZhkJ6h3snbBl2REo6EVjx66TLARvBBZmp8bvFQGuWBg2gwS nQ6LYO5PMNseud5T7dT3K6tQLxxaRsLsLWboqZxLig53SC/JTSemli7PPJjJqR28xgpbQFu3kJh w8aEspe1LrWOx7vcNsqs2NQ== X-Received: by 2002:a17:907:74a:b0:77e:9455:b4e3 with SMTP id xc10-20020a170907074a00b0077e9455b4e3mr37779777ejb.471.1666785465778; Wed, 26 Oct 2022 04:57:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CC7p/2jsTWy0ufrlFeowuUd5eq5viGutmD8A/ZHNGzk0BwQIx06/HjqxEiATm0Hg05aRd2Q== X-Received: by 2002:a17:907:74a:b0:77e:9455:b4e3 with SMTP id xc10-20020a170907074a00b0077e9455b4e3mr37779760ejb.471.1666785465577; Wed, 26 Oct 2022 04:57:45 -0700 (PDT) Received: from [10.43.2.105] (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id d14-20020a056402144e00b0045fd8e22d9dsm3425085edx.40.2022.10.26.04.57.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Oct 2022 04:57:45 -0700 (PDT) Message-ID: <8f667a30-676f-ed43-9cd3-ce44c81f52a9@redhat.com> Date: Wed, 26 Oct 2022 13:57:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 2/2] Use enum for gdbarch's call_dummy_location To: Tom Tromey , gdb-patches@sourceware.org References: <20221018161533.3089756-1-tromey@adacore.com> <20221018161533.3089756-3-tromey@adacore.com> From: Bruno Larsen In-Reply-To: <20221018161533.3089756-3-tromey@adacore.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_INVALID,DKIM_SIGNED,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 List-Id: On 18/10/2022 18:15, Tom Tromey via Gdb-patches wrote: > This changes gdbarch to use an enum for call_dummy_location, providing > a little more type safety. No regressions introduced, and the type safety is always welcome! Reviewed-By: Bruno Larsen Cheers, Bruno > --- > 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. */ >