From 47efc3bef9f39a0494f9957b2e5f7da33482865b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 14 Jan 2015 21:38:16 +0100 Subject: 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 --- tests/ChangeLog | 7 +++++++ tests/Makefile.am | 5 +++-- tests/run-typeiter.sh | 14 +++++++++++--- tests/testfile-debug-types.bz2 | Bin 0 -> 3024 bytes tests/typeiter2.c | 6 ++++-- 5 files changed, 25 insertions(+), 7 deletions(-) create mode 100755 tests/testfile-debug-types.bz2 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 + + * 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 * 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 Binary files /dev/null and b/tests/testfile-debug-types.bz2 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 #include #include +#include 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) -- cgit v1.2.1