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 2DD09383FD51 for ; Tue, 6 Dec 2022 16:46:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2DD09383FD51 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=1670345163; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xlyK19W4EGYqPEJwhRwvCGKOywDNjVKZcBqPtRg9RW0=; b=U9w229II+qKDRhgPPm4cgdAbDnuxgAPzQyzyKJnJdm5VOiO98TwNsoYPm5Q9k+m+2GE4QI e+j77Z6hmLq/62A2y3BunkkAgd8zeDaKAJ893U3rlWqjGARABgPMHJyyoe6NL4Jk8oUGtm 0Zq/bFr6Mh/O8JI6MMWYcULfBQVG2sw= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-45-3ka-CkyfM52Oe9ZkuVpxlg-1; Tue, 06 Dec 2022 11:46:02 -0500 X-MC-Unique: 3ka-CkyfM52Oe9ZkuVpxlg-1 Received: by mail-wr1-f71.google.com with SMTP id h10-20020adfaa8a000000b0024208cf285eso3442235wrc.22 for ; Tue, 06 Dec 2022 08:46:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xlyK19W4EGYqPEJwhRwvCGKOywDNjVKZcBqPtRg9RW0=; b=by14Y5r9wReyXoIpfabz/wdYAmZntl9BT4Ygh7hEbStbQa4OTXME7Xyv5zc15+jBpO lxCizRtEUFOEK3WJmKv0KDaNgovcEGJllUdWZirzRJZSYuwwvvXm74H6wpeDUJYxXnXq wRBTaZ+y5OJVxqzd+gZzCxo/ZzG+irSoS+b7DXoHHhT0ROv1ioZOljySsTzaX6Y9ZQBi rpBi53b+R1ZDJ5huTbJrYmA55Pdm1ahl8l84cedvRHVeaCT/HyEwiKPcLipzESOW+DV5 zANffOBlOq4/28EwYkgilxMuCRHpTD4rJloZ5DulQvv5S0jMxeiqDMhxHLznI3mreeaj Vfnw== X-Gm-Message-State: ANoB5pmtz6FXy8aUMZXIT8NC01iVf3FdeAG+KmcIT4/F/BcbNbxHFN7Y vOJGJy2ivLOyBtX+ah0MK1DUJF7DOUH/JDwm+tj2GsK7LQg1FDun+MRE7fkdWr62kHHPnBM3ofJ 5fJuwl73i1wYMWlAPrCVaTP3AvtzAo/nAGxaJZGkvsuHGTugdDAgrWRoJehMzfvL4sU2P5OAAJA == X-Received: by 2002:adf:e7c2:0:b0:242:5cf0:8ad9 with SMTP id e2-20020adfe7c2000000b002425cf08ad9mr6914388wrn.223.1670345160636; Tue, 06 Dec 2022 08:46:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf64clH1jWZ6JbQ1MVN7LKDA9xJwmEjJthYnIyRYUyQ8D6bbsAHT+7lTfSLgRGOdBScyuQsaMw== X-Received: by 2002:adf:e7c2:0:b0:242:5cf0:8ad9 with SMTP id e2-20020adfe7c2000000b002425cf08ad9mr6914377wrn.223.1670345160386; Tue, 06 Dec 2022 08:46:00 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id l22-20020a05600c4f1600b003cf54b77bfesm28421620wmq.28.2022.12.06.08.45.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 08:46:00 -0800 (PST) From: Andrew Burgess To: Simon Marchi via Gdb-patches , gdb-patches@sourceware.org Cc: Lancelot SIX , Simon Marchi Subject: Re: [PATCH 01/12] gdb: add supports_arch_info callback to gdbarch_register In-Reply-To: <20221206135729.3937767-2-simon.marchi@efficios.com> References: <20221206135729.3937767-1-simon.marchi@efficios.com> <20221206135729.3937767-2-simon.marchi@efficios.com> Date: Tue, 06 Dec 2022 16:45:59 +0000 Message-ID: <87y1rk32go.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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: Simon Marchi via Gdb-patches writes: > From: Lancelot SIX > > In the ROCm GDB port, there are some amdgcn architectures known by BFD > that we don't actually support in GDB. We don't want > gdbarch_printable_names to return these architectures. > > gdbarch_printable_names is used for a few things: > > - completion of the "set architecture" command > - the gdb.architecture_names function in Python > - foreach-arch selftests > > Add an optional callback to gdbarch_register that is a predicate > indicating whether the gdbarch supports the given bfd_arch_info. by > default, it is nullptr, meaning that the gdbarch accepts all "mach"s for > that architecture known by BFD. LGTM. Thanks, Andrew > > Change-Id: I712f94351b0b34ed1f42e5cf7fc7ba051315d860 > Co-Authored-By: Simon Marchi > --- > gdb/arch-utils.c | 9 +++++++-- > gdb/gdbarch.h | 4 +++- > 2 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c > index 60ffdc5e16a..dbe78647d5e 100644 > --- a/gdb/arch-utils.c > +++ b/gdb/arch-utils.c > @@ -1211,6 +1211,7 @@ struct gdbarch_registration > enum bfd_architecture bfd_architecture; > gdbarch_init_ftype *init; > gdbarch_dump_tdep_ftype *dump_tdep; > + gdbarch_supports_arch_info_ftype *supports_arch_info; > struct gdbarch_list *arches; > struct gdbarch_registration *next; > }; > @@ -1234,7 +1235,9 @@ gdbarch_printable_names () > internal_error (_("gdbarch_architecture_names: multi-arch unknown")); > do > { > - arches.push_back (ap->printable_name); > + if (rego->supports_arch_info == nullptr > + || rego->supports_arch_info (ap)) > + arches.push_back (ap->printable_name); > ap = ap->next; > } > while (ap != NULL); > @@ -1247,7 +1250,8 @@ gdbarch_printable_names () > void > gdbarch_register (enum bfd_architecture bfd_architecture, > gdbarch_init_ftype *init, > - gdbarch_dump_tdep_ftype *dump_tdep) > + gdbarch_dump_tdep_ftype *dump_tdep, > + gdbarch_supports_arch_info_ftype *supports_arch_info) > { > struct gdbarch_registration **curr; > const struct bfd_arch_info *bfd_arch_info; > @@ -1280,6 +1284,7 @@ gdbarch_register (enum bfd_architecture bfd_architecture, > (*curr)->bfd_architecture = bfd_architecture; > (*curr)->init = init; > (*curr)->dump_tdep = dump_tdep; > + (*curr)->supports_arch_info = supports_arch_info; > (*curr)->arches = NULL; > (*curr)->next = NULL; > } > diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h > index f2ba5f97765..aea6c4335d9 100644 > --- a/gdb/gdbarch.h > +++ b/gdb/gdbarch.h > @@ -268,10 +268,12 @@ struct gdbarch_info > > typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches); > typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file *file); > +typedef bool (gdbarch_supports_arch_info_ftype) (const struct bfd_arch_info *); > > extern void gdbarch_register (enum bfd_architecture architecture, > gdbarch_init_ftype *init, > - gdbarch_dump_tdep_ftype *dump_tdep = nullptr); > + gdbarch_dump_tdep_ftype *dump_tdep = nullptr, > + gdbarch_supports_arch_info_ftype *supports_arch_info = nullptr); > > > /* Return a vector of the valid architecture names. Since architectures are > -- > 2.38.1