-
-
Notifications
You must be signed in to change notification settings - Fork 688
Debugging hints
To debug the Haxe compiler, you can use either a system debugger (gdb/lldb), or ocamldebug. ocamldebug provides a better debugging experience. To use it, uncomment (modes byte) from src/dune and recompile.
To print information about a type, you can add the following before most lines:
Printf.printf "%s\n" (s_type_kind t);To print specific data structure, you can see other functions with s_ prefix, or check Printer.s_* functions
print_endline (s_expr_debug expr);
print_endline (Printer.s_type t);There are lots of other stringifying functions in src/core/tPrinting.ml. If specific data structure is not there, you can try to convert it to json first:
let jctx = Genjson.create_context GMFull in
let json = (Genjson.generate_anon_status jctx anon.a_status) in
print_endline (Json.string_of_json json);If you want to get stacktrace of current call without debugger, you can add die "" __LOC__; to crash compiler on specific line.
Learn Haxe: Introduction | Manual | API | Try Haxe | Haxe Library Manager | Code Cookbook
Connect: GitHub | Stack Overflow | Forum | Discord | Gitter | Twitter | Facebook