fixed uncaught exception trigger, added hl_debug_catch_all for later debugger usage
HL_PRIM hl_trap_ctx *hl_current_trap = NULL;
HL_PRIM vdynamic *hl_current_exc = NULL;
HL_PRIM vdynamic **hl_debug_exc = NULL;
+HL_PRIM bool hl_debug_catch_all = false;
static hl_trap_ctx *hl_trap_root = NULL;
static void *stack_trace[0x1000];
static int stack_count = 0;
@@ -94,7 +95,7 @@ HL_PRIM void hl_throw( vdynamic *v ) {
stack_count = capture_stack_func(stack_trace, 0x1000);
hl_current_exc = v;
hl_current_trap = t->prev;
- if( hl_current_trap == hl_trap_root || hl_current_trap == NULL ) {
+ if( t == hl_trap_root || hl_current_trap == NULL || hl_debug_catch_all ) {
hl_debug_exc = &v;
hl_debug_break();
hl_debug_exc = NULL;
@@ -122,7 +123,6 @@ HL_PRIM void hl_dump_stack() {
}
}
-
HL_PRIM varray *hl_exception_stack() {
varray *a = hl_alloc_array(&hlt_bytes, stack_count);
int i;
