From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7192 invoked by alias); 20 Nov 2017 17:01:58 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 7178 invoked by uid 89); 20 Nov 2017 17:01:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: sessmg23.ericsson.net Received: from sessmg23.ericsson.net (HELO sessmg23.ericsson.net) (193.180.251.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Nov 2017 17:01:56 +0000 Received: from ESESSHC007.ericsson.se (Unknown_Domain [153.88.183.39]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 34.16.07741.18A031A5; Mon, 20 Nov 2017 18:01:53 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.39) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 20 Nov 2017 18:01:52 +0100 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from [142.133.48.38] (192.75.88.130) by DBXPR07MB318.eurprd07.prod.outlook.com (2a01:111:e400:941d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.2; Mon, 20 Nov 2017 17:01:49 +0000 Subject: Re: [PATCH] Fix type casts losing typedefs and reimplement "whatis" typedef stripping To: Pedro Alves , Simon Marchi , Yao Qi CC: GDB Patches , Phil Muldoon References: <1498837699-20897-1-git-send-email-palves@redhat.com> <5225ca30-ef69-040d-3f96-be2e5e87b80b@redhat.com> <4b73fb98-b8c2-9d2f-1981-4660e3c202e6@simark.ca> <67474590-af49-a387-9f8b-044bdd689dc7@redhat.com> From: Simon Marchi Message-ID: Date: Mon, 20 Nov 2017 17:01:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <67474590-af49-a387-9f8b-044bdd689dc7@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DM5PR21CA0053.namprd21.prod.outlook.com (2603:10b6:3:129::15) To DBXPR07MB318.eurprd07.prod.outlook.com (2a01:111:e400:941d::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a826cc24-2ee8-46d6-6df7-08d530386484 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199);SRVR:DBXPR07MB318; X-Microsoft-Exchange-Diagnostics: 1;DBXPR07MB318;3:M2QNJU25ESRVYjqkemuCyOcUnJFvGl6AltSzBCl2mPH2LY5AcK81J1Uxv/nFm6pMmkRX6FQsgvsTYw0Cg9s58hteO7e2RnXDW7XbAtrMluD5AvER0rDz8gHrz4kZ4qC7OEE8VV4SN5+kIjjmump76yGkm+7cISN2tUlaqVIR10E8YZkkz3t4qoBytCukFuWCieD3QgvpXitadO2A6S/B94SQH426lxBn0QQpK4ULyjBJUWZLdRvGgxaolarrJyRu;25:gAvwH9X1y67lX3FRerGXmZDzKi3QpdJOvqraxPGuQ/WeYcK6AJHy8AmFvOefd/FrzkiEPHVenxhyHn1DBoeV2SmhMLwA4hPj/4OUSeLZ6R2fl3b4NJnP3awYZ+P8+qyPg/Mco7KWX78NE5AfXyKC4k9b2S4wC1DZNiyLN8oaYGHUUrVUHFN375+zlDa90oPeo58P6Xvil3aAzVrAuEipCBXv11W/+TxjcfdVYWFt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S8FeyQ6A0aaIv5RgJOd9j2h1LY5VvA1KGpCrzVLk2BFnGEG+aBV+KTnVByrdeAfHP7TAMdFidJdaz16pctIKhon+P9NHlmzir8ZvHBufPmb6OoZmoNgIqJk5nkEXPx87siqYgXRirJdjnA0Q/YEJaYvQFjM3gxWuidmqgxzxcCvavFMl1T78Zpm4cossSCxsUOBnkYO5N2tK6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(166708455590820); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(3231022)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123555025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DBXPR07MB318;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DBXPR07MB318; X-Forefront-PRVS: 04976078F0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(6049001)(346002)(39860400002)(376002)(24454002)(377424004)(52314003)(199003)(189002)(5660300001)(65826007)(6486002)(31686004)(229853002)(25786009)(105586002)(106356001)(2950100002)(2906002)(33646002)(97736004)(53936002)(68736007)(39060400002)(4326008)(65806001)(65956001)(47776003)(66066001)(23676003)(4001150100001)(83506002)(6306002)(6246003)(16526018)(6666003)(54906003)(110136005)(93886005)(8936002)(16576012)(58126008)(53546010)(316002)(966005)(3846002)(230700001)(6116002)(36756003)(189998001)(305945005)(7736002)(50466002)(76176999)(478600001)(81156014)(8676002)(64126003)(81166006)(86362001)(101416001)(50986999)(54356999)(49976008)(31696002)(78286006)(168613001);DIR:OUT;SFP:1101;SCL:1;SRVR:DBXPR07MB318;H:[142.133.48.38];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQlhQUjA3TUIzMTg7MjM6ZXR0TE9ZMnJ2YVdMaGJ0UTk4NXg3STN5ZXI4?= =?utf-8?B?VFBxWlZoS1hSZk9vMlEvZ1ZhZ09MemVmTDdBVjNZY3JXVjkzeFZrbjZzVERh?= =?utf-8?B?cDFSZ2RXakFBMVdLNUJoRmM5b3MyOTBOUldrNldDMGNSb2JiNE11VDJnWDBD?= =?utf-8?B?NmJIdnIzWXB2UGo1VHpoSytOMXBKMFRsSkxLc1pzbXZRUy9HeVViZ0R4c1lz?= =?utf-8?B?OUdzVFFTZVNUZmVWZnZnaExCT0JTaFdWb3hWd3hwQWNIcGYvWC9ZQmtnUWdR?= =?utf-8?B?dVJuNXl4dnNqWkw5WEx4MmtHQ2ZpZUY1Q25OMnE3Q3BoY3E2Y2dYV290U3Rv?= =?utf-8?B?OGRnbjFWTWd1czFteXA1K0JsMVNYWUdUOExqWFVud0lxOWZlREMvVzVxVHVm?= =?utf-8?B?cDNjQWJCc296T09Qa0E2WU01ODQyUjVOQXdiTTFrTnd5UnRySjhVWEpla01G?= =?utf-8?B?c3crUHBBVVR6eG1NTFRvWVB4bFpIdTZTdDBKSExodnJYcUlPcEZIa09KZFIr?= =?utf-8?B?bi9YN2VmU2tUdkhlRlFvWUZsTCtpSEc0bG14N0xXTU9KdFExS09UcFNya0dt?= =?utf-8?B?Z3BDUE1FTDRGenJsQnJSOUtySnY2N3NVc25hc0hqLzZmUUNXQVlmM1F0SFFW?= =?utf-8?B?QWtjekxWbjlObUpmeW9lazg5OHRQTGcvdWNNeEt1VTZKRlBuU21IdTh3UWNH?= =?utf-8?B?OERENXFoc1A5SFlQNWxEeUdacXpqdVhRMmk3bDg3bFczb2hhZjBiMWlzRm9l?= =?utf-8?B?ejgyaUZ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0PGCv8o/4WiM9oTsEcRpXD92QrQ1St9uzLWcvXZsIHM+NoQ=;24:V+yn5iGXPC0iCT7x4jTyLW70fS76lWLH0x9qWFd/JvjuPFJ0g1u4Od2qj9Q6ND6NTrD+piLWKZpBojHiUsECxY5NDtsgWv6ocJMj4fM+Wlc=;7:ef97mTd8AcwztPhdewLrLTABdBaNywQMFrtqY9YVHlfTgcXVIjBmPMqvrbXR9JeINSmUpKWnYP+xe3DkIN2WnaKknp15qxQ8RYNInESteYdivWqBraYVUxKYjUIO5r6jbZ5C11IOuuDApdlLn5EeswiSzE3/psyF4FKaRyK0DjhbEnKvl1IvuLh1NNeObksbzHDZr/sSo19t1hYy+8Tag826BUJSYJbevJlk+XLB3bOyxQ+fXExa79fCt5SI4FqY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2017 17:01:49.5651 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a826cc24-2ee8-46d6-6df7-08d530386484 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBXPR07MB318 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg00420.txt.bz2 On 2017-11-20 11:42 AM, Pedro Alves wrote: > On 11/18/2017 10:58 PM, Simon Marchi wrote: >> On 2017-11-18 03:57 PM, Yao Qi wrote: >>> On Mon, Aug 21, 2017 at 11:38 AM, Pedro Alves wrote: >>> >>> Hi Pedro, >>> The new tests in gdb.base/whatis-ptype-typedefs.exp fail on 32-bit target. >>> >>> https://gdb-build.sergiodj.net/builders/Ubuntu-AArch32-m32/builds/1175/steps/test%20gdb/logs/stdio >>> https://gdb-build.sergiodj.net/builders/Fedora-i686/builds/6867/steps/test%20gdb/logs/stdio >>> https://gdb-build.sergiodj.net/builders/Fedora-x86_64-m32/builds/6849/steps/test%20gdb/logs/stdio >>> >>> Can you take a look? >>> >> >> I took a quick look. The issue (at least one of them) boils down to the fact >> that on 64 bits, you can't do this: >> >> (gdb) p (float_typedef) v_uchar_array_t_struct_typedef >> Invalid cast. >> >> but on 32 bits you can: >> >> (gdb) p (float_typedef) v_uchar_array_t_struct_typedef >> $1 = 1.16251721e-41 >> >> The expression basically tries to cast an array (which decays to a pointer) to >> a float. The cast works on 32 bits (doesn't give Invalid cast) because a float >> and a pointer are of the same size, and the execution enters this if branch: >> >> https://github.com/bminor/binutils-gdb/blob/master/gdb/valops.c#L554 >> >> On 64 bits, they are not the same size, so it ends up in the invalid cast >> branch. >> >> I don't really know what to do from there. Should we leave the behavior as-is >> and update the test, or prevent this kind of cast (the compiler doesn't accept >> that anyway, and I don't see any real use case to this). This function (value_cast) >> is a bit convoluted, I'm always afraid to touch it... > > I'm not 100% sure either. value_cast is documented as: > ~~~ > More general than a C cast: accepts any two types of the same length, > and if ARG2 is an lvalue it can be cast into anything at all. */ > ~~~ > > and I've found this useful on several occasions (though for me it's > usually more around converting an object to some structure). > > The point of the test was to cover as many of code paths in > value_cast as possible, as a sort of documentation of the current > behavior: > > > # The main idea here is testing all the different paths in the > # value casting code in GDB (value_cast), making sure typedefs are > # preserved. > ... > # We try all combinations, even those that don't > # parse, or are invalid, to catch the case of a > # regression making them inadvertently valid. For > # example, these convertions are invalid: > ... > > So in that spirit, I propose starting my making the testcase adjust > itself, like below, and also test floats of different sizes, leaving > changing GDB's behavior for a separate consideration/change (using > the fixed/extended test as baseline). That's fine with me, it's strange at first that it works on an architecture but not the other, but it makes sense when you know why. > > This passes on x86 both 64-bit and 32-bit. > > From 1a02eedaadcb7b62a5990f5838952b0600d4a8cc Mon Sep 17 00:00:00 2001 > From: Pedro Alves > Date: Mon, 20 Nov 2017 16:39:58 +0000 > Subject: [PATCH] fix > > --- > gdb/testsuite/gdb.base/whatis-ptype-typedefs.c | 10 +++++++ > gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp | 37 ++++++++++++++++++++++-- > 2 files changed, 44 insertions(+), 3 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.c b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.c > index 5711a96..35c7279 100644 > --- a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.c > +++ b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.c > @@ -56,6 +56,16 @@ DEF (int); > typedef float float_typedef; > DEF (float); > > +/* Double floats. */ > + > +typedef double double_typedef; > +DEF (double); > + > +/* Long doubles. */ > + > +typedef long double long_double_typedef; > +DEF (long_double); > + > /* Enums. */ > > typedef enum colors {red, green, blue} colors_typedef; > diff --git a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > index d333d81..c8fa2bd 100644 > --- a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > +++ b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > @@ -92,6 +92,16 @@ set table { > {"v_float_typedef" "float_typedef" "float"} > {"v_float_typedef2" "float_typedef2" "float"} > > + {"double_typedef" "double" "double"} > + {"double_typedef2" "double_typedef" "double"} > + {"v_double_typedef" "double_typedef" "double"} > + {"v_double_typedef2" "double_typedef2" "double"} > + > + {"long_double_typedef" "long double" "long double"} > + {"long_double_typedef2" "long_double_typedef" "long double"} > + {"v_long_double_typedef" "long_double_typedef" "long double"} > + {"v_long_double_typedef2" "long_double_typedef2" "long double"} > + > {"colors_typedef" "(enum )?colors" "enum colors( : unsigned int)? {red, green, blue}"} > {"colors_typedef2" "colors_typedef" "enum colors( : unsigned int)? {red, green, blue}"} > {"v_colors_typedef" "colors_typedef" "enum colors( : unsigned int)? {red, green, blue}"} > @@ -199,6 +209,20 @@ proc run_tests {lang} { > } > } > > + # If floats and pointers have he same on this architecture, then This sentence weird. > + # casting from array/function to float works, because > + # arrays/functions first decay to pointers, and then GDB's cast is > + # more general than a C cast and accepts any two types of the same > + # length. > + set float_ptr_same_size \ > + [get_integer_valueof "sizeof (float) == sizeof (void *)" -1] > + > + set double_ptr_same_size \ > + [get_integer_valueof "sizeof (double) == sizeof (void *)" -1] > + > + set long_double_ptr_same_size \ > + [get_integer_valueof "sizeof (long double) == sizeof (void *)" -1] > + > # Test converting/casting all variables in the first column of the > # table to all types (found in the first column of the table). > # The aggregates are all defined to be the same size so that > @@ -230,7 +254,7 @@ proc run_tests {lang} { > # regression making them inadvertently valid. For > # example, these convertions are invalid: Not in this patch, but "convertions". > # > - # float <-> array > + # float <-> array [iff sizeof pointer != sizeof float] > # array -> function (not function pointer) > # array -> member_ptr > # > @@ -247,8 +271,15 @@ proc run_tests {lang} { > gdb_test "whatis ($to) $from" "syntax error.*" "whatis ($to) $from (syntax)" > gdb_test "ptype ($to) $from" "syntax error.*" "ptype ($to) $from (syntax)" > } elseif {([string match "*float*" $from] && [string match "*array*" $to]) > - || ([string match "float*" $to] && [string match "*array*" $from]) > - || ([string match "float*" $to] && [string match "*method" $from]) > + || (!$float_ptr_same_size > + && ([string match "float*" $to] && [string match "*array*" $from] > + || [string match "float*" $to] && [string match "*method" $from])) > + || (!$double_ptr_same_size > + && ([string match "double*" $to] && [string match "*array*" $from] > + || [string match "double*" $to] && [string match "*method" $from])) > + || (!$long_double_ptr_same_size > + && ([string match "long_double*" $to] && [string match "*array*" $from] > + || [string match "long_double*" $to] && [string match "*method" $from])) > || ([string match "*ftype" $to] && [string match "*array*" $from]) > || ([string match "*ftype2" $to] && [string match "*array*" $from]) > || ([string match "*ftype" $to] && [string match "*method" $from]) > Otherwise, LGTM. I haven't tested it, but I trust that you did :) Simon