]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / dw2-noloc.exp
1 # Copyright 2007-2024 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/>.
15 load_lib dwarf.exp
16
17 # This test can only be run on targets which support DWARF-2 and use gas.
18 require dwarf2_support
19
20 if { [prepare_for_testing "failed to prepare" "dw2-noloc" {dw2-noloc-main.c dw2-noloc.S} {nodebug}] } {
21 return -1
22 }
23
24 # Symbols have the form: {file,main}_loc{addr,empty,no}_{,un}resolvable
25 # file: Symbol DIE is placed in DW_TAG_compile_unit.
26 # main: Symbol DIE is placed in DW_TAG_subprogram.
27 # locaddr: DW_AT_location is using DW_FORM_block DW_OP_addr <addr>.
28 # locempty: DW_AT_location has zero DW_FORM_block size.
29 # locno: DW_AT_location is not present.
30 # resolvable: .symtab entry exists for this symbol name.
31 # unresolvable: .symtab entry does not exist for this symbol name.
32 # DW_AT_declaration is not present in any of these DIEs.
33
34 proc file_symbols {type} {
35 with_test_prefix "$type" {
36
37 global gdb_prompt
38
39 gdb_test "print file_locaddr_resolvable" "= 1234567890"
40 gdb_test "ptype file_locaddr_resolvable" "type = int"
41
42 gdb_test "print file_locaddr_unresolvable" "= 1234567890"
43 gdb_test "ptype file_locaddr_unresolvable" "type = int"
44
45 gdb_test "print file_locempty_resolvable" "= <optimized out>"
46 gdb_test "ptype file_locempty_resolvable" "type = int"
47
48 gdb_test "print file_locempty_unresolvable" "= <optimized out>"
49 gdb_test "ptype file_locempty_unresolvable" "type = int"
50
51 gdb_test "print file_locno_resolvable" "= <optimized out>"
52 gdb_test "ptype file_locno_resolvable" "type = int"
53
54 gdb_test "print file_locno_unresolvable" "= <optimized out>"
55 gdb_test "ptype file_locno_unresolvable" "type = int"
56
57 gdb_test "print file_extern_locaddr_resolvable" "= 1234567890"
58 gdb_test "ptype file_extern_locaddr_resolvable" "type = int"
59
60 gdb_test "print file_extern_locaddr_unresolvable" "= 1234567890"
61 gdb_test "ptype file_extern_locaddr_unresolvable" "type = int"
62
63 gdb_test "print file_extern_locempty_resolvable" "= <optimized out>"
64 gdb_test "ptype file_extern_locempty_resolvable" "type = int"
65
66 gdb_test "print file_extern_locempty_unresolvable" "= <optimized out>"
67 gdb_test "ptype file_extern_locempty_unresolvable" "type = int"
68
69 gdb_test "print file_extern_locno_resolvable" "= 1234567890"
70 gdb_test "ptype file_extern_locno_resolvable" "type = int"
71
72 # `print file_extern_locno_unresolvable' currently prints
73 # Address of symbol "file_extern_locno_unresolvable" is unknown.
74 # As DW_AT_declaration is not present in this DIE
75 # it should print <optimized out>. As usefulness of such DIE is not
76 # clear its resolution is not being tested.
77 }
78 }
79
80 file_symbols no-run
81
82 if ![runto_main] {
83 return -1
84 }
85
86 file_symbols in-main
87
88
89 gdb_test "print main_local_locaddr_resolvable" "= 1234567890"
90 gdb_test "ptype main_local_locaddr_resolvable" "type = int"
91
92 gdb_test "print main_local_locaddr_unresolvable" "= 1234567890"
93 gdb_test "ptype main_local_locaddr_unresolvable" "type = int"
94
95 gdb_test "print main_local_locempty_resolvable" "= <optimized out>"
96 gdb_test "ptype main_local_locempty_resolvable" "type = int"
97
98 gdb_test "print main_local_locempty_unresolvable" "= <optimized out>"
99 gdb_test "ptype main_local_locempty_unresolvable" "type = int"
100
101 gdb_test "print main_local_locno_resolvable" "= <optimized out>"
102 gdb_test "ptype main_local_locno_resolvable" "type = int"
103
104 gdb_test "print main_local_locno_unresolvable" "= <optimized out>"
105 gdb_test "ptype main_local_locno_unresolvable" "type = int"
106
107 gdb_test "print main_extern_locaddr_resolvable" "= 1234567890"
108 gdb_test "ptype main_extern_locaddr_resolvable" "type = int"
109
110 gdb_test "print main_extern_locaddr_unresolvable" "= 1234567890"
111 gdb_test "ptype main_extern_locaddr_unresolvable" "type = int"
112
113 gdb_test "print main_extern_locempty_resolvable" "= <optimized out>"
114 gdb_test "ptype main_extern_locempty_resolvable" "type = int"
115
116 gdb_test "print main_extern_locempty_unresolvable" "= <optimized out>"
117 gdb_test "ptype main_extern_locempty_unresolvable" "type = int"
118
119 gdb_test "print main_extern_locno_resolvable" "= 1234567890"
120 gdb_test "ptype main_extern_locno_resolvable" "type = int"
121
122 # For `main_extern_locno_unresolvable' see `file_extern_locno_unresolvable'.