1#! /bin/sh
2# Copyright (C) 2012 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# #include <string.h>
21#
22# #define HELLO "world"
23#
24# int
25# main(int argc, char ** argv)
26# {
27#   return strlen (HELLO);
28# }
29#
30# gcc -gdwarf-4 -g3 -o testfile-macros macro.c
31# gcc -gstrict-dwarf -gdwarf-4 -g3 -o testfile-macinfo macro.c
32
33testfiles testfile-macinfo testfile-macros
34tempfiles readelf.macros.out
35
36status=0
37
38testrun ${abs_top_builddir}/src/readelf --debug-dump=info testfile-macinfo \
39	| grep macro_info > readelf.macros.out ||
40  { echo "*** failure readelf --debug-dump=info testfile-macinfo"; status=1; }
41testrun_compare cat readelf.macros.out <<\EOF
42           macro_info           (sec_offset) 0
43EOF
44
45testrun ${abs_top_builddir}/src/readelf --debug-dump=info testfile-macros \
46	| grep GNU_macros > readelf.macros.out ||
47  { echo "*** failure readelf --debug-dump=info testfile-macros"; status=1; }
48testrun_compare cat readelf.macros.out <<\EOF
49           GNU_macros           (sec_offset) 0
50EOF
51
52exit $status
53