print stack trace for when an exception occurs
This commit is contained in:
3
Makefile
3
Makefile
@@ -1,3 +1,6 @@
|
||||
run_debug:
|
||||
./build-unix-debug.sh && ./shf
|
||||
|
||||
run:
|
||||
./build-unix.sh && ./shf
|
||||
|
||||
|
||||
8
build-unix-debug.sh
Executable file
8
build-unix-debug.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
mlton -const 'Exn.keepHistory true' -link-opt "$(pkg-config --cflags glfw3) $(pkg-config --static --libs glfw3)" \
|
||||
-export-header ffi/export.h \
|
||||
shf.mlb \
|
||||
ffi/glad.c \
|
||||
ffi/glfw-export.c \
|
||||
ffi/gles3-export.c \
|
||||
ffi/glfw-input.c
|
||||
@@ -17,7 +17,19 @@ struct
|
||||
fun loop (app: AppType.app_type, inputMailbox, drawMailbox) =
|
||||
let
|
||||
val inputMsg = Mailbox.recv inputMailbox
|
||||
val app = AppUpdate.update (app, inputMsg)
|
||||
val app =
|
||||
AppUpdate.update (app, inputMsg)
|
||||
handle e =>
|
||||
let
|
||||
(* print stack trace for debugging purposes,
|
||||
* and then raise another exception to exit the program *)
|
||||
val stackTrace = MLton.Exn.history e
|
||||
val stackTrace = String.concatWith "\n" stackTrace
|
||||
val () = print (stackTrace ^ "\n")
|
||||
in
|
||||
raise Empty
|
||||
end
|
||||
|
||||
val () = sendMsgs (#msgs app, drawMailbox)
|
||||
in
|
||||
loop (app, inputMailbox, drawMailbox)
|
||||
|
||||
Reference in New Issue
Block a user