public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] tests: Run run-low_high_pc.sh testcase on split dwarf files.
@ 2018-05-31 12:16 Mark Wielaard
  2018-06-01 11:18 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2018-05-31 12:16 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

Test that the low high pc attributes can be properly resolved also
in split dwarf setups.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 tests/ChangeLog          |  9 +++++++++
 tests/low_high_pc.c      | 28 ++++++++++++++++++++++++++--
 tests/run-low_high_pc.sh | 15 +++++++++++----
 3 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 521df52..c03db54 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,14 @@
 2018-05-31  Mark Wielaard  <mark@klomp.org>
 
+	* low_high_pc.c (handle_die): Handle NULL name. Print offset and
+	name of die.
+	(main): Check if the cu DIE is a skeleton, then get and handle
+	the split subdie.
+	* run-low-high-pc.sh: Run on testfile-splitdwarf-4 and
+	testfile-splitdwarf-5. Run on all selftest files.
+
+2018-05-31  Mark Wielaard  <mark@klomp.org>
+
 	* get-units-invalid.c (main): Check dwarf_cuoffset and
 	dwarf_dieoffset.
 
diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
index d0f4302..5c6b343 100644
--- a/tests/low_high_pc.c
+++ b/tests/low_high_pc.c
@@ -1,5 +1,5 @@
 /* Test program for dwarf_lowpc and dwarf_highpc
-   Copyright (C) 2012 Red Hat, Inc.
+   Copyright (C) 2012, 2018 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -55,7 +55,9 @@ handle_die (Dwarf_Die *die, void *arg)
 
   const char *name = dwarf_diename (die);
   if (name == NULL)
-    fail (off, "<no name>", "die without a name");
+    name = "<no name>";
+
+  printf ("[%" PRIx64 "] %s\n", off, name);
 
   Dwarf_Addr lowpc = 0;
   Dwarf_Addr highpc = 0;
@@ -101,9 +103,31 @@ main (int argc, char *argv[])
       a.file = dwarf_diename (a.cu);
       handle_die (a.cu, &a);
       dwarf_getfuncs (a.cu, &handle_die, &a, 0);
+
+      uint8_t unit_type;
+      Dwarf_Die subdie;
+      if (dwarf_cu_info (a.cu->cu, NULL, &unit_type, NULL, &subdie,
+			 NULL, NULL, NULL) != 0)
+	{
+	  Dwarf_Off off = dwarf_dieoffset (a.cu);
+	  fail (off, "dwarf_cu_info", dwarf_errmsg (-1));
+	}
+
+      if (unit_type == DW_UT_skeleton)
+	{
+	  const char *name = dwarf_diename (&subdie) ?: "<unknown>";
+	  printf ("Following split subdie: %s\n", name);
+	  struct args b = a;
+	  b.cu = &subdie;
+	  handle_die (b.cu, &b);
+	  dwarf_getfuncs (b.cu, &handle_die, &b, 0);
+	  printf ("Done subdie: %s\n", name);
+	}
     }
 
   dwfl_end (a.dwfl);
 
+  printf ("\n");
+
   return result;
 }
diff --git a/tests/run-low_high_pc.sh b/tests/run-low_high_pc.sh
index ab5f2c3..41ec420 100755
--- a/tests/run-low_high_pc.sh
+++ b/tests/run-low_high_pc.sh
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005 Red Hat, Inc.
+# Copyright (C) 2005, 2018 Red Hat, Inc.
 # This file is part of elfutils.
 #
 # This file is free software; you can redistribute it and/or modify
@@ -27,8 +27,15 @@ testfiles testfile_low_high_pc
 
 testrun ${abs_builddir}/low_high_pc -e ./testfile_low_high_pc
 testrun ${abs_builddir}/low_high_pc -e ${abs_builddir}/low_high_pc
-testrun ${abs_builddir}/low_high_pc -e ${abs_top_builddir}/src/strip
-testrun ${abs_builddir}/low_high_pc -e ${abs_top_builddir}/src/strip.o
-testrun ${abs_builddir}/low_high_pc -e ${abs_top_builddir}/libelf/libelf.so
+
+# see tests/testfile-dwarf-45.source
+testfiles testfile-splitdwarf-4 testfile-splitdwarf-5
+testfiles testfile-hello4.dwo testfile-hello5.dwo
+testfiles testfile-world4.dwo testfile-world5.dwo
+
+testrun ${abs_builddir}/low_high_pc -e testfile-splitdwarf-4
+testrun ${abs_builddir}/low_high_pc -e testfile-splitdwarf-5
+
+testrun_on_self ${abs_builddir}/low_high_pc -e
 
 exit 0
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] tests: Run run-low_high_pc.sh testcase on split dwarf files.
  2018-05-31 12:16 [PATCH] tests: Run run-low_high_pc.sh testcase on split dwarf files Mark Wielaard
@ 2018-06-01 11:18 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2018-06-01 11:18 UTC (permalink / raw)
  To: elfutils-devel

On Thu, 2018-05-31 at 14:16 +0200, Mark Wielaard wrote:
> Test that the low high pc attributes can be properly resolved also
> in split dwarf setups.

Pushed to master.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-01 11:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-31 12:16 [PATCH] tests: Run run-low_high_pc.sh testcase on split dwarf files Mark Wielaard
2018-06-01 11:18 ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).