summaryrefslogtreecommitdiff
path: root/vm_dump.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-18 17:39:39 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-18 17:39:39 +0000
commitab31e97c4475ae179f4a64b36e989fdfbfaa1d6d (patch)
treeb29f4c228b975d3ad91ed530d805ee9387464d4b /vm_dump.c
parent357b8c06c35e3b20c2746ce63b622e6564b80b63 (diff)
Add comments to r39808
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_dump.c')
-rw-r--r--vm_dump.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/vm_dump.c b/vm_dump.c
index 070396d..54de8ca 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -452,8 +452,13 @@ int backtrace (void **trace, int size) {
}
return n;
darwin_sigtramp:
+ /* darwin's bundled libunwind doesn't support signal trampoline */
{
ucontext_t *uctx;
+ /* get _sigtramp's ucontext_t and set values to cursor
+ * http://www.opensource.apple.com/source/Libc/Libc-825.25/i386/sys/_sigtramp.s
+ * http://www.opensource.apple.com/source/libunwind/libunwind-35.1/src/unw_getcontext.s
+ */
unw_get_reg(&cursor, UNW_X86_64_RBX, &ip);
uctx = (ucontext_t *)ip;
unw_set_reg(&cursor, UNW_X86_64_RAX, uctx->uc_mcontext->__ss.__rax);
@@ -474,7 +479,7 @@ darwin_sigtramp:
unw_set_reg(&cursor, UNW_X86_64_R15, uctx->uc_mcontext->__ss.__r15);
ip = *(unw_word_t*)uctx->uc_mcontext->__ss.__rsp;
unw_set_reg(&cursor, UNW_REG_IP, ip);
- trace[n++] = (void *)(unw_word_t)uctx->uc_mcontext->__ss.__rip;
+ trace[n++] = (void *)uctx->uc_mcontext->__ss.__rip;
trace[n++] = (void *)ip;
}
while (unw_step(&cursor) > 0) {