103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#! /bin/sh
203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# Copyright (C) 2012 Red Hat, Inc.
303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# This file is part of elfutils.
403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#
503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# This file is free software; you can redistribute it and/or modify
603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# it under the terms of the GNU General Public License as published by
703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# the Free Software Foundation; either version 3 of the License, or
803333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# (at your option) any later version.
903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#
1003333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# elfutils is distributed in the hope that it will be useful, but
1103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# WITHOUT ANY WARRANTY; without even the implied warranty of
1203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# GNU General Public License for more details.
1403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#
1503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# You should have received a copy of the GNU General Public License
1603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# along with this program.  If not, see <http://www.gnu.org/licenses/>.
1703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
1803333823c75a1c1887e923828113a1b0fd12020cElliott Hughes. $srcdir/test-subr.sh
1903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
2003333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# #include <string.h>
2103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#
2203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# #define HELLO "world"
2303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#
2403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# int
2503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# main(int argc, char ** argv)
2603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# {
2703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#   return strlen (HELLO);
2803333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# }
2903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#
3003333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# gcc -gdwarf-4 -g3 -o testfile-macros macro.c
3103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# gcc -gstrict-dwarf -gdwarf-4 -g3 -o testfile-macinfo macro.c
3203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
3303333823c75a1c1887e923828113a1b0fd12020cElliott Hughestestfiles testfile-macinfo testfile-macros
3403333823c75a1c1887e923828113a1b0fd12020cElliott Hughestempfiles readelf.macros.out
3503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
3603333823c75a1c1887e923828113a1b0fd12020cElliott Hughesstatus=0
3703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
3803333823c75a1c1887e923828113a1b0fd12020cElliott Hughestestrun ${abs_top_builddir}/src/readelf --debug-dump=info testfile-macinfo \
3903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes	| grep macro_info > readelf.macros.out ||
4003333823c75a1c1887e923828113a1b0fd12020cElliott Hughes  { echo "*** failure readelf --debug-dump=info testfile-macinfo"; status=1; }
4103333823c75a1c1887e923828113a1b0fd12020cElliott Hughestestrun_compare cat readelf.macros.out <<\EOF
4203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes           macro_info           (sec_offset) 0
4303333823c75a1c1887e923828113a1b0fd12020cElliott HughesEOF
4403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
4503333823c75a1c1887e923828113a1b0fd12020cElliott Hughestestrun ${abs_top_builddir}/src/readelf --debug-dump=info testfile-macros \
4603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes	| grep GNU_macros > readelf.macros.out ||
4703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes  { echo "*** failure readelf --debug-dump=info testfile-macros"; status=1; }
4803333823c75a1c1887e923828113a1b0fd12020cElliott Hughestestrun_compare cat readelf.macros.out <<\EOF
4903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes           GNU_macros           (sec_offset) 0
5003333823c75a1c1887e923828113a1b0fd12020cElliott HughesEOF
5103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
5203333823c75a1c1887e923828113a1b0fd12020cElliott Hughesexit $status
53