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

ruby-changes:47096

From: nobu <ko1@a...>
Date: Fri, 30 Jun 2017 10:56:58 +0900 (JST)
Subject: [ruby-changes:47096] nobu:r59211 (trunk): vm_insnhelper.c: dump iseq

nobu	2017-06-30 10:56:53 +0900 (Fri, 30 Jun 2017)

  New Revision: 59211

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

  Log:
    vm_insnhelper.c: dump iseq
    
    * vm_insnhelper.c (vm_stack_consistency_error): raise a fatal
      error with the disassembled instruction sequence, in the
      development version, instead of very rarely useful rb_bug in
      such case.

  Modified files:
    trunk/vm_insnhelper.c
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 59210)
+++ vm_insnhelper.c	(revision 59211)
@@ -3325,7 +3325,14 @@ vm_stack_consistency_error(rb_thread_t * https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3325
     const ptrdiff_t nbp = VM_SP_CNT(th, bp);
     static const char stack_consistency_error[] =
 	"Stack consistency error (sp: %"PRIdPTRDIFF", bp: %"PRIdPTRDIFF")";
+#if defined RUBY_DEVEL
+    VALUE mesg = rb_sprintf(stack_consistency_error, nsp, nbp);
+    rb_str_cat_cstr(mesg, "\n");
+    rb_str_append(mesg, rb_iseq_disasm(cfp->iseq));
+    rb_exc_fatal(rb_exc_new3(rb_eFatal, mesg));
+#else
     rb_bug(stack_consistency_error, nsp, nbp);
+#endif
 }
 
 enum binop_operands_type {

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

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