1# Copyright 2013-2023 Free Software Foundation, Inc.
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/>.
15load_lib dwarf.exp
16
17# This test can only be run on targets which support DWARF-2 and use gas.
18if {![dwarf2_support]} {
19    return 0
20}
21
22if { [skip_cplus_tests] } { continue }
23
24standard_testfile main.c -dw4.S
25
26# Make some DWARF for the test.
27set asm_file [standard_output_file $srcfile2]
28Dwarf::assemble $asm_file {
29    cu {} {
30 	compile_unit {} {
31	    declare_labels typedef_label
32
33	    # This signature is intentionally wrong.
34	    typedef_label: typedef {
35		{name foo}
36		{type 0xee22334455667788 ref_sig8 }
37	    }
38	}
39    }
40
41    tu {} 0x1122334455667788 the_type {
42	type_unit {} {
43	    the_type: base_type {
44		{name int}
45		{encoding @DW_ATE_signed}
46		{byte_size 4 sdata}
47	    }
48	}
49    }
50}
51
52if { [prepare_for_testing "failed to prepare" ${testfile} \
53	  [list $srcfile $asm_file] {nodebug}] } {
54    return -1
55}
56
57gdb_test "ptype foo" "type = <unknown type .*>"
58