1*7304104dSAndroid Build Coastguard Worker#! /bin/sh 2*7304104dSAndroid Build Coastguard Worker# Test for dwarf_getcfi. 3*7304104dSAndroid Build Coastguard Worker# Copyright (C) 2018 Red Hat, Inc. 4*7304104dSAndroid Build Coastguard Worker# This file is part of elfutils. 5*7304104dSAndroid Build Coastguard Worker# 6*7304104dSAndroid Build Coastguard Worker# This file is free software; you can redistribute it and/or modify 7*7304104dSAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by 8*7304104dSAndroid Build Coastguard Worker# the Free Software Foundation; either version 3 of the License, or 9*7304104dSAndroid Build Coastguard Worker# (at your option) any later version. 10*7304104dSAndroid Build Coastguard Worker# 11*7304104dSAndroid Build Coastguard Worker# elfutils is distributed in the hope that it will be useful, but 12*7304104dSAndroid Build Coastguard Worker# WITHOUT ANY WARRANTY; without even the implied warranty of 13*7304104dSAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*7304104dSAndroid Build Coastguard Worker# GNU General Public License for more details. 15*7304104dSAndroid Build Coastguard Worker# 16*7304104dSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License 17*7304104dSAndroid Build Coastguard Worker# along with this program. If not, see <http://www.gnu.org/licenses/>. 18*7304104dSAndroid Build Coastguard Worker 19*7304104dSAndroid Build Coastguard Worker. $srcdir/test-subr.sh 20*7304104dSAndroid Build Coastguard Worker 21*7304104dSAndroid Build Coastguard Worker# Test files come from run-addrcfi with all sections stripped except 22*7304104dSAndroid Build Coastguard Worker# the .debug_frame. 23*7304104dSAndroid Build Coastguard Worker# for i in <testfiles> 24*7304104dSAndroid Build Coastguard Worker# eu-strip -f $i-debugframe $i 25*7304104dSAndroid Build Coastguard Worker# eu-strip -g --remove-comment --keep-section=.debug_frame $i-debugframe 26*7304104dSAndroid Build Coastguard Worker# done 27*7304104dSAndroid Build Coastguard Workertestfiles testfile11-debugframe testfile12-debugframe 28*7304104dSAndroid Build Coastguard Workertestfiles testfileaarch64-debugframe 29*7304104dSAndroid Build Coastguard Workertestfiles testfilearm-debugframe 30*7304104dSAndroid Build Coastguard Workertestfiles testfileppc32-debugframe 31*7304104dSAndroid Build Coastguard Workertestfiles testfileppc64-debugframe 32*7304104dSAndroid Build Coastguard Worker 33*7304104dSAndroid Build Coastguard Workertestfiles testfile11-debugframe 34*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_builddir}/dwarfcfi testfile11-debugframe 0x080489b8 <<\EOF 35*7304104dSAndroid Build Coastguard Worker0x80489b8 => [0x80489b8, 0x80489b9): 36*7304104dSAndroid Build Coastguard Worker return address in reg8 37*7304104dSAndroid Build Coastguard Worker CFA location expression: bregx(4,4) 38*7304104dSAndroid Build Coastguard Worker reg0: undefined 39*7304104dSAndroid Build Coastguard Worker reg1: undefined 40*7304104dSAndroid Build Coastguard Worker reg2: undefined 41*7304104dSAndroid Build Coastguard Worker reg3: same_value 42*7304104dSAndroid Build Coastguard Worker reg4: location expression: call_frame_cfa stack_value 43*7304104dSAndroid Build Coastguard Worker reg5: same_value 44*7304104dSAndroid Build Coastguard Worker reg6: same_value 45*7304104dSAndroid Build Coastguard Worker reg7: same_value 46*7304104dSAndroid Build Coastguard Worker reg8: location expression: call_frame_cfa plus_uconst(-4) 47*7304104dSAndroid Build Coastguard Worker reg9: undefined 48*7304104dSAndroid Build Coastguard WorkerEOF 49*7304104dSAndroid Build Coastguard Worker 50*7304104dSAndroid Build Coastguard Workertestfiles testfile12-debugframe 51*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_builddir}/dwarfcfi testfile12-debugframe 0x00000000000009d0 <<\EOF 52*7304104dSAndroid Build Coastguard Worker0x9d0 => [0x9d0, 0x9d1): 53*7304104dSAndroid Build Coastguard Worker return address in reg16 54*7304104dSAndroid Build Coastguard Worker CFA location expression: bregx(7,8) 55*7304104dSAndroid Build Coastguard Worker reg0: same_value 56*7304104dSAndroid Build Coastguard Worker reg1: undefined 57*7304104dSAndroid Build Coastguard Worker reg2: undefined 58*7304104dSAndroid Build Coastguard Worker reg3: undefined 59*7304104dSAndroid Build Coastguard Worker reg4: undefined 60*7304104dSAndroid Build Coastguard Worker reg5: undefined 61*7304104dSAndroid Build Coastguard Worker reg6: same_value 62*7304104dSAndroid Build Coastguard Worker reg7: location expression: call_frame_cfa stack_value 63*7304104dSAndroid Build Coastguard Worker reg8: undefined 64*7304104dSAndroid Build Coastguard Worker reg9: undefined 65*7304104dSAndroid Build Coastguard WorkerEOF 66*7304104dSAndroid Build Coastguard Worker 67*7304104dSAndroid Build Coastguard Workertestfiles testfileppc32-debugframe 68*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_builddir}/dwarfcfi testfileppc32-debugframe 0x100004c0 <<\EOF 69*7304104dSAndroid Build Coastguard Worker0x100004c0 => [0x100004c0, 0x100004d0): 70*7304104dSAndroid Build Coastguard Worker return address in reg65 71*7304104dSAndroid Build Coastguard Worker CFA location expression: bregx(1) 72*7304104dSAndroid Build Coastguard Worker reg0: undefined 73*7304104dSAndroid Build Coastguard Worker reg1: location expression: call_frame_cfa stack_value 74*7304104dSAndroid Build Coastguard Worker reg2: same_value 75*7304104dSAndroid Build Coastguard Worker reg3: undefined 76*7304104dSAndroid Build Coastguard Worker reg4: undefined 77*7304104dSAndroid Build Coastguard Worker reg5: undefined 78*7304104dSAndroid Build Coastguard Worker reg6: undefined 79*7304104dSAndroid Build Coastguard Worker reg7: undefined 80*7304104dSAndroid Build Coastguard Worker reg8: undefined 81*7304104dSAndroid Build Coastguard Worker reg9: undefined 82*7304104dSAndroid Build Coastguard WorkerEOF 83*7304104dSAndroid Build Coastguard Worker 84*7304104dSAndroid Build Coastguard Workertestfiles testfileppc64-debugframe 85*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_builddir}/dwarfcfi testfileppc64-debugframe 0x00000000100005b0 <<\EOF 86*7304104dSAndroid Build Coastguard Worker0x100005b0 => [0x100005b0, 0x100005d0): 87*7304104dSAndroid Build Coastguard Worker return address in reg65 88*7304104dSAndroid Build Coastguard Worker CFA location expression: bregx(1) 89*7304104dSAndroid Build Coastguard Worker reg0: undefined 90*7304104dSAndroid Build Coastguard Worker reg1: location expression: call_frame_cfa stack_value 91*7304104dSAndroid Build Coastguard Worker reg2: same_value 92*7304104dSAndroid Build Coastguard Worker reg3: undefined 93*7304104dSAndroid Build Coastguard Worker reg4: undefined 94*7304104dSAndroid Build Coastguard Worker reg5: undefined 95*7304104dSAndroid Build Coastguard Worker reg6: undefined 96*7304104dSAndroid Build Coastguard Worker reg7: undefined 97*7304104dSAndroid Build Coastguard Worker reg8: undefined 98*7304104dSAndroid Build Coastguard Worker reg9: undefined 99*7304104dSAndroid Build Coastguard WorkerEOF 100*7304104dSAndroid Build Coastguard Worker 101*7304104dSAndroid Build Coastguard Workertestfiles testfilearm-debugframe 102*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_builddir}/dwarfcfi testfilearm-debugframe 0x00008510 <<\EOF 103*7304104dSAndroid Build Coastguard Worker0x8510 => [0x8510, 0x8524): 104*7304104dSAndroid Build Coastguard Worker return address in reg14 105*7304104dSAndroid Build Coastguard Worker CFA location expression: bregx(13) 106*7304104dSAndroid Build Coastguard Worker reg0: undefined 107*7304104dSAndroid Build Coastguard Worker reg1: undefined 108*7304104dSAndroid Build Coastguard Worker reg2: undefined 109*7304104dSAndroid Build Coastguard Worker reg3: undefined 110*7304104dSAndroid Build Coastguard Worker reg4: same_value 111*7304104dSAndroid Build Coastguard Worker reg5: same_value 112*7304104dSAndroid Build Coastguard Worker reg6: same_value 113*7304104dSAndroid Build Coastguard Worker reg7: same_value 114*7304104dSAndroid Build Coastguard Worker reg8: same_value 115*7304104dSAndroid Build Coastguard Worker reg9: undefined 116*7304104dSAndroid Build Coastguard WorkerEOF 117*7304104dSAndroid Build Coastguard Worker 118*7304104dSAndroid Build Coastguard Workertestfiles testfileaarch64-debugframe 119*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_builddir}/dwarfcfi testfileaarch64-debugframe 0x400550 <<\EOF 120*7304104dSAndroid Build Coastguard Worker0x400550 => [0x400550, 0x400568): 121*7304104dSAndroid Build Coastguard Worker return address in reg30 122*7304104dSAndroid Build Coastguard Worker CFA location expression: bregx(31) 123*7304104dSAndroid Build Coastguard Worker reg0: undefined 124*7304104dSAndroid Build Coastguard Worker reg1: undefined 125*7304104dSAndroid Build Coastguard Worker reg2: undefined 126*7304104dSAndroid Build Coastguard Worker reg3: undefined 127*7304104dSAndroid Build Coastguard Worker reg4: undefined 128*7304104dSAndroid Build Coastguard Worker reg5: undefined 129*7304104dSAndroid Build Coastguard Worker reg6: undefined 130*7304104dSAndroid Build Coastguard Worker reg7: undefined 131*7304104dSAndroid Build Coastguard Worker reg8: undefined 132*7304104dSAndroid Build Coastguard Worker reg9: undefined 133*7304104dSAndroid Build Coastguard WorkerEOF 134