From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id sLFeIadb2GJkTRcAWB0awg (envelope-from ) for ; Wed, 20 Jul 2022 15:46:47 -0400 Received: by simark.ca (Postfix, from userid 112) id 854AF1E5EA; Wed, 20 Jul 2022 15:46:47 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=T7fzlXmF; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [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 005C01E21F for ; Wed, 20 Jul 2022 15:46:47 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 79FDE38560A8 for ; Wed, 20 Jul 2022 19:46:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79FDE38560A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1658346406; bh=tL1ur75wiD/7p4gu2Bo8ZFtjiWCLArc8onYU4hQ43/8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=T7fzlXmFt6+EOaQBjV4j9yfbi/gN2i9rWcgrQiY0Zen6+OMgx69kGBkWsXq4JPApL g3o6m2LmA3awcNeG5KXRUCpafPEoAx2Tfbk1M3LpUbrlZD89//70WOT0QcMhPEZEGd NB48mcU+N89x7hvxi9SpxdlTyAAP80WUNUueg61A= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id D2F8B385740F for ; Wed, 20 Jul 2022 19:45:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D2F8B385740F Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-45-BOT8F63QPZCOf-X8KlvUpQ-1; Wed, 20 Jul 2022 15:45:10 -0400 X-MC-Unique: BOT8F63QPZCOf-X8KlvUpQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 994C2811E81 for ; Wed, 20 Jul 2022 19:45:09 +0000 (UTC) Received: from blarsen.com (ovpn-116-8.gru2.redhat.com [10.97.116.8]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E2A1340D2962; Wed, 20 Jul 2022 19:45:08 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH v4 13/15] gdb/testsuite: fix gdb.base/info-types-c++ with clang Date: Wed, 20 Jul 2022 16:44:39 -0300 Message-Id: <20220720194441.168906-15-blarsen@redhat.com> In-Reply-To: <20220720194441.168906-1-blarsen@redhat.com> References: <20220720194441.168906-1-blarsen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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: , From: Bruno Larsen via Gdb-patches Reply-To: Bruno Larsen Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" When g++ compiles nameles structs defined in a typedef, it adds a DW_AT_linkage_name with the name defined in the typedef. So when running gdb.base/info-types-c++.exp by default, we get the following output All defined types: File ../../../common/git-repos/binutils-gdb/gdb/testsuite/gdb.base/info-types.c: 98: CL; 42: anon_struct_t; 65: anon_union_t; 21: baz_t; 33: enum_t; 56: union_t; 52: typedef enum {...} anon_enum_t; 45: typedef anon_struct_t anon_struct_t; 68: typedef anon_union_t anon_union_t; Clang[++] does not add DW_AT_linkage_name, and so it's output looks like this: All defined types: File ../../../common/git-repos/binutils-gdb/gdb/testsuite/gdb.base/info-types.c: 98: CL; 21: baz_t; 33: enum_t; 56: union_t; 52: typedef enum {...} anon_enum_t; 45: typedef struct {...} anon_struct_t; 68: typedef union {...} anon_union_t; Which is still correct output for GDB, but shows up as a failure when running the test. This commit changes the test to allow for this output when the compiler is clang. --- gdb/testsuite/gdb.base/info-types.exp.tcl | 109 +++++++++++++++------- 1 file changed, 73 insertions(+), 36 deletions(-) diff --git a/gdb/testsuite/gdb.base/info-types.exp.tcl b/gdb/testsuite/gdb.base/info-types.exp.tcl index 2dd9b9e5489..b6a03276f69 100644 --- a/gdb/testsuite/gdb.base/info-types.exp.tcl +++ b/gdb/testsuite/gdb.base/info-types.exp.tcl @@ -41,42 +41,79 @@ proc run_test { lang } { set file_re "File .*[string_to_regexp $srcfile]:" if { $lang == "c++" } { - set output_lines \ - [list \ - "^All defined types:" \ - ".*" \ - $file_re \ - "98:\[\t \]+CL;" \ - "42:\[\t \]+anon_struct_t;" \ - "65:\[\t \]+anon_union_t;" \ - "21:\[\t \]+baz_t;" \ - "33:\[\t \]+enum_t;" \ - "56:\[\t \]+union_t;" \ - "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \ - "45:\[\t \]+typedef anon_struct_t anon_struct_t;" \ - "68:\[\t \]+typedef anon_union_t anon_union_t;" \ - "28:\[\t \]+typedef baz_t baz;" \ - "31:\[\t \]+typedef baz_t \\* baz_ptr;" \ - "27:\[\t \]+typedef baz_t baz_t;" \ - "\[\t \]+double" \ - "\[\t \]+float" \ - "\[\t \]+int" \ - "103:\[\t \]+typedef CL my_cl;" \ - "38:\[\t \]+typedef enum_t my_enum_t;" \ - "17:\[\t \]+typedef float my_float_t;" \ - "16:\[\t \]+typedef int my_int_t;" \ - "104:\[\t \]+typedef CL \\* my_ptr;" \ - "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \ - "47:\[\t \]+typedef anon_struct_t nested_anon_struct_t;" \ - "70:\[\t \]+typedef anon_union_t nested_anon_union_t;" \ - "30:\[\t \]+typedef baz_t nested_baz;" \ - "29:\[\t \]+typedef baz_t nested_baz_t;" \ - "39:\[\t \]+typedef enum_t nested_enum_t;" \ - "19:\[\t \]+typedef float nested_float_t;" \ - "18:\[\t \]+typedef int nested_int_t;" \ - "62:\[\t \]+typedef union_t nested_union_t;(" \ - "\[\t \]+unsigned int)?" \ - "($|\r\n.*)"] + if { [test_compiler_info "clang-*"] } { + set output_lines \ + [list \ + "^All defined types:" \ + ".*" \ + $file_re \ + "98:\[\t \]+CL;" \ + "21:\[\t \]+baz_t;" \ + "33:\[\t \]+enum_t;" \ + "56:\[\t \]+union_t;" \ + "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \ + "45:\[\t \]+typedef struct {\\.\\.\\.} anon_struct_t;" \ + "68:\[\t \]+typedef union {\\.\\.\\.} anon_union_t;" \ + "28:\[\t \]+typedef baz_t baz;" \ + "31:\[\t \]+typedef baz_t \\* baz_ptr;" \ + "27:\[\t \]+typedef baz_t baz_t;" \ + "\[\t \]+double" \ + "\[\t \]+float" \ + "\[\t \]+int" \ + "103:\[\t \]+typedef CL my_cl;" \ + "38:\[\t \]+typedef enum_t my_enum_t;" \ + "17:\[\t \]+typedef float my_float_t;" \ + "16:\[\t \]+typedef int my_int_t;" \ + "104:\[\t \]+typedef CL \\* my_ptr;" \ + "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \ + "47:\[\t \]+typedef struct {\\.\\.\\.} nested_anon_struct_t;" \ + "70:\[\t \]+typedef union {\\.\\.\\.} nested_anon_union_t;" \ + "30:\[\t \]+typedef baz_t nested_baz;" \ + "29:\[\t \]+typedef baz_t nested_baz_t;" \ + "39:\[\t \]+typedef enum_t nested_enum_t;" \ + "19:\[\t \]+typedef float nested_float_t;" \ + "18:\[\t \]+typedef int nested_int_t;" \ + "62:\[\t \]+typedef union_t nested_union_t;(" \ + "\[\t \]+unsigned int)?" \ + "($|\r\n.*)"] + } else { + set output_lines \ + [list \ + "^All defined types:" \ + ".*" \ + $file_re \ + "98:\[\t \]+CL;" \ + "42:\[\t \]+anon_struct_t;" \ + "65:\[\t \]+anon_union_t;" \ + "21:\[\t \]+baz_t;" \ + "33:\[\t \]+enum_t;" \ + "56:\[\t \]+union_t;" \ + "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \ + "45:\[\t \]+typedef anon_struct_t anon_struct_t;" \ + "68:\[\t \]+typedef anon_union_t anon_union_t;" \ + "28:\[\t \]+typedef baz_t baz;" \ + "31:\[\t \]+typedef baz_t \\* baz_ptr;" \ + "27:\[\t \]+typedef baz_t baz_t;" \ + "\[\t \]+double" \ + "\[\t \]+float" \ + "\[\t \]+int" \ + "103:\[\t \]+typedef CL my_cl;" \ + "38:\[\t \]+typedef enum_t my_enum_t;" \ + "17:\[\t \]+typedef float my_float_t;" \ + "16:\[\t \]+typedef int my_int_t;" \ + "104:\[\t \]+typedef CL \\* my_ptr;" \ + "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \ + "47:\[\t \]+typedef anon_struct_t nested_anon_struct_t;" \ + "70:\[\t \]+typedef anon_union_t nested_anon_union_t;" \ + "30:\[\t \]+typedef baz_t nested_baz;" \ + "29:\[\t \]+typedef baz_t nested_baz_t;" \ + "39:\[\t \]+typedef enum_t nested_enum_t;" \ + "19:\[\t \]+typedef float nested_float_t;" \ + "18:\[\t \]+typedef int nested_int_t;" \ + "62:\[\t \]+typedef union_t nested_union_t;(" \ + "\[\t \]+unsigned int)?" \ + "($|\r\n.*)"] + } } else { set output_lines \ [list \ -- 2.31.1