]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.dwarf2/static-optimized-out.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / static-optimized-out.exp
1 # Copyright 2023-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
16 # Check that an optimized out static variable is printed the same independent
17 # of state of symtab expansion. See also gdb.opt/static-optimized-out.exp.
18
19 load_lib dwarf.exp
20
21 # This test can only be run on targets which support DWARF-2 and use gas.
22 require dwarf2_support
23
24 standard_testfile main.c -dw.S
25
26 # Make DWARF for the test.
27 set asm_file [standard_output_file $srcfile2]
28 Dwarf::assemble $asm_file {
29 cu {} {
30 compile_unit {
31 {
32 language @DW_LANG_C
33 }
34 } {
35 declare_labels integer_label
36
37 integer_label: DW_TAG_base_type {
38 {DW_AT_byte_size 4 DW_FORM_sdata}
39 {DW_AT_encoding @DW_ATE_signed}
40 {DW_AT_name integer}
41 }
42
43 DW_TAG_variable {
44 {name var}
45 {type :$integer_label}
46 }
47 }
48 }
49 }
50
51 if { [prepare_for_testing "failed to prepare" ${testfile} \
52 [list $srcfile $asm_file] {nodebug}] } {
53 return -1
54 }
55
56 gdb_test "print var" " = <optimized out>"
57
58 # Expand all symbol tables.
59 gdb_test_no_output "maint expand-symtabs"
60
61 # Make sure we do an actual lookup rather than just returning the same as
62 # before.
63 gdb_test_no_output "maint flush symbol-cache"
64
65 with_test_prefix "after expand-symtabs" {
66 gdb_test "print var" " = <optimized out>"
67 }