commit ec9f84240d2d9a06a2ebd709202c2540bce07012
parent 1d117c5bae6a62f76435f9e21fe8192155bab5de
Author: Florian Dold <florian@dold.me>
Date: Mon, 22 Jun 2026 11:39:58 +0200
add qtart function to abort process for debugging
We need this to diagnose an issue on iOS that only occurs when the
debugger is not attached. By doing a controlled crash, we get a bug
report with the last logs, even when there's no debugger attached.
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tart_module.c b/tart_module.c
@@ -48,6 +48,13 @@ static JSValue js_encode_utf8(JSContext *ctx, JSValueConst this_val,
return buf;
}
+static JSValue js_crash_for_debug(JSContext *ctx, JSValueConst this_val,
+ int argc, JSValueConst *argv)
+{
+ abort();
+ return JS_EXCEPTION;
+}
+
static JSValue js_random_bytes(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
@@ -58,7 +65,7 @@ static JSValue js_random_bytes(JSContext *ctx, JSValueConst this_val,
}
{
uint8_t randbuf[nbytes];
- randombytes_buf (randbuf, nbytes);
+ randombytes_buf(randbuf, nbytes);
buf = JS_NewArrayBufferCopy(ctx, randbuf, nbytes);
}
return buf;
@@ -2124,6 +2131,7 @@ fail:
static const JSCFunctionListEntry tart_talercrypto_funcs[] = {
JS_CFUNC_DEF("structuredClone", 1, js_structured_clone),
JS_CFUNC_DEF("encodeUtf8", 1, js_encode_utf8),
+ JS_CFUNC_DEF("crashForDebug", 0, js_crash_for_debug),
JS_CFUNC_DEF("decodeUtf8", 1, js_decode_utf8),
JS_CFUNC_DEF("randomBytes", 1, js_random_bytes),
JS_CFUNC_DEF("encodeCrock", 1, js_talercrypto_encode_crock),