1 # Copyright 2016 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Test accessing "non-variable" variables, i.e., variables which are
17 # optimized to a constant DWARF location expression and/or
18 # partially/fully optimized out.
22 if {![dwarf2_support]} { return 0 }
24 standard_testfile main.c nonvar-access-dw.S
26 # Make some DWARF for the test.
27 set asm_file [standard_output_file $srcfile2]
29 Dwarf::assemble $asm_file {
34 declare_labels int_type_label short_type_label
35 declare_labels struct_s_label
37 int_type_label: base_type {
39 {encoding @DW_ATE_signed}
40 {byte_size 4 DW_FORM_sdata}
43 struct_s_label: structure_type {
45 {byte_size 4 DW_FORM_sdata}
49 {type :$int_type_label}
50 {data_member_location 0 DW_FORM_udata}
51 {bit_size 8 DW_FORM_udata}
55 {type :$int_type_label}
56 {data_bit_offset 8 DW_FORM_udata}
57 {bit_size 24 DW_FORM_udata}
63 {DW_AT_external 1 flag}
64 {low_pc [gdb_target_symbol main] DW_FORM_addr}
65 {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr}
69 {type :$int_type_label}
73 {type :$struct_s_label}
77 {type :$struct_s_label}
92 if { [prepare_for_testing ${testfile}.exp ${testfile} \
93 [list $srcfile $asm_file] {nodebug}] } {
101 gdb_test "print def_s" " = \\{a = 0, b = -1\\}"
102 gdb_test "print undef_int" " = <optimized out>"
103 gdb_test "print undef_s.a" " = <optimized out>"