summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-01-14 21:38:16 +0100
committerMark Wielaard <mjw@redhat.com>2015-01-14 21:40:49 +0100
commit47efc3bef9f39a0494f9957b2e5f7da33482865b (patch)
tree1ed457e28cdaacf9ffe9ec3fb1ec92f3ef4fc5e3
parent7c71382294af69f075c891a3418906c842491e4c (diff)
downloadelfutils-47efc3bef9f39a0494f9957b2e5f7da33482865b.tar.gz
tests: Add testfile-debug-types test case.
Test for regression fixed in commit 7c713822: "libdw: fix offset for sig8 lookup in dwarf_formref_die" Signed-off-by: Mark Wielaard <mjw@redhat.com>
-rw-r--r--tests/ChangeLog7
-rw-r--r--tests/Makefile.am5
-rwxr-xr-xtests/run-typeiter.sh14
-rwxr-xr-xtests/testfile-debug-types.bz2bin0 -> 3024 bytes
-rw-r--r--tests/typeiter2.c6
5 files changed, 25 insertions, 7 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 6dd553b9..365d98d7 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-14 Mark Wielaard <mjw@redhat.com>
+
+ * testfile-debug-types.bz2: New testfile.
+ * Makefile.am (EXTRA_DIST): Add testfile-debug-types.bz2.
+ * typeiter2.c (main): Print both name and offset of found form DIE.
+ * run-typeiter.s: Adjust output and add testfile-debug-types.
+
2014-12-26 Mark Wielaard <mjw@redhat.com>
* run-test-archive64.sh: Add nm test.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 303f7836..14adebd5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to create Makefile.in
##
-## Copyright (C) 1996-2014 Red Hat, Inc.
+## Copyright (C) 1996-2015 Red Hat, Inc.
## This file is part of elfutils.
##
## This file is free software; you can redistribute it and/or modify
@@ -280,7 +280,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
linkmap-cut.bz2 linkmap-cut.core.bz2 \
run-aggregate-size.sh testfile-sizes1.o.bz2 testfile-sizes2.o.bz2 \
testfile-sizes3.o.bz2 \
- run-readelf-A.sh testfileppc32attrs.o.bz2
+ run-readelf-A.sh testfileppc32attrs.o.bz2 \
+ testfile-debug-types.bz2
if USE_VALGRIND
valgrind_cmd='valgrind -q --error-exitcode=1 --run-libc-freeres=no'
diff --git a/tests/run-typeiter.sh b/tests/run-typeiter.sh
index 605ee2a2..2687babb 100755
--- a/tests/run-typeiter.sh
+++ b/tests/run-typeiter.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2012 Red Hat, Inc.
+# Copyright (C) 2012, 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -41,14 +41,22 @@
#
# g++ -gdwarf-4 -g -fdebug-types-section
-testfiles testfile59
+# echo 'struct A{ struct B {} x;};A a; A::B b;int main(){return 0;}' \
+# | g++ -x c++ -g -fdebug-types-section -o testfile-debug-types -
+
+testfiles testfile59 testfile-debug-types
testrun_compare ${abs_builddir}/typeiter testfile59 <<\EOF
ok
EOF
testrun_compare ${abs_builddir}/typeiter2 testfile59 <<\EOF
-ok
+ok s1 [25]
+EOF
+
+testrun_compare ${abs_builddir}/typeiter2 testfile-debug-types <<\EOF
+ok A [68]
+ok B [38]
EOF
exit 0
diff --git a/tests/testfile-debug-types.bz2 b/tests/testfile-debug-types.bz2
new file mode 100755
index 00000000..a41f4938
--- /dev/null
+++ b/tests/testfile-debug-types.bz2
Binary files differ
diff --git a/tests/typeiter2.c b/tests/typeiter2.c
index 6ddfa388..35b6a12e 100644
--- a/tests/typeiter2.c
+++ b/tests/typeiter2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012, 2013 Red Hat, Inc.
+/* Copyright (C) 2012, 2013, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <unistd.h>
#include <dwarf.h>
+#include <inttypes.h>
int
main (int argc, char *argv[])
@@ -71,7 +72,8 @@ main (int argc, char *argv[])
if (form == NULL)
printf ("fail\n");
else
- printf ("ok\n");
+ printf ("ok %s [%" PRIx64 "]\n",
+ dwarf_diename (form), dwarf_dieoffset (form));
}
if (dwarf_siblingof (iter, &iter_mem) != 0)