diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-04-16 14:16:33 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-04-16 14:16:33 -0700 |
commit | f029f2815c2d69ef833089f476d32cadc5edd2de (patch) | |
tree | 2fa684767bf49a32eca8c0eb9c5a8690ad620c1d /txr.c | |
parent | a46ef5d5b56f0ca6f69a36ddf131bc3b9658b758 (diff) | |
download | txr-f029f2815c2d69ef833089f476d32cadc5edd2de.tar.gz txr-f029f2815c2d69ef833089f476d32cadc5edd2de.tar.bz2 txr-f029f2815c2d69ef833089f476d32cadc5edd2de.zip |
cmdline: use handler instead of catch for errors.
Errors encountered when parsing or evaluating a source file
should be handled using a handler rather than a catch, so that
the unwind stack is available to the error reporting function.
This anticipates being able to dump a backtrace.
* txr.c (parse_once_noerr, read_eval_stream_noerr): Adjust
to reduced argument count in ignerr_func_body macro.
* unwind.c (uw_trace_error): New function.
* unwind.h (uw_trace_error): Declared.
(ignerr_func_body): Revised to establish a handler in addition
to the catch. The catch now doesn't do anything other than
provide an intercepting exit point; the error_trace call is
moved into the handler, and so it executes in a context where
unwinding hasn't happened yet.
Diffstat (limited to 'txr.c')
-rw-r--r-- | txr.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -472,15 +472,14 @@ static void no_dbg_support(val arg) static int parse_once_noerr(val stream, val name, parser_t *parser) { val pfx = format(nil, lit("~a:"), name, nao); - ignerr_func_body(int, 0, parse_once(stream, name, parser), - exsym, exargs, std_error, pfx); + ignerr_func_body(int, 0, parse_once(stream, name, parser), std_error, pfx); } static val read_eval_stream_noerr(val self, val stream, val name, val error_stream) { val pfx = format(nil, lit("~a:"), name, nao); ignerr_func_body(val, nil, read_eval_stream(self, stream, error_stream), - exsym, exargs, std_error, pfx); + std_error, pfx); } int txr_main(int argc, char **argv) |