xref: /aosp_15_r20/external/elfutils/tests/run-exprlocs.sh (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
1*7304104dSAndroid Build Coastguard Worker#! /bin/sh
2*7304104dSAndroid Build Coastguard Worker# Copyright (C) 2017 Red Hat, Inc.
3*7304104dSAndroid Build Coastguard Worker# This file is part of elfutils.
4*7304104dSAndroid Build Coastguard Worker#
5*7304104dSAndroid Build Coastguard Worker# This file is free software; you can redistribute it and/or modify
6*7304104dSAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by
7*7304104dSAndroid Build Coastguard Worker# the Free Software Foundation; either version 3 of the License, or
8*7304104dSAndroid Build Coastguard Worker# (at your option) any later version.
9*7304104dSAndroid Build Coastguard Worker#
10*7304104dSAndroid Build Coastguard Worker# elfutils is distributed in the hope that it will be useful, but
11*7304104dSAndroid Build Coastguard Worker# WITHOUT ANY WARRANTY; without even the implied warranty of
12*7304104dSAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*7304104dSAndroid Build Coastguard Worker# GNU General Public License for more details.
14*7304104dSAndroid Build Coastguard Worker#
15*7304104dSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License
16*7304104dSAndroid Build Coastguard Worker# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17*7304104dSAndroid Build Coastguard Worker
18*7304104dSAndroid Build Coastguard Worker. $srcdir/test-subr.sh
19*7304104dSAndroid Build Coastguard Worker
20*7304104dSAndroid Build Coastguard Worker# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77589
21*7304104dSAndroid Build Coastguard Worker#
22*7304104dSAndroid Build Coastguard Worker# program repro
23*7304104dSAndroid Build Coastguard Worker#   type small_stride
24*7304104dSAndroid Build Coastguard Worker#      character*40 long_string
25*7304104dSAndroid Build Coastguard Worker#      integer      small_pad
26*7304104dSAndroid Build Coastguard Worker#   end type small_stride
27*7304104dSAndroid Build Coastguard Worker#   type(small_stride), dimension (20), target :: unpleasant
28*7304104dSAndroid Build Coastguard Worker#   character*40, pointer, dimension(:):: c40pt
29*7304104dSAndroid Build Coastguard Worker#   integer i
30*7304104dSAndroid Build Coastguard Worker#   do i = 0,19
31*7304104dSAndroid Build Coastguard Worker#      unpleasant(i+1)%small_pad = i+1
32*7304104dSAndroid Build Coastguard Worker#      unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello'
33*7304104dSAndroid Build Coastguard Worker#   end do
34*7304104dSAndroid Build Coastguard Worker#   c40pt => unpleasant%long_string
35*7304104dSAndroid Build Coastguard Worker#   print *, c40pt  ! break-here
36*7304104dSAndroid Build Coastguard Worker# end program repro
37*7304104dSAndroid Build Coastguard Worker#
38*7304104dSAndroid Build Coastguard Worker# Needs GCC7+
39*7304104dSAndroid Build Coastguard Worker# gfortran -o testfile-stridex dwarf-stridex.f90 -Wall -g
40*7304104dSAndroid Build Coastguard Worker
41*7304104dSAndroid Build Coastguard Workertestfiles testfile-stridex
42*7304104dSAndroid Build Coastguard Worker
43*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/tests/varlocs --exprlocs -e testfile-stridex <<\EOF
44*7304104dSAndroid Build Coastguard Workermodule 'testfile-stridex'
45*7304104dSAndroid Build Coastguard Worker[b] CU 'dwarf-stridex.f90'@400717
46*7304104dSAndroid Build Coastguard Worker  producer (strp)
47*7304104dSAndroid Build Coastguard Worker  language (data1)
48*7304104dSAndroid Build Coastguard Worker  identifier_case (data1)
49*7304104dSAndroid Build Coastguard Worker  name (strp)
50*7304104dSAndroid Build Coastguard Worker  comp_dir (strp)
51*7304104dSAndroid Build Coastguard Worker  low_pc (addr)
52*7304104dSAndroid Build Coastguard Worker  high_pc (data8)
53*7304104dSAndroid Build Coastguard Worker  stmt_list (sec_offset)
54*7304104dSAndroid Build Coastguard Worker  [2e] base_type "integer(kind=8)"
55*7304104dSAndroid Build Coastguard Worker    byte_size (data1)
56*7304104dSAndroid Build Coastguard Worker    encoding (data1)
57*7304104dSAndroid Build Coastguard Worker    name (strp)
58*7304104dSAndroid Build Coastguard Worker  [35] structure_type "small_stride"
59*7304104dSAndroid Build Coastguard Worker    name (strp)
60*7304104dSAndroid Build Coastguard Worker    byte_size (data1)
61*7304104dSAndroid Build Coastguard Worker    decl_file (data1)
62*7304104dSAndroid Build Coastguard Worker    decl_line (data1)
63*7304104dSAndroid Build Coastguard Worker    sibling (ref4)
64*7304104dSAndroid Build Coastguard Worker    [41] member "long_string"
65*7304104dSAndroid Build Coastguard Worker      name (strp)
66*7304104dSAndroid Build Coastguard Worker      decl_file (data1)
67*7304104dSAndroid Build Coastguard Worker      decl_line (data1)
68*7304104dSAndroid Build Coastguard Worker      type (ref4)
69*7304104dSAndroid Build Coastguard Worker      data_member_location (data1) {plus_uconst(0)}
70*7304104dSAndroid Build Coastguard Worker    [4d] member "small_pad"
71*7304104dSAndroid Build Coastguard Worker      name (strp)
72*7304104dSAndroid Build Coastguard Worker      decl_file (data1)
73*7304104dSAndroid Build Coastguard Worker      decl_line (data1)
74*7304104dSAndroid Build Coastguard Worker      type (ref4)
75*7304104dSAndroid Build Coastguard Worker      data_member_location (data1) {plus_uconst(40)}
76*7304104dSAndroid Build Coastguard Worker  [5a] string_type
77*7304104dSAndroid Build Coastguard Worker    byte_size (data1)
78*7304104dSAndroid Build Coastguard Worker  [5c] base_type "integer(kind=4)"
79*7304104dSAndroid Build Coastguard Worker    byte_size (data1)
80*7304104dSAndroid Build Coastguard Worker    encoding (data1)
81*7304104dSAndroid Build Coastguard Worker    name (strp)
82*7304104dSAndroid Build Coastguard Worker  [63] const_type
83*7304104dSAndroid Build Coastguard Worker    type (ref4)
84*7304104dSAndroid Build Coastguard Worker  [68] subprogram "main"
85*7304104dSAndroid Build Coastguard Worker    external (flag_present)
86*7304104dSAndroid Build Coastguard Worker    name (strp)
87*7304104dSAndroid Build Coastguard Worker    decl_file (data1)
88*7304104dSAndroid Build Coastguard Worker    decl_line (data1)
89*7304104dSAndroid Build Coastguard Worker    type (ref4)
90*7304104dSAndroid Build Coastguard Worker    low_pc (addr)
91*7304104dSAndroid Build Coastguard Worker    high_pc (data8)
92*7304104dSAndroid Build Coastguard Worker    frame_base (exprloc) {call_frame_cfa {bregx(7,8)}}
93*7304104dSAndroid Build Coastguard Worker    GNU_all_tail_call_sites (flag_present)
94*7304104dSAndroid Build Coastguard Worker    sibling (ref4)
95*7304104dSAndroid Build Coastguard Worker    [89] formal_parameter "argc"
96*7304104dSAndroid Build Coastguard Worker      name (strp)
97*7304104dSAndroid Build Coastguard Worker      decl_file (data1)
98*7304104dSAndroid Build Coastguard Worker      decl_line (data1)
99*7304104dSAndroid Build Coastguard Worker      type (ref4)
100*7304104dSAndroid Build Coastguard Worker      location (exprloc) {fbreg(-20)}
101*7304104dSAndroid Build Coastguard Worker    [97] formal_parameter "argv"
102*7304104dSAndroid Build Coastguard Worker      name (strp)
103*7304104dSAndroid Build Coastguard Worker      decl_file (data1)
104*7304104dSAndroid Build Coastguard Worker      decl_line (data1)
105*7304104dSAndroid Build Coastguard Worker      type (ref4)
106*7304104dSAndroid Build Coastguard Worker      location (exprloc) {fbreg(-32), deref}
107*7304104dSAndroid Build Coastguard Worker  [a7] pointer_type
108*7304104dSAndroid Build Coastguard Worker    byte_size (data1)
109*7304104dSAndroid Build Coastguard Worker    type (ref4)
110*7304104dSAndroid Build Coastguard Worker  [ad] base_type "character(kind=1)"
111*7304104dSAndroid Build Coastguard Worker    byte_size (data1)
112*7304104dSAndroid Build Coastguard Worker    encoding (data1)
113*7304104dSAndroid Build Coastguard Worker    name (strp)
114*7304104dSAndroid Build Coastguard Worker  [b4] subprogram "repro"
115*7304104dSAndroid Build Coastguard Worker    name (strp)
116*7304104dSAndroid Build Coastguard Worker    decl_file (data1)
117*7304104dSAndroid Build Coastguard Worker    decl_line (data1)
118*7304104dSAndroid Build Coastguard Worker    main_subprogram (flag_present)
119*7304104dSAndroid Build Coastguard Worker    calling_convention (data1)
120*7304104dSAndroid Build Coastguard Worker    low_pc (addr)
121*7304104dSAndroid Build Coastguard Worker    high_pc (data8)
122*7304104dSAndroid Build Coastguard Worker    frame_base (exprloc) {call_frame_cfa {bregx(7,8)}}
123*7304104dSAndroid Build Coastguard Worker    GNU_all_tail_call_sites (flag_present)
124*7304104dSAndroid Build Coastguard Worker    sibling (ref4)
125*7304104dSAndroid Build Coastguard Worker    [d2] variable "c40pt"
126*7304104dSAndroid Build Coastguard Worker      name (strp)
127*7304104dSAndroid Build Coastguard Worker      decl_file (data1)
128*7304104dSAndroid Build Coastguard Worker      decl_line (data1)
129*7304104dSAndroid Build Coastguard Worker      type (ref4)
130*7304104dSAndroid Build Coastguard Worker      location (exprloc) {fbreg(-128)}
131*7304104dSAndroid Build Coastguard Worker    [e1] variable "span.0"
132*7304104dSAndroid Build Coastguard Worker      name (strp)
133*7304104dSAndroid Build Coastguard Worker      type (ref4)
134*7304104dSAndroid Build Coastguard Worker      artificial (flag_present)
135*7304104dSAndroid Build Coastguard Worker      location (exprloc) {fbreg(-80)}
136*7304104dSAndroid Build Coastguard Worker    [ee] variable "i"
137*7304104dSAndroid Build Coastguard Worker      name (string)
138*7304104dSAndroid Build Coastguard Worker      decl_file (data1)
139*7304104dSAndroid Build Coastguard Worker      decl_line (data1)
140*7304104dSAndroid Build Coastguard Worker      type (ref4)
141*7304104dSAndroid Build Coastguard Worker      location (exprloc) {fbreg(-68)}
142*7304104dSAndroid Build Coastguard Worker    [fb] variable "unpleasant"
143*7304104dSAndroid Build Coastguard Worker      name (strp)
144*7304104dSAndroid Build Coastguard Worker      decl_file (data1)
145*7304104dSAndroid Build Coastguard Worker      decl_line (data1)
146*7304104dSAndroid Build Coastguard Worker      type (ref4)
147*7304104dSAndroid Build Coastguard Worker      location (exprloc) {fbreg(-1008)}
148*7304104dSAndroid Build Coastguard Worker    [10a] lexical_block
149*7304104dSAndroid Build Coastguard Worker      low_pc (addr)
150*7304104dSAndroid Build Coastguard Worker      high_pc (data8)
151*7304104dSAndroid Build Coastguard Worker      sibling (ref4)
152*7304104dSAndroid Build Coastguard Worker      [11f] lexical_block
153*7304104dSAndroid Build Coastguard Worker        low_pc (addr)
154*7304104dSAndroid Build Coastguard Worker        high_pc (data8)
155*7304104dSAndroid Build Coastguard Worker    [131] lexical_block
156*7304104dSAndroid Build Coastguard Worker      low_pc (addr)
157*7304104dSAndroid Build Coastguard Worker      high_pc (data8)
158*7304104dSAndroid Build Coastguard Worker      [142] lexical_block
159*7304104dSAndroid Build Coastguard Worker        low_pc (addr)
160*7304104dSAndroid Build Coastguard Worker        high_pc (data8)
161*7304104dSAndroid Build Coastguard Worker        [153] lexical_block
162*7304104dSAndroid Build Coastguard Worker          low_pc (addr)
163*7304104dSAndroid Build Coastguard Worker          high_pc (data8)
164*7304104dSAndroid Build Coastguard Worker  [167] array_type
165*7304104dSAndroid Build Coastguard Worker    data_location (exprloc) {push_object_address, deref}
166*7304104dSAndroid Build Coastguard Worker    associated (exprloc) {push_object_address, deref, lit0, ne}
167*7304104dSAndroid Build Coastguard Worker    type (ref4)
168*7304104dSAndroid Build Coastguard Worker    sibling (ref4)
169*7304104dSAndroid Build Coastguard Worker    [178] subrange_type
170*7304104dSAndroid Build Coastguard Worker      lower_bound (exprloc) {push_object_address, plus_uconst(32), deref}
171*7304104dSAndroid Build Coastguard Worker      upper_bound (exprloc) {push_object_address, plus_uconst(40), deref}
172*7304104dSAndroid Build Coastguard Worker      byte_stride (exprloc) {push_object_address, plus_uconst(24), deref, GNU_variable_value([e1]) {fbreg(-80)}, mul}
173*7304104dSAndroid Build Coastguard Worker  [18f] array_type
174*7304104dSAndroid Build Coastguard Worker    type (ref4)
175*7304104dSAndroid Build Coastguard Worker    [194] subrange_type
176*7304104dSAndroid Build Coastguard Worker      type (ref4)
177*7304104dSAndroid Build Coastguard Worker      upper_bound (sdata)
178*7304104dSAndroid Build Coastguard WorkerEOF
179*7304104dSAndroid Build Coastguard Worker
180*7304104dSAndroid Build Coastguard Workerexit 0
181