1 # Copyright 1992-2023 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 callling a method on a variable that has been put in a
19 if { [skip_cplus_tests] } { continue }
21 load_lib "cp-support.exp"
24 standard_testfile .cc -dw.S
26 if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
31 set asm_file [standard_output_file $srcfile2]
32 Dwarf::assemble $asm_file {
35 [function_range main ${::srcdir}/${::subdir}/${::srcfile}]
36 set main_start [lindex $main_result 0]
37 set main_length [lindex $main_result 1]
41 {DW_AT_language @DW_LANG_C_plus_plus}
42 {DW_AT_name $::srcfile}
45 declare_labels int_type_label struct_type_label \
47 set ptr_size [get_sizeof "void *" 96]
51 {low_pc $main_start addr}
52 {high_pc $main_length data8}
53 {DW_AT_type :$int_type_label}
56 int_type_label: DW_TAG_base_type {
57 {DW_AT_byte_size 4 DW_FORM_sdata}
58 {DW_AT_encoding @DW_ATE_signed}
62 struct_type_label: DW_TAG_structure_type {
63 {DW_AT_byte_size 4 DW_FORM_sdata}
68 {type :$int_type_label}
69 {data_member_location 0 data1}
73 {type :$int_type_label}
76 {type :$struct_ptr_type_label}
77 {artificial 1 flag_present}
82 struct_ptr_type_label: DW_TAG_pointer_type {
83 {DW_AT_byte_size $ptr_size DW_FORM_data1}
84 {type :$struct_type_label}
88 {DW_AT_name global_var}
89 {DW_AT_type :$struct_type_label}
99 if { [prepare_for_testing "failed to prepare" ${testfile} \
100 [list $srcfile $asm_file] {nodebug}] } {
108 gdb_test "print global_var.yyy ()" \
109 "Address requested for identifier \"global_var\" which is in register .*" \
110 "call method on register local"