VM end state shows info based on the position the VM entered
This commit is contained in:
parent
82647584e8
commit
2d0faff732
12
src/vm.c
12
src/vm.c
|
@ -411,6 +411,8 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
||||||
|
|
||||||
#if VM_DEBUG
|
#if VM_DEBUG
|
||||||
puts("### booting VM... ###");
|
puts("### booting VM... ###");
|
||||||
|
pic_value *stbase = pic->sp;
|
||||||
|
pic_callinfo *cibase = pic->ci;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PUSH(pic_obj_value(proc));
|
PUSH(pic_obj_value(proc));
|
||||||
|
@ -812,17 +814,17 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
||||||
|
|
||||||
#if VM_DEBUG
|
#if VM_DEBUG
|
||||||
puts("**VM END STATE**");
|
puts("**VM END STATE**");
|
||||||
printf("stbase\t= %p\nsp\t= %p\n", (void *)pic->stbase, (void *)pic->sp);
|
printf("stbase\t= %p\nsp\t= %p\n", (void *)stbase, (void *)pic->sp);
|
||||||
printf("cibase\t= %p\nci\t= %p\n", (void *)pic->cibase, (void *)pic->ci);
|
printf("cibase\t= %p\nci\t= %p\n", (void *)cibase, (void *)pic->ci);
|
||||||
if (pic->stbase < pic->sp) {
|
if (stbase < pic->sp) {
|
||||||
pic_value *sp;
|
pic_value *sp;
|
||||||
printf("* stack trace:");
|
printf("* stack trace:");
|
||||||
for (sp = pic->stbase; pic->sp != sp; ++sp) {
|
for (sp = stbase; pic->sp != sp; ++sp) {
|
||||||
pic_debug(pic, *sp);
|
pic_debug(pic, *sp);
|
||||||
puts("");
|
puts("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pic->stbase > pic->sp) {
|
if (stbase > pic->sp) {
|
||||||
puts("*** stack underflow!");
|
puts("*** stack underflow!");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue