summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2018-05-29 23:49:21 +0200
committerMark Wielaard <[email protected]>2018-05-31 17:03:19 +0200
commit7d6fe0a39f6ae5c516ffd63558e12b24297bf982 (patch)
tree30469e6da3f107797bb69a1d0a480eafc4ba50fd /tests
parentb37feac1a8ceebb0748cb28d219aa8387d0885dd (diff)
libdw: Handle split Dwarf Dies in dwarf_die_addr_die.
dwarf_die_addr_die can be used to turn an Dwarf_Die addr back into a full Dwarf_Die, just given the original Dwarf debug handle. This now also works for Dwarf_Dies which originated from a split Dwarf. Whenever a split Dwarf_CU is found the Dwarf it originated from is registered with the Dwarf that the skeleton Dwarf_CU came from. All registered split Dwarfs are then searched by dwarf_die_addr_die if the addr didn't match the main Dwarf or the alt Dwarf. One limitation in this implementation is that only DIEs that come from the main .debug_info in the .dwo are supported. Theoretically there could also be DIEs in an .debug_type or from other/multiple (comdat) sections. New tests are added for dwarf-4, dwarf-5, split-dwarf-4, split-dwarf-5 and version 4 and 5 dwo files. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog7
-rw-r--r--tests/dwarf-die-addr-die.c14
-rwxr-xr-xtests/run-dwarf-die-addr-die.sh14
3 files changed, 35 insertions, 0 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 2b255c72..b656bee7 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,12 @@
2018-05-29 Mark Wielaard <[email protected]>
+ * dwarf-die-addr-die.c (check_dbg): Also check subdies, split or
+ type, gotten through dwarf_get_units.
+ * run-dwarf-die-addr-die.sh: Add tests for dwarf-4, dwarf-5,
+ split-dwarf-4, split-dwarf-5 and dwo files.
+
+2018-05-29 Mark Wielaard <[email protected]>
+
* run-readelf-loc.sh: Add GNU DebugFission split-dwarf variant.
* run-varlocs.sh: Likewise.
diff --git a/tests/dwarf-die-addr-die.c b/tests/dwarf-die-addr-die.c
index b4f6dbcd..7899988f 100644
--- a/tests/dwarf-die-addr-die.c
+++ b/tests/dwarf-die-addr-die.c
@@ -134,6 +134,20 @@ check_dbg (Dwarf *dbg)
res |= check_dbg (alt);
}
+ // Split or Type Dwarf_Dies gotten through dwarf_get_units.
+ Dwarf_CU *cu = NULL;
+ Dwarf_Die subdie;
+ uint8_t unit_type;
+ while (dwarf_get_units (dbg, cu, &cu, NULL,
+ &unit_type, NULL, &subdie) == 0)
+ {
+ if (dwarf_tag (&subdie) != DW_TAG_invalid)
+ {
+ printf ("checking %" PRIx8 " subdie\n", unit_type);
+ res |= check_die (&subdie);
+ }
+ }
+
return res;
}
diff --git a/tests/run-dwarf-die-addr-die.sh b/tests/run-dwarf-die-addr-die.sh
index 16fe7b04..951d1c52 100755
--- a/tests/run-dwarf-die-addr-die.sh
+++ b/tests/run-dwarf-die-addr-die.sh
@@ -32,6 +32,20 @@ testfiles testfilebazdbgppc64.debug
testrun ${abs_builddir}/dwarf-die-addr-die testfilebazdbgppc64.debug
+# see tests/testfile-dwarf-45.source
+testfiles testfile-dwarf-4 testfile-dwarf-5
+testfiles testfile-splitdwarf-4 testfile-hello4.dwo testfile-world4.dwo
+testfiles testfile-splitdwarf-5 testfile-hello5.dwo testfile-world5.dwo
+
+testrun ${abs_builddir}/dwarf-die-addr-die testfile-dwarf-4
+testrun ${abs_builddir}/dwarf-die-addr-die testfile-dwarf-5
+testrun ${abs_builddir}/dwarf-die-addr-die testfile-splitdwarf-4
+testrun ${abs_builddir}/dwarf-die-addr-die testfile-splitdwarf-5
+testrun ${abs_builddir}/dwarf-die-addr-die testfile-hello4.dwo
+testrun ${abs_builddir}/dwarf-die-addr-die testfile-world4.dwo
+testrun ${abs_builddir}/dwarf-die-addr-die testfile-hello5.dwo
+testrun ${abs_builddir}/dwarf-die-addr-die testfile-world5.dwo
+
# Self test
testrun_on_self ${abs_builddir}/dwarf-die-addr-die