summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--vm_dump.c22
2 files changed, 23 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index a140b25..c630106 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Oct 11 02:54:07 2012 Koichi Sasada <ko1@atdot.net>
+
+ * 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@atdot.net>
* iseq.c (insn_operand_intern): add support disasm TS_CALLINFO
diff --git a/vm_dump.c b/vm_dump.c
index 8e005bd..e84e59a 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -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;