From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id 2E0F3385700E; Wed, 15 Feb 2023 21:01:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E0F3385700E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676494898; bh=zC29rRY/znFB3NhqE/nyUlRpTycEj56LMiVOUovjojQ=; h=From:To:Subject:Date:From; b=LoEs7TjhRoLfZk175jomCCeIYcJnqbe5Zb5cveyNzQpsdL6R+3jADxsKQjjbOh/qk 2e4Pf8MIJ8Ab3GK0DuhrVZmfC3cparNWAsBtukEpHNFU+YmnzK+OlUpv9iEbFEs/bw 2LAoMulMh05daBI/2Ki8m46VZMF3vyorNNA0O0Rc= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Make "ptype INTERNAL_FUNCTION" in Ada print like other languages X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: a975d4e6bcf84d3676cbc47b1c9456cf4c3a32a6 X-Git-Newrev: 751495be92b2b319fb66ce4e12b562a0e27c15fe Message-Id: <20230215210138.2E0F3385700E@sourceware.org> Date: Wed, 15 Feb 2023 21:01:38 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D751495be92b2= b319fb66ce4e12b562a0e27c15fe commit 751495be92b2b319fb66ce4e12b562a0e27c15fe Author: Pedro Alves Date: Fri Feb 10 11:55:00 2023 +0000 Make "ptype INTERNAL_FUNCTION" in Ada print like other languages =20 Currently, printing the type of an internal function in Ada shows double <>s, like: =20 (gdb) with language ada -- ptype $_isvoid type =3D <> =20 while all other languages print it with a single <>, like: =20 (gdb) with language c -- ptype $_isvoid type =3D =20 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: =20 switch (type->code ()) { default: gdb_printf (stream, "<"); c_print_type (type, "", stream, show, level, language_ada, flag= s); gdb_printf (stream, ">"); break; =20 ... and the type's name already has the <>s. =20 Fix this by simply adding an early check for TYPE_CODE_INTERNAL_FUNCTION. =20 Approved-By: Andrew Burgess Approved-By: Tom Tromey Change-Id: Ic2b6527b9240a367471431023f6e27e6daed5501 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30105 Diff: --- 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 *varstr= ing, struct ui_file *stream, int show, int level, const struct type_print_options *flags) { + if (type0->code () =3D=3D TYPE_CODE_INTERNAL_FUNCTION) + { + c_print_type (type0, "", stream, show, level, + language_ada, flags); + return; + } + struct type *type =3D 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/test= suite/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 =3D=3D "unknown"} { gdb_test "ptype \$_isvoid" \ "expression parsing not implemented for language \"Unknown\"" - } elseif {$lang =3D=3D "ada"} { - gdb_test "ptype \$_isvoid" "<>" } else { gdb_test "ptype \$_isvoid" "" }