summaryrefslogtreecommitdiff
path: root/os/backtrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/backtrace.c')
-rw-r--r--os/backtrace.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/os/backtrace.c b/os/backtrace.c
index 9f28b8809..fd3d6ab0d 100644
--- a/os/backtrace.c
+++ b/os/backtrace.c
@@ -45,6 +45,7 @@ xorg_backtrace(void)
{
unw_cursor_t cursor;
unw_context_t context;
+ unw_word_t ip;
unw_word_t off;
unw_proc_info_t pip;
int ret, i = 0;
@@ -88,7 +89,9 @@ xorg_backtrace(void)
procname[1] = 0;
}
- if (dladdr((void *)(uintptr_t)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname &&
+ if (unw_get_reg (&cursor, UNW_REG_IP, &ip) < 0)
+ ip = pip.start_ip + off;
+ if (dladdr((void *)(uintptr_t)(ip), &dlinfo) && dlinfo.dli_fname &&
*dlinfo.dli_fname)
filename = dlinfo.dli_fname;
else
@@ -96,7 +99,7 @@ xorg_backtrace(void)
ErrorFSigSafe("%u: %s (%s%s+0x%x) [%p]\n", i++, filename, procname,
ret == -UNW_ENOMEM ? "..." : "", (int)off,
- (void *)(uintptr_t)(pip.start_ip + off));
+ (void *)(uintptr_t)(ip));
ret = unw_step(&cursor);
if (ret < 0)