From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QLJ3MIgbq18AGwAAWB0awg (envelope-from ) for ; Tue, 10 Nov 2020 18:00:24 -0500 Received: by simark.ca (Postfix, from userid 112) id BBC101F08B; Tue, 10 Nov 2020 18:00:24 -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 704F81E58D for ; Tue, 10 Nov 2020 18:00:24 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2976C3857831; Tue, 10 Nov 2020 23:00:24 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id DC3793857831 for ; Tue, 10 Nov 2020 23:00:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DC3793857831 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 84EC21E58D; Tue, 10 Nov 2020 18:00:21 -0500 (EST) Subject: Re: [PATCH 7/9] Add ptype support for DWARF-based fixed-point types To: Joel Brobecker , gdb-patches@sourceware.org References: <1604817017-25807-1-git-send-email-brobecker@adacore.com> <1604817017-25807-8-git-send-email-brobecker@adacore.com> From: Simon Marchi Message-ID: <360aa942-16f6-b81d-720e-9d5897f73135@simark.ca> Date: Tue, 10 Nov 2020 18:00:21 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <1604817017-25807-8-git-send-email-brobecker@adacore.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2020-11-08 1:30 a.m., Joel Brobecker wrote: > diff --git a/gdb/testsuite/gdb.ada/fixed_points.exp b/gdb/testsuite/gdb.ada/fixed_points.exp > index 655ee95..6455d35 100644 > --- a/gdb/testsuite/gdb.ada/fixed_points.exp > +++ b/gdb/testsuite/gdb.ada/fixed_points.exp > @@ -55,8 +55,47 @@ gdb_test "ptype Overprecise_Object" \ > gdb_test "print fp1_var" \ > " = 0.25" > > +set test "ptype fp1_var" > +gdb_test_multiple "$test" $test { > + -re "type = <1-byte fixed point \\(small = 0\\.0625\\)>\r\n$gdb_prompt $" { > + pass $test > + } > + -re "type = delta 0\\.1 <'small = 0\\.0625>\r\n$gdb_prompt $" { > + # The (legacy) output we obtain when the compiler described > + # our fixed point types using the GNAT encodings rather than > + # standard DWARF. OK as well. > + pass $test > + } > +} Instead of setting a "test" variable, you can use $gdb_test_name inside gdb_test_multiple. > diff --git a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp > index 27c549c..2e72bff 100644 > --- a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp > +++ b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp > @@ -142,3 +142,47 @@ gdb_test "print pck.fp1_range_var" \ > > gdb_test "print /x pck.fp1_range_var" \ > " = 0x1" > + > +# Set the language to LANG and do a ptype test on pck__fp1_var, > +# pck__fp2_var and pck__fp3_var, verifying that the output matches > +# FP1_RE, FP2_RE, FP2_RE (resp.). > + > +proc do_ptype_test {lang fp1_re fp2_re fp3_re fp1_range_re} { > + with_test_prefix "$lang" { Suggest using with_test_prefix "lang=$lang" > + gdb_test_no_output "set language $lang" \ > + "set language to $lang for ptype test" > + > + gdb_test "ptype pck__fp1_var" $fp1_re > + > + gdb_test "ptype pck__fp2_var" $fp2_re > + > + gdb_test "ptype pck__fp3_var" $fp3_re > + > + if { $lang == "modula-2" || $lang == "pascal" } { > + setup_xfail "*-*-*" "not supported by language" > + } Can you give more details about this? What prevents these languages from printing ? I'm confused, because as far as I can tell C doesn't support range types more than these two languages, and it's able to print . > diff --git a/gdb/typeprint.h b/gdb/typeprint.h > index 8936b9a..339c746 100644 > --- a/gdb/typeprint.h > +++ b/gdb/typeprint.h > @@ -151,6 +151,8 @@ class typedef_hash_table > > void print_type_scalar (struct type * type, LONGEST, struct ui_file *); > > +void print_type_fixed_point (struct type *type, struct ui_file *stream); For new code, IWBN to follow the standard of putting the doc in the header file, even though the other functions in that file don't follow it. Simon