diff options
Diffstat (limited to 'debug.c')
-rw-r--r-- | debug.c | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -2801,7 +2801,7 @@ debug_prog(INSTRUCTION *pc) unserialize(OPTION); unsetenv("DGAWK_RESTART"); fprintf(out_fp, "Restarting ...\n"); - if (run[0] == 'T') + if (strcasecmp(run, "true") == 0) (void) do_run(NULL, 0); } else if (command_file != NULL) { @@ -5449,6 +5449,7 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) int ecount = 0, pcount = 0; int ret; int save_flags = do_flags; + SRCFILE *the_source; if (prog_running) { this_frame = find_frame(0); @@ -5459,7 +5460,7 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) ctxt = new_context(); ctxt->install_func = append_symbol; /* keep track of newly installed globals */ push_context(ctxt); - (void) add_srcfile(SRC_CMDLINE, arg->a_string, srcfiles, NULL, NULL); + the_source = add_srcfile(SRC_CMDLINE, arg->a_string, srcfiles, NULL, NULL); do_flags = false; ret = parse_program(&code); do_flags = save_flags; @@ -5560,14 +5561,27 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) this_func->param_cnt -= ecount; } - /* always destroy symbol "@eval", however destroy all newly installed + /* + * Always destroy symbol "@eval", however destroy all newly installed * globals only if fatal error (execute_code() returing NULL). */ pop_context(); /* switch to prev context */ free_context(ctxt, (ret_val != NULL)); /* free all instructions and optionally symbols */ - if (ret_val != NULL) - destroy_symbol(f); /* destroy "@eval" */ + + if (ret_val != NULL) { + /* + * Remove @eval from FUNCTAB, so that above code + * will work the next time around. + */ + NODE *s = make_string("@eval", 5); + + (void) assoc_remove(func_table, s); + unref(s); + } + + free_srcfile(the_source); + return false; } |