[SATYR PATCH] unwind: resolve symbols through libunwind

Martin Milata mmilata at redhat.com
Mon Jun 3 18:19:03 UTC 2013


The libunwind-based unwind code used elfutils to obtain function names.
This patch adds fallback to symbol resolution provided by libunwind if
elfutils do not return any result. This is useful on systems where
binaries have embedded minidebuginfo and libunwind has minidebuginfo
support while elfutils do not (e.g. fedora 19).

Related to #82.

Signed-off-by: Martin Milata <mmilata at redhat.com>
---
 lib/core_unwind_libunwind.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/core_unwind_libunwind.c b/lib/core_unwind_libunwind.c
index 29805da..8f4664b 100644
--- a/lib/core_unwind_libunwind.c
+++ b/lib/core_unwind_libunwind.c
@@ -395,6 +395,17 @@ unwind_thread(struct UCD_info *ui,
                 entry->function_name = sr_strdup(funcname);
         }
 
+        if (!entry->function_name)
+        {
+            size_t funcname_len = 512;
+            char *funcname = sr_malloc(funcname_len);
+
+            if (unw_get_proc_name(&c, funcname, funcname_len, NULL) == 0)
+                entry->function_name = funcname;
+            else
+                free(funcname);
+        }
+
         trace = sr_core_frame_append(trace, entry);
         /*
         printf("%s 0x%llx %s %s -\n",
-- 
1.7.11.7



More information about the Crash-catcher mailing list