From 176205a22de8bc356109edc2aceaaa07ae1d24a4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 6 Sep 2024 14:41:34 -0400 Subject: Print stack trace if $TOMO_STACKTRACE is set --- environment.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'environment.c') diff --git a/environment.c b/environment.c index 39a3e24a..0c37b266 100644 --- a/environment.c +++ b/environment.c @@ -3,11 +3,12 @@ #include #include -#include "environment.h" +#include "builtins/functions.h" #include "builtins/table.h" #include "builtins/text.h" -#include "typecheck.h" #include "builtins/util.h" +#include "environment.h" +#include "typecheck.h" type_t *TEXT_TYPE = NULL; type_t *RANGE_TYPE = NULL; @@ -588,6 +589,9 @@ void compiler_err(file_t *f, const char *start, const char *end, const char *fmt if (f && start && end) highlight_error(f, start, end, "\x1b[31;1m", 2, isatty(STDERR_FILENO) && !getenv("NO_COLOR")); + if (getenv("TOMO_STACKTRACE")) + print_stack_trace(stderr, 1, 3); + raise(SIGABRT); exit(1); } -- cgit v1.2.3