ruby-changes:25082
From: ko1 <ko1@a...>
Date: Thu, 11 Oct 2012 02:56:11 +0900 (JST)
Subject: [ruby-changes:25082] ko1:r37134 (trunk): * vm_dump.c: fix debug prints to catch up recent changes
ko1 2012-10-11 02:55:57 +0900 (Thu, 11 Oct 2012) New Revision: 37134 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37134 Log: * vm_dump.c: fix debug prints to catch up recent changes such as VM data structures. Modified files: trunk/ChangeLog trunk/vm_dump.c Index: ChangeLog =================================================================== --- ChangeLog (revision 37133) +++ ChangeLog (revision 37134) @@ -1,3 +1,8 @@ +Thu Oct 11 02:54:07 2012 Koichi Sasada <ko1@a...> + + * vm_dump.c: fix debug prints to catch up recent changes + such as VM data structures. + Thu Oct 11 02:50:34 2012 Koichi Sasada <ko1@a...> * iseq.c (insn_operand_intern): add support disasm TS_CALLINFO Index: vm_dump.c =================================================================== --- vm_dump.c (revision 37133) +++ vm_dump.c (revision 37134) @@ -222,6 +222,20 @@ } #if VMDEBUG > 2 + +/* copy from vm.c */ +static VALUE * +vm_base_ptr(rb_control_frame_t *cfp) +{ + rb_control_frame_t *prev_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); + VALUE *bp = prev_cfp->sp + cfp->iseq->local_size + 1; + + if (cfp->iseq->type == ISEQ_TYPE_METHOD) { + bp += 1; + } + return bp; +} + static void vm_stack_dump_each(rb_thread_t *th, rb_control_frame_t *cfp) { @@ -237,7 +251,7 @@ if (iseq == 0) { if (RUBYVM_CFUNC_FRAME_P(cfp)) { - name = rb_id2name(cfp->me->original_id); + name = rb_id2name(cfp->me->called_id); } else { name = "?"; @@ -266,7 +280,6 @@ VALUE *ptr = ep - local_size; - vm_stack_dump_each(th, cfp + 1); control_frame_dump(th, cfp); for (i = 0; i < argc; i++) { @@ -280,7 +293,7 @@ (void *)ptr++); } - ptr = cfp->bp; + ptr = vm_base_ptr(cfp); for (; ptr < sp; ptr++, i++) { if (*ptr == Qundef) { rstr = rb_str_new2("undef"); @@ -292,7 +305,7 @@ (ptr - th->stack)); } } - else if (VM_FRAME_TYPE_FINISH_P(VM_FRAME_TYPE(cfp))) { + else if (VM_FRAME_TYPE_FINISH_P(cfp)) { if ((th)->stack + (th)->stack_size > (VALUE *)(cfp + 1)) { vm_stack_dump_each(th, cfp + 1); } @@ -381,6 +394,7 @@ #if VMDEBUG > 2 /* stack_dump_thobj(th); */ vm_stack_dump_each(th, th->cfp); + #if OPT_STACK_CACHING { VALUE rstr; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/