summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2012-06-25 17:18:53 +0200
committerMark Wielaard <[email protected]>2012-06-27 10:02:59 +0200
commita0172d75311f36adb6db58000474d31f8a9cd553 (patch)
tree39bce79b9c203afcb2283f3d0994830999c912c2 /tests
parentb2589ffa7c2bec754952acc8116e03853d65563d (diff)
Add low-level support for .debug_macro.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog6
-rw-r--r--tests/Makefile.am6
-rwxr-xr-xtests/run-macro-test.sh53
-rwxr-xr-xtests/testfile-macinfo.bz2bin0 -> 6689 bytes
-rwxr-xr-xtests/testfile-macros.bz2bin0 -> 7882 bytes
5 files changed, 63 insertions, 2 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 6f5e4584..9b649173 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2012-06-26 Mark Wielaard <[email protected]>
+
+ * run-macro-test.sh: New test.
+ * testfile-macinfo.bz2: New testfile.
+ * testfile-macros.bz2: Likewise.
+
2012-05-07 Mark Wielaard <[email protected]>
* low_high_pc.c: Use proper inttypes in printf formats.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ced7831b..39e58ae8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -79,7 +79,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-early-offscn.sh run-dwarf-getmacros.sh \
run-test-flag-nobits.sh run-prelink-addr-test.sh \
run-dwarf-getstring.sh run-rerequest_tag.sh run-typeiter.sh \
- run-readelf-d.sh run-unstrip-n.sh run-low_high_pc.sh
+ run-readelf-d.sh run-unstrip-n.sh run-low_high_pc.sh \
+ run-macro-test.sh
if !STANDALONE
noinst_PROGRAMS += msg_tst md5-sha1-test
@@ -157,7 +158,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
run-typeiter.sh testfile59.bz2 \
run-readelf-d.sh testlib_dynseg.so.bz2 \
run-unstrip-n.sh testcore-rtlib.bz2 \
- run-low_high_pc.sh testfile_low_high_pc.bz2
+ run-low_high_pc.sh testfile_low_high_pc.bz2 \
+ run-macro-test.sh testfile-macinfo.bz2 testfile-macros.bz2
installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
bindir=$(DESTDIR)$(bindir) \
diff --git a/tests/run-macro-test.sh b/tests/run-macro-test.sh
new file mode 100755
index 00000000..70a16edf
--- /dev/null
+++ b/tests/run-macro-test.sh
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# #include <string.h>
+#
+# #define HELLO "world"
+#
+# int
+# main(int argc, char ** argv)
+# {
+# return strlen (HELLO);
+# }
+#
+# gcc -gdwarf-4 -g3 -o testfile-macros macro.c
+# gcc -gstrict-dwarf -gdwarf-4 -g3 -o testfile-macinfo macro.c
+
+testfiles testfile-macinfo testfile-macros
+
+status=0
+
+testrun ../src/readelf --debug-dump=info testfile-macinfo \
+ | grep macro_info > readelf.macros.out ||
+ { echo "*** failure readelf --debug-dump=info testfile-macinfo"; status=1; }
+testrun_compare cat readelf.macros.out <<\EOF
+ macro_info (sec_offset) 0
+EOF
+
+testrun ../src/readelf --debug-dump=info testfile-macros \
+ | grep GNU_macros > readelf.macros.out ||
+ { echo "*** failure readelf --debug-dump=info testfile-macros"; status=1; }
+testrun_compare cat readelf.macros.out <<\EOF
+ GNU_macros (sec_offset) 0
+EOF
+
+rm -f readelf.macros.out
+
+exit $status
diff --git a/tests/testfile-macinfo.bz2 b/tests/testfile-macinfo.bz2
new file mode 100755
index 00000000..e6cc5f1c
--- /dev/null
+++ b/tests/testfile-macinfo.bz2
Binary files differ
diff --git a/tests/testfile-macros.bz2 b/tests/testfile-macros.bz2
new file mode 100755
index 00000000..d74df94c
--- /dev/null
+++ b/tests/testfile-macros.bz2
Binary files differ