#! /bin/sh
# Copyright (C) 2014, 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# elfutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
. $srcdir/test-subr.sh
# // g++ dwarfinlines.cpp -g -o testfiledwarfinlines -O2
# int
# fubar (int x)
# {
# __asm__ ( "nop" ::: );
# return 42 / x - 2;
# }
#
# void foobar (int z1, int z2)
# {
# __asm__ ( "nop" ::: );
# int x = z1 + z2;
# while (z1 + x + 1 != 42)
# x = fubar (z1 + z2 + x);
# }
#
# void bar (int z)
# {
# int a, b;
# a = b = z / 2;
# foobar(a, b);
# }
#
# void foo (int x)
# {
# if (x > 0)
# bar(x - 2);
# }
#
# void fu (int y)
# {
# __asm__ ( "nop" ::: );
# foo (y + 1);
# }
#
# int
# main (int argc, char **argv)
# {
# fu (argc);
# }
testfiles testfiledwarfinlines testfiledwarfinlines.core
# Depending on whether we are running make check or make installcheck
# the actual binary name under test might be different. It is used in
# the error message, which we also try to match.
if test "$elfutils_testrun" = "installed"; then
STACKCMD=${bindir}/`program_transform stack`
else
STACKCMD=${abs_top_builddir}/src/stack
fi
# Without -d the top function comes out as fu. Use --raw to not demangle.
testrun_compare ${abs_top_builddir}/src/stack -r -n 2 -e testfiledwarfinlines --core testfiledwarfinlines.core<