diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-10 17:55:57 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-10 17:55:57 +0000 |
commit | a52af292712cd527b155962feebbc79abfeb957f (patch) | |
tree | ff8156effd975b13db5f38cd867db8ee68e2bd63 /vm_dump.c | |
parent | dddb92fd8f0397fadd79f7b3ae16adfe2a95a893 (diff) | |
download | ruby-a52af292712cd527b155962feebbc79abfeb957f.tar.gz |
* vm_dump.c: fix debug prints to catch up recent changes
such as VM data structures.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_dump.c')
-rw-r--r-- | vm_dump.c | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -222,6 +222,20 @@ rb_vmdebug_stack_dump_th(VALUE thval) } #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 @@ vm_stack_dump_each(rb_thread_t *th, rb_control_frame_t *cfp) 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 @@ vm_stack_dump_each(rb_thread_t *th, rb_control_frame_t *cfp) 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 @@ vm_stack_dump_each(rb_thread_t *th, rb_control_frame_t *cfp) (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 @@ vm_stack_dump_each(rb_thread_t *th, rb_control_frame_t *cfp) (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 @@ rb_vmdebug_debug_print_post(rb_thread_t *th, rb_control_frame_t *cfp #if VMDEBUG > 2 /* stack_dump_thobj(th); */ vm_stack_dump_each(th, th->cfp); + #if OPT_STACK_CACHING { VALUE rstr; |