[PATCH] Add .eh_frame_hdr search to Linux unwinder.

Jonathan Roelofs jonathan at codesourcery.com
Thu Jan 22 12:56:43 PST 2015


REPOSITORY
  rL LLVM

================
Comment at: src/Unwind/AddressSpace.hpp:375
@@ +374,3 @@
+  int found = dl_iterate_phdr(
+      [](struct dl_phdr_info *pinfo, size_t, void *data) -> int {
+        auto cbdata = static_cast<dl_iterate_cb_data *>(data);
----------------
Do byval captures not work here?

================
Comment at: src/Unwind/AddressSpace.hpp:383
@@ +382,3 @@
+        assert(cbdata->sects);
+
+        for (ElfW(Half) i = 0; i < pinfo->dlpi_phnum; i++) {
----------------
As an optimization, I think you can bail early here if the targetAddr cannot possibly be in the particular *.so:

```
if (cbdata->targetAddr < pinfo->dlpi_addr)
  return false;
```

================
Comment at: src/Unwind/AddressSpace.hpp:409
@@ +408,3 @@
+          cbdata->sects->dwarf_section_length = object_length;
+          return true;
+        } else {
----------------



================
Comment at: src/Unwind/EHHeaderParser.hpp:111
@@ +110,3 @@
+  size_t high = hdrInfo.fdeCount;
+  while (low < high) {
+    size_t mid = (low + high) / 2;
----------------
The EHABI unwinder uses some library function for doing its binary search for the EHT entry. Maybe that can be re-used here too.

================
Comment at: src/Unwind/UnwindCursor.hpp:833
@@ -830,3 +832,3 @@
   if (!foundFDE) {
     // otherwise, search cache of previously found FDEs.
     pint_t cachedFDE = DwarfFDECache<A>::findFDE(sects.dso_base, pc);
----------------
It's interesting that the cache lookup isn't first. I wonder why (not really important for this review).

================
Comment at: src/Unwind/config.h:79
@@ -78,3 +78,3 @@
   #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0
-  #define _LIBUNWIND_SUPPORT_DWARF_UNWIND   0
-  #define _LIBUNWIND_SUPPORT_DWARF_INDEX    0
+  #define _LIBUNWIND_SUPPORT_DWARF_UNWIND !__arm__
+  #define _LIBUNWIND_SUPPORT_DWARF_INDEX !__arm__
----------------
I think one of @joerg's platforms uses dwarf unwind on arm. I don't remember the name of the guard he created to detect that though.

http://reviews.llvm.org/D6848

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list