From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KEVeIOBjul/aKQAAWB0awg (envelope-from ) for ; Sun, 22 Nov 2020 08:13:04 -0500 Received: by simark.ca (Postfix, from userid 112) id 813D81F0AB; Sun, 22 Nov 2020 08:13:04 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 1E3891E58D for ; Sun, 22 Nov 2020 08:13:04 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6B93C3858009; Sun, 22 Nov 2020 13:13:03 +0000 (GMT) Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id 4CD1B3858009 for ; Sun, 22 Nov 2020 13:13:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4CD1B3858009 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=brobecke@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id F29EA1167F9; Sun, 22 Nov 2020 08:12:59 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id oK1MFZNiYGn9; Sun, 22 Nov 2020 08:12:59 -0500 (EST) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id E31AD1167EA; Sun, 22 Nov 2020 08:12:59 -0500 (EST) Received: by tron.gnat.com (Postfix, from userid 4233) id DD433CB; Sun, 22 Nov 2020 08:12:59 -0500 (EST) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFA] Add TYPE_CODE_FIXED_POINT handling in print_type_scalar Date: Sun, 22 Nov 2020 08:12:56 -0500 Message-Id: <1606050776-62740-1-git-send-email-brobecker@adacore.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <20201118034727.GF617116@adacore.com> References: <20201118034727.GF617116@adacore.com> 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: , Cc: Simon Marchi , Joel Brobecker Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hello, This commit enhances print_type_scalar to include support for TYPE_CODE_FIXED_POINT. This way, any language falling back to this function for printing the description of some types also gets basic ptype support for fixed point types as well. This fixes a couple of XFAILs in gdb.dwarf2/dw2-fixed-point.exp. gdb/ChangeLog: * typeprint.c (print_type_scalar): Add handling of TYPE_CODE_FIXED_POINT. gdb/testsuite/ChangeLog: * gdb.dwarf2/dw2-fixed-point.exp: Fix the expected output of the "ptype pck__fp1_range_var" test for the module-2 and pascal languages. Remove the associated setup_xfail. The ptype output for range types in modula-2 and pascal is a little odd (the type info is repeated twice around the ".." operator), but I guess that's how they present range types in those languages. Tested on x86_64-linux, with the 2 XFAILs replaced by PASSes and no regression. OK to push to master? Thanks, -- Joel --- gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp | 28 ++++++++++++++++++---------- gdb/typeprint.c | 4 ++++ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp index a82a9af..67d1d34 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp @@ -278,9 +278,6 @@ proc do_ptype_test {lang fp1_re fp2_re fp3_re fp1_range_re} { gdb_test "ptype pck__fp3_var" $fp3_re - if { $lang == "modula-2" || $lang == "pascal" } { - setup_xfail "*-*-*" "not supported by language" - } gdb_test "ptype pck__fp1_range_var" $fp1_range_re } } @@ -299,10 +296,21 @@ foreach lang [list "c" "d" "go" "objective-c" "opencl" ] { " = " } -foreach lang [list "fortran" "modula-2" "pascal" ] { - do_ptype_test $lang \ - " = pck__fp1_type" \ - " = pck__fp2_type" \ - " = pck__fp3_type" \ - " = " -} +do_ptype_test "fortran" \ + " = pck__fp1_type" \ + " = pck__fp2_type" \ + " = pck__fp3_type" \ + " = " + +do_ptype_test "modula-2" \ + " = pck__fp1_type" \ + " = pck__fp2_type" \ + " = pck__fp3_type" \ + " = \\\[1-byte fixed point \\(small = 1/16\\)\\.\\.1-byte fixed point \\(small = 1/16\\)\\\]" + +do_ptype_test "pascal" \ + " = pck__fp1_type" \ + " = pck__fp2_type" \ + " = pck__fp3_type" \ + " = 1-byte fixed point \\(small = 1/16\\)\\.\\.1-byte fixed point \\(small = 1/16\\)" + diff --git a/gdb/typeprint.c b/gdb/typeprint.c index a3fc9cc..47019a2 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -637,6 +637,10 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream) print_type_scalar (TYPE_TARGET_TYPE (type), val, stream); return; + case TYPE_CODE_FIXED_POINT: + print_type_fixed_point (type, stream); + break; + case TYPE_CODE_UNDEF: case TYPE_CODE_PTR: case TYPE_CODE_ARRAY: -- 2.1.4