aboutsummaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2011-08-10 22:36:00 +0300
committerArnold D. Robbins <arnold@skeeve.com>2011-08-10 22:36:00 +0300
commitb8c993f5a867f38fa9edd343d7d90b4b36800be2 (patch)
tree75d48551001252a7b78469634d5f5dc11b2a6754 /debug.c
parent0d1a4f152fa45eda08b5877e4989c3250beb280e (diff)
downloadegawk-b8c993f5a867f38fa9edd343d7d90b4b36800be2.tar.gz
egawk-b8c993f5a867f38fa9edd343d7d90b4b36800be2.tar.bz2
egawk-b8c993f5a867f38fa9edd343d7d90b4b36800be2.zip
BEGINFILE/ENDFILE code redone.
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/debug.c b/debug.c
index 4cda95c8..29ce8b1a 100644
--- a/debug.c
+++ b/debug.c
@@ -3796,9 +3796,19 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump)
break;
case Op_K_nextfile:
+ print_func(fp, "[target_newfile = %p] [target_endfile = %p]\n",
+ pc->target_newfile, pc->target_endfile);
+ break;
+
case Op_newfile:
print_func(fp, "[target_jmp = %p] [target_endfile = %p]\n",
pc->target_jmp, pc->target_endfile);
+ print_func(fp, "%*s[target_get_record = %p]\n",
+ noffset, "", (pc + 1)->target_get_record);
+ break;
+
+ case Op_get_record:
+ print_func(fp, "[target_newfile = %p]\n", pc->target_newfile);
break;
case Op_jmp:
@@ -5374,28 +5384,27 @@ pre_execute_code(INSTRUCTION **pi)
return (ei == *pi);
}
-extern void unwind_stack(STACK_ITEM *sp_bottom);
+extern INSTRUCTION *unwind_stack(long n);
static NODE *
execute_code(volatile INSTRUCTION *code)
{
volatile NODE *r = NULL;
volatile jmp_buf fatal_tag_stack;
- STACK_ITEM *ctxt_stack_bottom;
+ long save_stack_size;
/* We use one global stack for all contexts.
- * Remember stack bottom for current context; in case of
- * a fatal error, unwind stack until stack_ptr is below that 'bottom'.
+ * Save # of items in stack; in case of
+ * a fatal error, pop stack until it has that many items.
*/
- ctxt_stack_bottom = stack_ptr + 1;
+ save_stack_size = (stack_ptr - stack_bottom) + 1;
PUSH_BINDING(fatal_tag_stack, fatal_tag, fatal_tag_valid);
if (setjmp(fatal_tag) == 0) {
(void) r_interpret((INSTRUCTION *) code);
- assert(stack_ptr == ctxt_stack_bottom);
r = POP_SCALAR();
} else /* fatal error */
- unwind_stack(ctxt_stack_bottom);
+ (void) unwind_stack(save_stack_size);
POP_BINDING(fatal_tag_stack, fatal_tag, fatal_tag_valid);