From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) From: Bruno Larsen 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-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-List-Received-Date: Wed, 20 Jul 2022 19:45:13 -0000 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