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.
/* 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
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;
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;
}
#! /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
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