]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.dwarf2/multidictionary.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / multidictionary.exp
CommitLineData
3666a048 1# Copyright 2019-2021 Free Software Foundation, Inc.
b56f80d8
KS
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16# A test of multi-language dictionaries, a solution to symtab/23010 et al.
17
18load_lib dwarf.exp
19
20# This test can only be run on targets which support DWARF.
21if {![dwarf2_support]} {
22 return 0
23}
24
25standard_testfile main.c .S
26
27# Create the DWARF. This is derived from the reproducer in the bug
28# mentioned above. This DIE tree is typical of compilations wtih
29# LTO enabled.
30
31set asm_file [standard_output_file $srcfile2]
32Dwarf::assemble $asm_file {
33 declare_labels D45d9 D5079 D5080 D50a9 D50af D5ab2 D5ac2 D5ace D5acf
34 declare_labels D2135f D2216a D22171 D226c4 D226ca D244ca \
35 D245da D245e6
36 declare_labels D41c21 D42025 D42045 D42038 D42045 D420b5
37
38 cu {} {
39 D45d9: compile_unit {
40 {language @DW_LANG_C_plus_plus}
41 {name "SerialPortUtils.cpp"}
42 } {
43 D5079: base_type {
44 {byte_size 1 sdata}
45 {encoding @DW_ATE_unsigned}
46 {name "char"}
47 }
48
49 D5080: const_type {
50 {type :$D5079}
51 }
52
53 D50a9: pointer_type {
54 {byte_size 4 sdata}
55 {type :$D5080}
56 }
57
58 D50af: const_type {
59 {type :$D50a9}
60 }
61
62 D5ab2: subprogram {
63 {external 1 flag}
64 {linkage_name "_Z18SerialSyncWriteStrPKc"}
65 } {
66 D5ac2: formal_parameter {
67 {name "msg"}
68 {type :$D50af}
69 }
70 D5ace: lexical_block {} {
71 D5acf: DW_TAG_variable {
72 {name "p"}
73 {type :$D50a9}
74 }
75 }
76 }
77 }
78 }
79
80 cu {} {
81 D2135f: compile_unit {
82 {language @DW_LANG_C_plus_plus}
83 {name "Main.cpp"}
84 } {
85 D2216a: base_type {
86 {byte_size 1 sdata}
87 {encoding @DW_ATE_unsigned_char}
88 {name "char"}
89 }
90
91 D22171: const_type {
92 {type :$D2216a}
93 }
94
95 D226c4: pointer_type {
96 {byte_size 4 sdata}
97 {type :$D22171}
98 }
99
100 D226ca: const_type {
101 {type :$D226c4}
102 }
103
104 D245da: subprogram {
105 {name "PrintPanicMsg"}
106 } {
107 D245e6: formal_parameter {
108 {name "msg"}
109 {type :$D226ca}
110 }
111 }
112 }
113 }
114
115 cu {} {
116 D41c21: compile_unit {
117 {language @DW_LANG_C99}
118 {name "<artificial>"}
119 } {
120 D42025: subprogram {
121 {abstract_origin %$D245da}
122 {low_pc 0x80b60 addr}
123 {high_pc 0x6c data4}
124 } {
125 D42038: formal_parameter {
126 {abstract_origin %$D245e6}
127 }
128
129 D42045: inlined_subroutine {
130 {abstract_origin %$D5ab2}
131 {low_pc 0x8060 addr}
132 {high_pc 0xc data4}
133 } {
134 D420b5: formal_parameter {
135 {abstract_origin %$D5ac2}
136 }
137 }
138 }
139 }
140 }
141}
142
143# Build the test executable.
144if {[build_executable $testfile.exp $testfile [list $asm_file $srcfile] {}] \
145 == -1} {
146 return -1
147}
148
149# We force the DIEs above to be read in via "-readnow".
621eacdf
TV
150save_vars { GDBFLAGS } {
151 set GDBFLAGS "$GDBFLAGS -readnow"
152 clean_restart
9a618ef6 153}
b56f80d8
KS
154gdb_load $binfile
155
156# All we need to do is check whether GDB is alive. Without
157# multidictionaries, it will either crash, assert, or throw an
158# internal_error.
159gdb_test "p 1" "= 1" "GDB is alive"
160