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.133.124]) by sourceware.org (Postfix) with ESMTPS id 0571D3858D1E for ; Mon, 13 Feb 2023 16:02:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0571D3858D1E 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=1676304128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HRsUDDhpsUk03AFIKcWldM9RmwjiK1oOALZgwSEGzQ0=; b=TUYM18vT3Tae3mmlLEOWn121nMo0nJUVx2PDJdsNrcKFYg7BgPDnkQzYn/H2j0stFim7Un 21PEUG/Rfb2UC+hR4lLu4HVOe2U/C+c/pXSIYdRxFJ9v6oxFYNt7bASQcIRimTDnBE5Pm0 vRckyUYnErz6EeFBO07dCtmhuFoqupM= Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-354-aKvcvQMSNQemxOl0NBOKig-1; Mon, 13 Feb 2023 11:02:07 -0500 X-MC-Unique: aKvcvQMSNQemxOl0NBOKig-1 Received: by mail-oo1-f72.google.com with SMTP id q8-20020a4aa888000000b0051a281ad46dso4590767oom.18 for ; Mon, 13 Feb 2023 08:02:06 -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:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HRsUDDhpsUk03AFIKcWldM9RmwjiK1oOALZgwSEGzQ0=; b=foKDdJuHHdqEYqm7gmY5x2T2F1Xv2oeLYs3xynBQ1DlQ+rfLVA4PGlxnQaIhEdHJwv z0RUM6i4HuDa5YqZmWhDNEmEA97p3CNkzGVU1Jgy6LnnCMSJtm7WfK5nH9ghMi2N12XK Xw5itYrdGohONqT++IQi4kLKonzcRh2oXDFiHcD8b+Q+cWFKvU5/x01rvUAWTf1Y5QzP u+exy8gsRWWRmU4/kqupxx/Y93RRr0LKPkGQthJxi1p8NSftkTSrQpyKuH6Yh6zdcOxz x5p/JEqPfdt4FtHYMFEH7jXoB4l4BCiQVNwAx9y5hu3QK1ew/rY8NoUu1WaiFLxieJ5s kBJA== X-Gm-Message-State: AO0yUKWuJ9gXqoN66/xuQdz7vePqyNDF9osWCZQrniknegDOutl1HDaP Xhza8R5WEnX5NokZUU/vbY6fRDM70075sVx9IpwCKYFDyetYmwcY/P8wqEZ36f7E87teYy5hpI+ tzybd6adMs7vVGhM+B1ukexmwXIc= X-Received: by 2002:a05:6808:ab1:b0:364:cb7e:ca13 with SMTP id r17-20020a0568080ab100b00364cb7eca13mr11319462oij.53.1676304125750; Mon, 13 Feb 2023 08:02:05 -0800 (PST) X-Google-Smtp-Source: AK7set9Q9B3UWjKbF8xcesmLiBNMzT27szUQ/WRvl6Fgt4TZqkbwADP1dh7HCoi3MnTZPVpAKzcqLQ== X-Received: by 2002:a05:6808:ab1:b0:364:cb7e:ca13 with SMTP id r17-20020a0568080ab100b00364cb7eca13mr11319418oij.53.1676304124915; Mon, 13 Feb 2023 08:02:04 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id r142-20020a37a894000000b00729a26e836esm10060953qke.84.2023.02.13.08.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 08:02:04 -0800 (PST) From: Andrew Burgess To: Pedro Alves , gdb-patches@sourceware.org Subject: Re: [PATCH 2/6] Make "ptype INTERNAL_FUNCTION" in Ada print like other languages In-Reply-To: <20230210233604.2228450-3-pedro@palves.net> References: <20230210233604.2228450-1-pedro@palves.net> <20230210233604.2228450-3-pedro@palves.net> Date: Mon, 13 Feb 2023 16:02:02 +0000 Message-ID: <878rh1tuyt.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.6 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: Pedro Alves writes: > Currently, printing the type of an internal function in Ada shows > double <>s, like: > > (gdb) with language ada -- ptype $_isvoid > type = <> > > while all other languages print it with a single <>, like: > > (gdb) with language c -- ptype $_isvoid > type = > > I don't think there's a reason that Ada needs to be different. We > currently print the double <>s because we take this path in > ada_print_type: > > switch (type->code ()) > { > default: > gdb_printf (stream, "<"); > c_print_type (type, "", stream, show, level, language_ada, flags); > gdb_printf (stream, ">"); > break; > > ... and the type's name already has the <>s. > > Fix this by simply adding an early check for > TYPE_CODE_INTERNAL_FUNCTION. I confess, this is not the solution I though you'd go with. I was expecting you to handle TYPE_CODE_INTERNAL_FUNCTION in the switch, just to leave things consistent. I guess it doesn't hurt though, so LGTM. Thanks, Andrew > > Change-Id: Ic2b6527b9240a367471431023f6e27e6daed5501 > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30105 > --- > gdb/ada-typeprint.c | 7 +++++++ > gdb/testsuite/gdb.base/internal-functions-ptype.exp | 2 -- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c > index e95034c9285..3866b2d35eb 100644 > --- a/gdb/ada-typeprint.c > +++ b/gdb/ada-typeprint.c > @@ -941,6 +941,13 @@ ada_print_type (struct type *type0, const char *varstring, > struct ui_file *stream, int show, int level, > const struct type_print_options *flags) > { > + if (type0->code () == TYPE_CODE_INTERNAL_FUNCTION) > + { > + c_print_type (type0, "", stream, show, level, > + language_ada, flags); > + return; > + } > + > struct type *type = ada_check_typedef (ada_get_base_type (type0)); > /* If we can decode the original type name, use it. However, there > are cases where the original type is an internally-generated type > diff --git a/gdb/testsuite/gdb.base/internal-functions-ptype.exp b/gdb/testsuite/gdb.base/internal-functions-ptype.exp > index 42caae05aad..748f33a87cd 100644 > --- a/gdb/testsuite/gdb.base/internal-functions-ptype.exp > +++ b/gdb/testsuite/gdb.base/internal-functions-ptype.exp > @@ -29,8 +29,6 @@ proc test_ptype_internal_function {} { > if {$lang == "unknown"} { > gdb_test "ptype \$_isvoid" \ > "expression parsing not implemented for language \"Unknown\"" > - } elseif {$lang == "ada"} { > - gdb_test "ptype \$_isvoid" "<>" > } else { > gdb_test "ptype \$_isvoid" "" > } > -- > 2.36.0