diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2014-09-21 15:49:47 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2014-09-21 15:49:47 -0400 |
commit | b4d06df669e1eaf6c98cacb5c5f299bb5324e804 (patch) | |
tree | 50fb039c2cf280921e7650230cb42b0669e17f0b /debug.c | |
parent | 94e3f93395de538d73826e128281a3ea9591a5a9 (diff) | |
parent | 8b4e8f702df30b2b2238158504de5d8eb436958d (diff) | |
download | egawk-b4d06df669e1eaf6c98cacb5c5f299bb5324e804.tar.gz egawk-b4d06df669e1eaf6c98cacb5c5f299bb5324e804.tar.bz2 egawk-b4d06df669e1eaf6c98cacb5c5f299bb5324e804.zip |
Merge 'master' into select
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) { @@ -5448,6 +5448,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); @@ -5458,7 +5459,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; @@ -5559,14 +5560,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; } |