1#! /bin/sh 2# Copyright (C) 2013 Red Hat, Inc. 3# This file is part of elfutils. 4# 5# This file is free software; you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation; either version 3 of the License, or 8# (at your option) any later version. 9# 10# elfutils is distributed in the hope that it will be useful, but 11# WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18. $srcdir/test-subr.sh 19 20# See the source files testfile_const_type.c testfile_implicit_value.c 21# testfile_entry_value.c testfile_parameter_ref.c testfile_implicit_pointer.c 22# how to regenerate the test files (needs GCC 4.8+). 23 24testfiles testfile_const_type testfile_implicit_value testfile_entry_value 25testfiles testfile_parameter_ref testfile_implicit_pointer 26 27testrun_compare ${abs_top_builddir}/tests/varlocs -e testfile_const_type <<\EOF 28module 'testfile_const_type' 29[b] CU 'const_type.c'@0 30 [33] function 'f1'@80483f0 31 frame_base: {call_frame_cfa {bregx(4,4)}} 32 [4b] parameter 'd' 33 [80483f0,804841b) {fbreg(0)} 34 [57] variable 'w' 35 [80483f0,804841b) {fbreg(0), GNU_deref_type(8){long long int,signed,64@[25]}, GNU_const_type{long long int,signed,64@[25]}(8)[0000806745230100], div, GNU_convert{long long unsigned int,unsigned,64@[2c]}, stack_value} 36 [7d] function 'main'@80482f0 37 frame_base: {call_frame_cfa {bregx(4,4)}} 38EOF 39 40testrun_compare ${abs_top_builddir}/tests/varlocs -e testfile_implicit_value <<\EOF 41module 'testfile_implicit_value' 42[b] CU 'implicit_value.c'@0 43 [25] function 'foo'@80483f0 44 frame_base: {call_frame_cfa {bregx(4,4)}} 45 [3e] variable 'a' 46 [80483f0,80483f6) {implicit_value(8){0200000000000000}, piece(8), implicit_value(8){1500000000000000}, piece(8)} 47 [86] function 'main'@80482f0 48 frame_base: {call_frame_cfa {bregx(4,4)}} 49EOF 50 51testrun_compare ${abs_top_builddir}/tests/varlocs -e testfile_entry_value <<\EOF 52module 'testfile_entry_value' 53[b] CU 'entry_value.c'@0 54 [29] function 'foo'@400500 55 frame_base: {call_frame_cfa {bregx(7,8)}} 56 [4a] parameter 'x' 57 [400500,400504) {reg5} 58 [55] parameter 'y' 59 [400500,400504) {reg4} 60 [68] function 'bar'@400510 61 frame_base: {call_frame_cfa {bregx(7,8)}} 62 [89] parameter 'x' 63 [400510,40051c) {reg5} 64 [40051c,40052b) {reg6} 65 [40052b,400531) {GNU_entry_value(1) {reg5}, stack_value} 66 [96] parameter 'y' 67 [400510,40051c) {reg4} 68 [40051c,40052a) {reg3} 69 [40052a,400531) {GNU_entry_value(1) {reg4}, stack_value} 70 [a3] variable 'z' 71 [400524,400528) {reg0} 72 [400528,400529) {reg12} 73 [400529,40052e) {breg0(0), breg12(0), plus, stack_value} 74 [40052e,400531) {reg0} 75 [e9] function 'main'@400400 76 frame_base: {call_frame_cfa {bregx(7,8)}} 77 [10a] parameter 'argc' 78 [400400,400406) {reg5} 79 [400406,40040a) {breg5(-1), stack_value} 80 [40040a,40040b) {GNU_entry_value(1) {reg5}, stack_value} 81 [119] parameter 'argv' 82 [400400,400403) {reg4} 83 [400403,40040b) {GNU_entry_value(1) {reg4}, stack_value} 84EOF 85 86testrun_compare ${abs_top_builddir}/tests/varlocs -e testfile_parameter_ref <<\EOF 87module 'testfile_parameter_ref' 88[b] CU 'parameter_ref.c'@0 89 [77] function 'foo'@400510 90 frame_base: {call_frame_cfa {bregx(7,8)}} 91 [92] parameter 'x' 92 [400510,400523) {reg5} 93 [99] parameter 'y' 94 [400510,400523) {GNU_parameter_ref[42], stack_value} 95 [a5] variable 'a' 96 [400510,400523) {breg5(0), lit1, shl, stack_value} 97 [b0] variable 'b' 98 [400510,400523) {GNU_parameter_ref[42], lit1, shl, stack_value} 99 [be] variable 'c' 100 <constant value> 101 [c4] parameter 'z' 102 <constant value> 103 [cb] function 'main'@400400 104 frame_base: {call_frame_cfa {bregx(7,8)}} 105 [ec] parameter 'x' 106 [400400,400408) {reg5} 107 [400408,400421) {reg3} 108 [400421,400423) {GNU_entry_value(1) {reg5}, stack_value} 109 [f9] parameter 'argv' 110 [400400,400408) {reg4} 111 [400408,400423) {GNU_entry_value(1) {reg4}, stack_value} 112EOF 113 114testrun_compare ${abs_top_builddir}/tests/varlocs -e testfile_implicit_pointer <<\EOF 115module 'testfile_implicit_pointer' 116[b] CU 'implicit_pointer.c'@0 117 [29] function 'foo'@400500 118 frame_base: {call_frame_cfa {bregx(7,8)}} 119 [4a] parameter 'i' 120 [400500,400503) {reg5} 121 [55] variable 'p' 122 [400500,400503) {GNU_implicit_pointer([4a],0) {reg5}} 123 [73] function 'main'@400400 124 frame_base: {call_frame_cfa {bregx(7,8)}} 125EOF 126 127 128exit 0 129