From patchwork Tue Jan 28 10:40:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tankut Baris Aktemur X-Patchwork-Id: 37585 Received: (qmail 100961 invoked by alias); 28 Jan 2020 10:40:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 100938 invoked by uid 89); 28 Jan 2020 10:40:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=Commercial, aktemur, dw_at_defaulted, dw_at_deleted X-HELO: mga05.intel.com Received: from mga05.intel.com (HELO mga05.intel.com) (192.55.52.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Jan 2020 10:40:24 +0000 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jan 2020 02:40:22 -0800 Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by fmsmga006.fm.intel.com with ESMTP; 28 Jan 2020 02:40:22 -0800 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Jan 2020 02:40:22 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.103) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Jan 2020 02:40:21 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jri7UlM/Jj9kLze5mSTYZL8COz+E9Usg7Lg1fUs2hGFel2gVkniidshgrTuX/O0Q/X74aRzfdiUTMexnuwofHBp2bQw7cYkx9809YPzggF8ZTn44j/kCETIjoFu0ppxKFqVeZPo2RUNhbed7ruJBUww8Dlvqu8CJ1+ufeb8ozAm0nR9AbHI5k4mPftC/naYSCJJu0/uLh07WQ7JuGe/qHZH9DKKzIKU4uiRWZCuSDOwY8wIyiCCcseYKMp4f2v2jTGCfo1gqpbUW2V4XXBiJWcWIhDfKagM7Le4tUcSSMvReLEDKsyHaXyDQfkyE3ub4H+S28YyN9d4WkinXnwVrGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zg+92t0n/FjazwFxkq6yCpdXcoQnrrCVCzjJ4hgQB3M=; b=UZciwgu1qMkYCXgEuF/PgBTCzXU1Ow6aHknZi7EYRDbXUFnOnxyRxHViXtSnYiJ0ctRAVglrrIJQNER5SRXJwPhaNAYq2P73tjppeFbD6Mwf0oBBETIaSDSAKeYUnojZUXPpNZipq6yZkgJMnDR18zx3vJ65ethlx6uJ2H2GnnMm+QMpjdkzDoI7d8NJhfIFhs5DVeDheCs6NCUyQBYVPICcbwaWrugcYrv9WrtAF+5Mev3Pcgv3ByisLX3KcFetK1C83W8kVRZOrY2LB4ScVDDEFlfgFHXw0aaysOyqsQ4fLIGNUdULg+RhlPY/CpZKpEyPp8RD8NqfBca7CJJ5pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zg+92t0n/FjazwFxkq6yCpdXcoQnrrCVCzjJ4hgQB3M=; b=ys3EecqV/utXB+GkSt1yDL6t+7BeEM7ps14Z7hzpW4IR/TxylDK1k/qvgWClzNJ8jzRrjUMAy/X/jmyHNQt8n0HFqyXmZpDIZcPeHoCNJkum9QghI92kQl69ZPCPhHvAbITrEbzkP7y4nw3NeQ20eTTV8/YDUiEngkGy0WCvwBM= Received: from BYAPR11MB3030.namprd11.prod.outlook.com (20.177.225.91) by BYAPR11MB3317.namprd11.prod.outlook.com (20.177.184.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.22; Tue, 28 Jan 2020 10:40:20 +0000 Received: from BYAPR11MB3030.namprd11.prod.outlook.com ([fe80::2c94:a4bd:2d9c:30b]) by BYAPR11MB3030.namprd11.prod.outlook.com ([fe80::2c94:a4bd:2d9c:30b%6]) with mapi id 15.20.2665.026; Tue, 28 Jan 2020 10:40:20 +0000 From: "Aktemur, Tankut Baris" To: Luis Machado , "tromey@sourceware.org" , "gdb-patches@sourceware.org" Subject: RE: [review v3] testsuite, cp: increase the coverage of testing pass-by-ref arguments Date: Tue, 28 Jan 2020 10:40:20 +0000 Message-ID: References: <20191214095325.3864520AF6@gnutoolchain-gerrit.osci.io> <80c8502f-a350-6a2b-0b72-bbc903f53bc3@linaro.org> <0dd26985-5952-d010-135f-a92aba6f9a05@linaro.org> In-Reply-To: authentication-results: spf=none (sender IP is ) smtp.mailfrom=tankut.baris.aktemur@intel.com; x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-messagedata: 9/d5wJENpD4AmN8eU8n2GLSAGbh9VFp1qoy8eijS2lu/YC/PR6XC7AEwlolmdhQ+W07UVga3IJ7QVnJ630mEWeXL0AtoVZ0KblW03FLjWW8gonhiUkgSW61Z8bRTJBn8nPQRRQ29V9wSk0PJOBHrJA== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: KozcYE2bpZfBJijJmhEwTx7znrqIXsKfA8D5wo24m0IBcAlt/2WGmkAXgfPG+5FPYp5PHsOZRwvkJgUHbukQ+gGihD1UGpaXefBSsxop3s0= Return-Path: tankut.baris.aktemur@intel.com X-IsSubscribed: yes On Wednesday, January 15, 2020 3:30 PM, Aktemur, Tankut Baris wrote: > On Tuesday, January 14, 2020 2:13 PM, Luis Machado wrote: > > > > On 1/14/20 9:52 AM, Aktemur, Tankut Baris wrote: > > > > > > I've investigated GCC and Clang for this. GCC started emitting DW_AT_deleted and > > > DW_AT_defaulted with version 7. Clang does not emit these attributes; however, it > > > has been emitting DW_AT_calling_convention starting with version 7. This > > > attribute helps the debugger make the right decision in some cases. > > > > > > Based on this, I think the test cases have to be filtered in a somewhat > > > fine-granular manner. Therefore I thought I could save you from the burden of > > > having to go through the code-generating test definition. Below is a patch proposal. > > > > > > -Baris > > > > Thanks! I've checked this on my box with an older GCC and i see the > > XFAIL's now. So it looks good to me. > > > > Small nit below... > > > > Thank you. I'll fix that and wait for an official approval. > > -Baris Kindly pinging. > > > > +# GCC version <= 6 and Clang do not emit DW_AT_defaulted and DW_AT_deleted > > > +set is_gcc_6_or_older [test_compiler_info {gcc-[0-6]-*}] > > > +set is_clang [test_compiler_info {clang-*}] > > > + > > > set bp_location [gdb_get_line_number "stop here"] > > > gdb_breakpoint $bp_location > > > gdb_continue_to_breakpoint "end of main" ".*return .*;" > > > > It seems to be a mixed bag, but i see more examples of having a period > > after the sentence than not having it. Multiple cases of this on the patch. > > The version with Luis' comment addressed is below. Thanks, -Baris From 3d1f0e23fb4aa647d41743be2c4eb8e5bc4b5328 Mon Sep 17 00:00:00 2001 From: Tankut Baris Aktemur Date: Tue, 14 Jan 2020 13:36:09 +0100 Subject: [PATCH v2] testsuite, cp: add pass-by-ref test expected failures for certain compilers There exist expected failures in the pass-by-ref.exp and pass-by-ref-2.exp tests based on the GCC and Clang version. * GCC version <= 6 and Clang do not emit DW_AT_deleted and DW_AT_defaulted. * Clang version >= 7 emits DW_AT_calling_convention, which helps the debugger make the right calling convention decision in some cases despite lacking the 'defaulted' and 'deleted' attributes. Mark the related tests as XFAIL based on the compiler version. Tested on X86_64 using GCC 5.5.0, 6.5.0, 7.4.0, 8.3.0, 9.2.1; and Clang 5.0.1, 6.0.0, 7.0.0, 8.0.0, 9.0.1, 10.0.0. gdb/testsuite/ChangeLog: 2020-01-28 Tankut Baris Aktemur * gdb.cp/pass-by-ref-2.exp: Mark some tests as XFAIL based on the GCC/Clang version. * gdb.cp/pass-by-ref.exp: Ditto. Change-Id: I1d8440aa438049f7c4da7f4f76f201c48550f1e4 --- gdb/testsuite/gdb.cp/pass-by-ref-2.exp | 6 ++++++ gdb/testsuite/gdb.cp/pass-by-ref.exp | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) -- 2.17.1 Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Gary Kershaw Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928 diff --git a/gdb/testsuite/gdb.cp/pass-by-ref-2.exp b/gdb/testsuite/gdb.cp/pass-by-ref-2.exp index a83ce8d5d7d..913f9af3ee7 100644 --- a/gdb/testsuite/gdb.cp/pass-by-ref-2.exp +++ b/gdb/testsuite/gdb.cp/pass-by-ref-2.exp @@ -42,6 +42,10 @@ if {![runto_main]} { return -1 } +# GCC version <= 6 and Clang do not emit DW_AT_defaulted and DW_AT_deleted. +set is_gcc_6_or_older [test_compiler_info {gcc-[0-6]-*}] +set is_clang [test_compiler_info {clang-*}] + set bp_location [gdb_get_line_number "stop here"] gdb_breakpoint $bp_location gdb_continue_to_breakpoint "end of main" ".*return .*;" @@ -65,6 +69,7 @@ set sig "\"Inlined\:\:Inlined\\(.*Inlined const\&\\)\"" gdb_test "print cbvInlined (inlined)" \ "expression cannot be evaluated .* \\(maybe inlined\\?\\)" +if {$is_gcc_6_or_older || $is_clang} {setup_xfail "*-*-*"} gdb_test "print cbvDtorDel (*dtorDel)" \ ".* cannot be evaluated .* 'DtorDel' is not destructible" \ "type not destructible" @@ -94,6 +99,7 @@ gdb_test "print cbvTwoMCtor (twoMctor)" \ ".* cannot be evaluated .* 'TwoMCtor' is not copy constructible" \ "copy ctor is implicitly deleted" +if {$is_gcc_6_or_older || $is_clang} {setup_xfail "*-*-*"} gdb_test "print cbvTwoMCtorAndCCtor (twoMctorAndCctor)" "12" \ "call cbvTwoMCtorAndCCtor" gdb_test "print twoMctorAndCctor.x" "2" \ diff --git a/gdb/testsuite/gdb.cp/pass-by-ref.exp b/gdb/testsuite/gdb.cp/pass-by-ref.exp index f500710fd43..06a36129e83 100644 --- a/gdb/testsuite/gdb.cp/pass-by-ref.exp +++ b/gdb/testsuite/gdb.cp/pass-by-ref.exp @@ -369,6 +369,12 @@ proc test_for_class { prefix states cbvfun data_field length} { global ADDED global TRACE + # GCC version <= 6 and Clang do not emit DW_AT_defaulted and DW_AT_deleted. + set is_gcc_6_or_older [test_compiler_info {gcc-[0-6]-*}] + set is_clang [test_compiler_info {clang-*}] + # But Clang version >= 7 emits DW_AT_calling_convention for types. + set is_clang_6_or_older [test_compiler_info {clang-[0-6]-*}] + with_test_prefix $name { if {[is_copy_constructible $states]} { set expected [expr {$ORIGINAL + $ADDED}] @@ -378,6 +384,19 @@ proc test_for_class { prefix states cbvfun data_field length} { if {$dtor == "explicit"} { gdb_test "print tracer = 0" " = 0" "reset the tracer" } + + if {$cctor == "defaultedIn" || $dtor == "defaultedIn"} { + if {$is_gcc_6_or_older || $is_clang_6_or_older} { + setup_xfail "*-*-*" + } elseif {$is_clang} { + # If this is a pass-by-value case, Clang >= 7's + # DW_AT_calling_convention leads to the right decision. + # Otherwise, it is expected to fail. + if {"defaultedOut" in $states || "explicit" in $states} { + setup_xfail "*-*-*" + } + } + } gdb_test "print ${cbvfun}<$name> (${name}_var)" " = $expected" \ "call '$cbvfun'" gdb_test "print ${name}_var.${data_field}\[0\]" " = $ORIGINAL" \ @@ -389,10 +408,17 @@ proc test_for_class { prefix states cbvfun data_field length} { "cbv argument should not change (item $last_index)" } if {$dtor == "explicit"} { + if {$cctor == "defaultedIn" + && ($is_gcc_6_or_older || $is_clang)} { + setup_xfail "*-*-*" + } gdb_test "print tracer" " = $TRACE" \ "destructor should be called" } } else { + if {$cctor == "deleted" && ($is_gcc_6_or_older || $is_clang)} { + setup_xfail "*-*-*" + } gdb_test "print ${cbvfun}<$name> (${name}_var)" \ ".* cannot be evaluated .* '${name}' is not copy constructible" \ "calling '$cbvfun' should be refused"