1#! /bin/sh 2# Copyright (C) 2013, 2021 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# Testfiles generated with: 21# 22# $ cat foo.c 23# int x = 1; 24# int y = 2; 25# 26# for cc in gcc clang; do 27# for v in 4 5; do 28# for w in 32 64; do 29# out="testfile-vars-$cc-dwarf$v-$w.o" 30# "$cc" -m"$w" -Wall -Wextra -gdwarf-"$v" -c foo.c -o "$out" 31# done 32# done 33# done 34 35testfiles testfile-vars-clang-dwarf4-32.o 36testfiles testfile-vars-clang-dwarf4-64.o 37testfiles testfile-vars-clang-dwarf5-32.o 38testfiles testfile-vars-clang-dwarf5-64.o 39testfiles testfile-vars-gcc-dwarf4-32.o 40testfiles testfile-vars-gcc-dwarf4-64.o 41testfiles testfile-vars-gcc-dwarf5-32.o 42testfiles testfile-vars-gcc-dwarf5-64.o 43 44tempfiles varlocs.out 45testrun ${abs_top_builddir}/tests/varlocs --debug --exprlocs -e testfile-vars-clang-dwarf4-32.o | grep exprloc > varlocs.out 46diff -u varlocs.out - <<EOF 47 location (exprloc) {addr(0x0)} 48 location (exprloc) {addr(0x4)} 49EOF 50 51testrun ${abs_top_builddir}/tests/varlocs --debug --exprlocs -e testfile-vars-clang-dwarf4-64.o | grep exprloc > varlocs.out 52diff -u varlocs.out - <<EOF 53 location (exprloc) {addr(0x0)} 54 location (exprloc) {addr(0x4)} 55EOF 56 57testrun ${abs_top_builddir}/tests/varlocs --debug --exprlocs -e testfile-vars-clang-dwarf5-32.o | grep exprloc > varlocs.out 58diff -u varlocs.out - <<EOF 59 location (exprloc) {addr: 0x0} 60 location (exprloc) {addr: 0x4} 61EOF 62 63testrun ${abs_top_builddir}/tests/varlocs --debug --exprlocs -e testfile-vars-clang-dwarf5-32.o | grep exprloc > varlocs.out 64diff -u varlocs.out - <<EOF 65 location (exprloc) {addr: 0x0} 66 location (exprloc) {addr: 0x4} 67EOF 68 69testrun ${abs_top_builddir}/tests/varlocs --debug --exprlocs -e testfile-vars-gcc-dwarf4-32.o | grep exprloc > varlocs.out 70diff -u varlocs.out - <<EOF 71 location (exprloc) {addr(0x0)} 72 location (exprloc) {addr(0x4)} 73EOF 74 75testrun ${abs_top_builddir}/tests/varlocs --debug --exprlocs -e testfile-vars-gcc-dwarf4-64.o | grep exprloc > varlocs.out 76diff -u varlocs.out - <<EOF 77 location (exprloc) {addr(0x0)} 78 location (exprloc) {addr(0x4)} 79EOF 80 81testrun ${abs_top_builddir}/tests/varlocs --debug --exprlocs -e testfile-vars-gcc-dwarf5-32.o | grep exprloc > varlocs.out 82diff -u varlocs.out - <<EOF 83 location (exprloc) {addr(0x0)} 84 location (exprloc) {addr(0x4)} 85EOF 86 87testrun ${abs_top_builddir}/tests/varlocs --debug --exprlocs -e testfile-vars-gcc-dwarf5-64.o | grep exprloc > varlocs.out 88diff -u varlocs.out - <<EOF 89 location (exprloc) {addr(0x0)} 90 location (exprloc) {addr(0x4)} 91EOF 92 93exit 0 94