summaryrefslogtreecommitdiff
path: root/vm_dump.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-30 04:49:26 (GMT)
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-30 04:49:26 (GMT)
commit8a1c7babecf43863ccf28f95e1e57631a3da4202 (patch)
tree9a4bb35fd7947b6fc98daf64a5767eb37096e1cd /vm_dump.c
parent564512db589402f36b2b8f625ebac0c13d9124b0 (diff)
fix r56030 [Bug #12711]
check whether it was syscall or not by getting previous instruction. syscall instruction is 0x0f 0x05. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_dump.c')
-rw-r--r--vm_dump.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/vm_dump.c b/vm_dump.c
index f8cde6d..179c132 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -469,13 +469,14 @@ darwin_sigtramp:
unw_set_reg(&cursor, UNW_X86_64_R13, uctx->uc_mcontext->__ss.__r13);
unw_set_reg(&cursor, UNW_X86_64_R14, uctx->uc_mcontext->__ss.__r14);
unw_set_reg(&cursor, UNW_X86_64_R15, uctx->uc_mcontext->__ss.__r15);
- ip = *(unw_word_t*)uctx->uc_mcontext->__ss.__rsp;
- if (!ip) { /* signal received in syscall */
- ip = uctx->uc_mcontext->__ss.__rip;
+ ip = uctx->uc_mcontext->__ss.__rip;
+ if (((char*)ip)[-2] == 0x0f && ((char*)ip)[-1] == 5) {
+ /* signal received in syscall */
+ trace[n++] = (void *)ip;
+ ip = *(unw_word_t*)uctx->uc_mcontext->__ss.__rsp;
}
- unw_set_reg(&cursor, UNW_REG_IP, ip);
- trace[n++] = (void *)uctx->uc_mcontext->__ss.__rip;
trace[n++] = (void *)ip;
+ unw_set_reg(&cursor, UNW_REG_IP, ip);
}
while (unw_step(&cursor) > 0) {
unw_get_reg(&cursor, UNW_REG_IP, &ip);