From patchwork Fri Nov 9 02:28:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Seitz X-Patchwork-Id: 30090 Received: (qmail 47500 invoked by alias); 9 Nov 2018 02:34:39 -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 47490 invoked by uid 89); 9 Nov 2018 02:34:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=UD:i386-avx512.c, i386-avx512.c, i386avx512c, wtih X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Nov 2018 02:34:36 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A325F300238D for ; Fri, 9 Nov 2018 02:28:50 +0000 (UTC) Received: from theo.uglyboxes.com.com (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C2245D762 for ; Fri, 9 Nov 2018 02:28:50 +0000 (UTC) From: Keith Seitz To: gdb-patches@sourceware.org Subject: [PATCH 5/5] gdb/23712: Test case for multidictionary Date: Thu, 8 Nov 2018 18:28:47 -0800 Message-Id: <20181109022847.32049-5-keiths@redhat.com> In-Reply-To: <20181109022847.32049-1-keiths@redhat.com> References: <20181109022847.32049-1-keiths@redhat.com> X-IsSubscribed: yes This is a test derived from one of the reproducers in symtab/23010. The DIE tree used here is typical of compilations with LTO, where an artificial parent DIE of language C99 imports DIEs of other languages. testsuite/ChangeLog: PR gdb/23712 * gdb.dwarf2/multidictionary.exp: New file. --- gdb/testsuite/ChangeLog | 5 + gdb/testsuite/gdb.dwarf2/multidictionary.exp | 157 +++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 gdb/testsuite/gdb.dwarf2/multidictionary.exp diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e0bb8382aa..abc13754be 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +YYYY-MM-DD Keith Seitz + + PR gdb/23712 + * gdb.dwarf2/multidictionary.exp: New file. + 2018-11-08 Jan Beulich * testsuite/gdb.arch/i386-avx512.c, diff --git a/gdb/testsuite/gdb.dwarf2/multidictionary.exp b/gdb/testsuite/gdb.dwarf2/multidictionary.exp new file mode 100644 index 0000000000..5e49327a4b --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/multidictionary.exp @@ -0,0 +1,157 @@ +# Copyright 2018 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# A test of multi-language dictionaries, a solution to symtab/23010 et al. + +load_lib dwarf.exp + +# This test can only be run on targets which support DWARF. +if {![dwarf2_support]} { + return 0 +} + +standard_testfile main.c .S + +# Create the DWARF. This is derived from the reproducer in the bug +# mentioned above. This DIE tree is typical of compilations wtih +# LTO enabled. + +set asm_file [standard_output_file $srcfile2] +Dwarf::assemble $asm_file { + declare_labels D45d9 D5079 D5080 D50a9 D50af D5ab2 D5ac2 D5ace D5acf + declare_labels D2135f D2216a D22171 D226c4 D226ca D244ca \ + D245da D245e6 + declare_labels D41c21 D42025 D42045 D42038 D42045 D420b5 + + cu {} { + D45d9: compile_unit { + {language @DW_LANG_C_plus_plus} + {name "SerialPortUtils.cpp"} + } { + D5079: base_type { + {byte_size 1 sdata} + {encoding @DW_ATE_unsigned} + {name "char"} + } + + D5080: const_type { + {type :$D5079} + } + + D50a9: pointer_type { + {byte_size 4 sdata} + {type :$D5080} + } + + D50af: const_type { + {type :$D50a9} + } + + D5ab2: subprogram { + {external 1 flag} + {linkage_name "_Z18SerialSyncWriteStrPKc"} + } { + D5ac2: formal_parameter { + {name "msg"} + {type :$D50af} + } + D5ace: lexical_block {} { + D5acf: DW_TAG_variable { + {name "p"} + {type :$D50a9} + } + } + } + } + } + + cu {} { + D2135f: compile_unit { + {language @DW_LANG_C_plus_plus} + {name "Main.cpp"} + } { + D2216a: base_type { + {byte_size 1 sdata} + {encoding @DW_ATE_unsigned_char} + {name "char"} + } + + D22171: const_type { + {type :$D2216a} + } + + D226c4: pointer_type { + {byte_size 4 sdata} + {type :$D22171} + } + + D226ca: const_type { + {type :$D226c4} + } + + D245da: subprogram { + {name "PrintPanicMsg"} + } { + D245e6: formal_parameter { + {name "msg"} + {type :$D226ca} + } + } + } + } + + cu {} { + D41c21: compile_unit { + {language @DW_LANG_C99} + {name ""} + } { + D42025: subprogram { + {abstract_origin %$D245da} + {low_pc 0x80b60 addr} + {high_pc 0x6c data4} + } { + D42038: formal_parameter { + {abstract_origin %$D245e6} + } + + D42045: inlined_subroutine { + {abstract_origin %$D5ab2} + {low_pc 0x8060 addr} + {high_pc 0xc data4} + } { + D420b5: formal_parameter { + {abstract_origin %$D5ac2} + } + } + } + } + } +} + +# We force the DIEs above to be read in via "--readnow". +set saved_gdbflags $GDBFLAGS +append GDBFLAGS " --readnow" + +if {[prepare_for_testing "failed to prepare" $testfile \ + "${asm_file} ${srcfile}" {}]} { + return -1 +} +set GDBFLAGS $saved_gdbflags + +# All we need to do is check whether GDB is alive. Without +# multidictionaries, it will either crash, assert, or throw an +# internal_error. +gdb_test "p 1" "= 1" "GDB is alive" +