]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests: Add testfile-debug-types test case.
authorMark Wielaard <mjw@redhat.com>
Wed, 14 Jan 2015 20:38:16 +0000 (21:38 +0100)
committerMark Wielaard <mjw@redhat.com>
Wed, 14 Jan 2015 20:40:49 +0000 (21:40 +0100)
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>
tests/ChangeLog
tests/Makefile.am
tests/run-typeiter.sh
tests/testfile-debug-types.bz2 [new file with mode: 0755]
tests/typeiter2.c

index 6dd553b95910980aa8922948e872feb3d7bf2df3..365d98d70d03173db84c364ae14703e2b65400d2 100644 (file)
@@ -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.
index 303f78369006ca37e158b20511345cea94d892df..14adebd524f6e6101e7b71511581e7006c3f64c0 100644 (file)
@@ -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'
index 605ee2a2efa37f9c2877932221922a013a63ccb3..2687babba9794f7146439ea0523352cdcf04c84f 100755 (executable)
@@ -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
 #
 # 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 (executable)
index 0000000..a41f493
Binary files /dev/null and b/tests/testfile-debug-types.bz2 differ
index 6ddfa388d6ec6842a25c19fd60d93357d001189e..35b6a12e8411dd5fc27c5a7af17e1408c68c967f 100644 (file)
@@ -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)