[前][次][番号順一覧][スレッド一覧]

ruby-changes:43962

From: naruse <ko1@a...>
Date: Tue, 30 Aug 2016 13:49:31 +0900 (JST)
Subject: [ruby-changes:43962] naruse:r56035 (trunk): fix r56030 [Bug #12711]

naruse	2016-08-30 13:49:26 +0900 (Tue, 30 Aug 2016)

  New Revision: 56035

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56035

  Log:
    fix r56030 [Bug #12711]
    
    check whether it was syscall or not by getting previous instruction.
    syscall instruction is 0x0f 0x05.

  Modified files:
    trunk/vm_dump.c
Index: vm_dump.c
===================================================================
--- vm_dump.c	(revision 56034)
+++ vm_dump.c	(revision 56035)
@@ -469,13 +469,14 @@ darwin_sigtramp: https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L469
 	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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]