add stack underflow detector
This commit is contained in:
parent
a4d20060e7
commit
9bc172bde5
5
src/vm.c
5
src/vm.c
|
@ -529,7 +529,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
puts("**VM END STATE**");
|
||||
printf("stbase\t= %p\nsp\t= %p\n", pic->stbase, pic->sp);
|
||||
printf("cibase\t= %p\nci\t= %p\n", pic->cibase, pic->ci);
|
||||
if (pic->stbase != pic->sp) {
|
||||
if (pic->stbase < pic->sp) {
|
||||
pic_value *sp;
|
||||
printf("* stack trace:");
|
||||
for (sp = pic->stbase; pic->sp != sp; ++sp) {
|
||||
|
@ -537,6 +537,9 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
puts("");
|
||||
}
|
||||
}
|
||||
if (pic->stbase > pic->sp) {
|
||||
puts("*** stack underflow!");
|
||||
}
|
||||
#endif
|
||||
|
||||
return val;
|
||||
|
|
Loading…
Reference in New Issue