1da0c48c4Sopenharmony_ci#! /bin/sh 2da0c48c4Sopenharmony_ci# Copyright (C) 2013 Red Hat, Inc. 3da0c48c4Sopenharmony_ci# This file is part of elfutils. 4da0c48c4Sopenharmony_ci# 5da0c48c4Sopenharmony_ci# This file is free software; you can redistribute it and/or modify 6da0c48c4Sopenharmony_ci# it under the terms of the GNU General Public License as published by 7da0c48c4Sopenharmony_ci# the Free Software Foundation; either version 3 of the License, or 8da0c48c4Sopenharmony_ci# (at your option) any later version. 9da0c48c4Sopenharmony_ci# 10da0c48c4Sopenharmony_ci# elfutils is distributed in the hope that it will be useful, but 11da0c48c4Sopenharmony_ci# WITHOUT ANY WARRANTY; without even the implied warranty of 12da0c48c4Sopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13da0c48c4Sopenharmony_ci# GNU General Public License for more details. 14da0c48c4Sopenharmony_ci# 15da0c48c4Sopenharmony_ci# You should have received a copy of the GNU General Public License 16da0c48c4Sopenharmony_ci# along with this program. If not, see <http://www.gnu.org/licenses/>. 17da0c48c4Sopenharmony_ci 18da0c48c4Sopenharmony_ci. $srcdir/test-subr.sh 19da0c48c4Sopenharmony_ci 20da0c48c4Sopenharmony_citestfiles testfile 21da0c48c4Sopenharmony_citempfiles good.out stdin.nl stdin.nl.out stdin.nonl stdin.nonl.out foo.out 22da0c48c4Sopenharmony_citempfiles addr2line.out 23da0c48c4Sopenharmony_ci 24da0c48c4Sopenharmony_cicat > good.out <<\EOF 25da0c48c4Sopenharmony_cifoo 26da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/f.c:3 27da0c48c4Sopenharmony_cibar 28da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/b.c:4 29da0c48c4Sopenharmony_cifoo 30da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/f.c:3 31da0c48c4Sopenharmony_cibar 32da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/b.c:4 33da0c48c4Sopenharmony_cifoo 34da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/f.c:3 35da0c48c4Sopenharmony_cibar 36da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/b.c:4 37da0c48c4Sopenharmony_cifoo 38da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/f.c:3 39da0c48c4Sopenharmony_cibar 40da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/b.c:4 41da0c48c4Sopenharmony_ciEOF 42da0c48c4Sopenharmony_ci 43da0c48c4Sopenharmony_ciecho "# Everything on the command line" 44da0c48c4Sopenharmony_cicat good.out | testrun_compare ${abs_top_builddir}/src/addr2line -f -e testfile 0x08048468 0x0804845c foo bar foo+0x0 bar+0x0 foo-0x0 bar-0x0 45da0c48c4Sopenharmony_ci 46da0c48c4Sopenharmony_cicat > stdin.nl <<\EOF 47da0c48c4Sopenharmony_ci0x08048468 48da0c48c4Sopenharmony_ci0x0804845c 49da0c48c4Sopenharmony_cifoo 50da0c48c4Sopenharmony_cibar 51da0c48c4Sopenharmony_cifoo+0x0 52da0c48c4Sopenharmony_cibar+0x0 53da0c48c4Sopenharmony_cifoo-0x0 54da0c48c4Sopenharmony_cibar-0x0 55da0c48c4Sopenharmony_ciEOF 56da0c48c4Sopenharmony_ci 57da0c48c4Sopenharmony_ciecho "# Everything from stdin (with newlines)." 58da0c48c4Sopenharmony_cicat stdin.nl | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nl.out || exit 1 59da0c48c4Sopenharmony_cicmp good.out stdin.nl.out || exit 1 60da0c48c4Sopenharmony_ci 61da0c48c4Sopenharmony_cicat > foo.out <<\EOF 62da0c48c4Sopenharmony_cifoo 63da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/f.c:3 64da0c48c4Sopenharmony_ciEOF 65da0c48c4Sopenharmony_ci 66da0c48c4Sopenharmony_ciecho "# stdin without newline address, just EOF." 67da0c48c4Sopenharmony_ciecho -n "0x08048468" | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nonl.out || exit 1 68da0c48c4Sopenharmony_cicmp foo.out stdin.nonl.out || exit 1 69da0c48c4Sopenharmony_ci 70da0c48c4Sopenharmony_ciecho "# stdin without newline symbol, just EOF." 71da0c48c4Sopenharmony_ciecho -n "foo" | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nl.out || exit 1 72da0c48c4Sopenharmony_cicmp foo.out stdin.nonl.out || exit 1 73da0c48c4Sopenharmony_ci 74da0c48c4Sopenharmony_citempfiles good.addr.out 75da0c48c4Sopenharmony_ci 76da0c48c4Sopenharmony_cicat > good.addr.out <<\EOF 77da0c48c4Sopenharmony_ci0x08048468 78da0c48c4Sopenharmony_cifoo 79da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/f.c:3 80da0c48c4Sopenharmony_ci0x0804845c 81da0c48c4Sopenharmony_cibar 82da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/b.c:4 83da0c48c4Sopenharmony_ci0x08048468 84da0c48c4Sopenharmony_cifoo 85da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/f.c:3 86da0c48c4Sopenharmony_ci0x0804845c 87da0c48c4Sopenharmony_cibar 88da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/b.c:4 89da0c48c4Sopenharmony_ci0x08048468 90da0c48c4Sopenharmony_cifoo 91da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/f.c:3 92da0c48c4Sopenharmony_ci0x0804845c 93da0c48c4Sopenharmony_cibar 94da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/b.c:4 95da0c48c4Sopenharmony_ci0x08048468 96da0c48c4Sopenharmony_cifoo 97da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/f.c:3 98da0c48c4Sopenharmony_ci0x0804845c 99da0c48c4Sopenharmony_cibar 100da0c48c4Sopenharmony_ci/home/drepper/gnu/new-bu/build/ttt/b.c:4 101da0c48c4Sopenharmony_ciEOF 102da0c48c4Sopenharmony_ci 103da0c48c4Sopenharmony_ciecho "# Everything on the command line with addresses" 104da0c48c4Sopenharmony_cicat good.addr.out | testrun_compare ${abs_top_builddir}/src/addr2line -a -f -e testfile 0x08048468 0x0804845c foo bar foo+0x0 bar+0x0 foo-0x0 bar-0x0 105da0c48c4Sopenharmony_ci 106da0c48c4Sopenharmony_ciecho "# Everything from stdin (with newlines) with addresses." 107da0c48c4Sopenharmony_cicat stdin.nl | testrun ${abs_top_builddir}/src/addr2line -a -f -e testfile > stdin.nl.out || exit 1 108da0c48c4Sopenharmony_cicmp good.addr.out stdin.nl.out || exit 1 109da0c48c4Sopenharmony_ci 110da0c48c4Sopenharmony_ciecho "# Pretty with functions and addresses." 111da0c48c4Sopenharmony_citestrun_compare ${abs_top_builddir}/src/addr2line --pretty -a -f -e testfile 0x08048468 0x0804845c << EOF 112da0c48c4Sopenharmony_ci0x08048468: foo at /home/drepper/gnu/new-bu/build/ttt/f.c:3 113da0c48c4Sopenharmony_ci0x0804845c: bar at /home/drepper/gnu/new-bu/build/ttt/b.c:4 114da0c48c4Sopenharmony_ciEOF 115da0c48c4Sopenharmony_ci 116da0c48c4Sopenharmony_ciexit 0 117