Pushed
On 03.06.2013 20:19, Martin Milata wrote:
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(a)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",