You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cppia: a debugger that attaches before a script loads cannot set breakpoints in it #283
Checked end to end with the VS Code hxcpp debugger's server (hxcpp-debug-server 1.2.4, stock) and a host built with -debug -D scriptable -lib hxcpp-debug-server, on Windows. A breakpoint in the script comes back as -1 and the script runs straight through, interpreted and with the JIT.
The server starts with the host and attaches before any script is loaded. It reads Debugger.getFiles() once, as it attaches, so the script's files are never in its list, and it has no way to learn when they arrive: hxcpp's callback for that, __hxcpp_dbg_setOnScriptLoadedFunction (HaxeFoundation/hxcpp#1203), only exists at API level 500, so with Haxe 4 nothing tells a debugger that a script has loaded.
Our part: call the script-loaded callback at every API level, after a script loads and before it boots, and give C++ a macro to test for it, so a server that also builds against other hxcpp versions can use it. The server's part, reading its files again in the callback and setting the breakpoints that were waiting, is a change to vshaxe/hxcpp-debugger.
With both, breakpoints, stepping over and out, and locals work in a script from the debugger's protocol, in the interpreter and with the JIT, whether the breakpoint was set before the script loaded or while it ran.
Fixed in 01db441cc7c5ec3e7e161cdd4a5e3caceb0643d8 and 4a9ac2531a71f533ac193e10e8f15e9cecf79981; the second lines up getFilesFullPath() with getFiles() once a script has loaded, which on Linux sent the breakpoints to the wrong file. The function set with __hxcpp_dbg_setOnScriptLoadedFunction now runs after each script loads and before it boots, at every API level, and HXCPP_DBG_ON_SCRIPT_LOADED is defined for C++ that needs to know it is there. Test: CppiaScriptLoaded. docs/CppiaDebugging.md covers using it. The hxcpp-debug-server side is vshaxe/hxcpp-debugger#48.
Activity
Let a debugger find the script-loaded callback and use it for breakpo…
Let a debugger find the script-loaded callback and use it for breakpo…
dimensionscape commentedon Oct 23, 2026
Fixed in
01db441cc7c5ec3e7e161cdd4a5e3caceb0643d8and4a9ac2531a71f533ac193e10e8f15e9cecf79981; the second lines upgetFilesFullPath()withgetFiles()once a script has loaded, which on Linux sent the breakpoints to the wrong file. The function set with__hxcpp_dbg_setOnScriptLoadedFunctionnow runs after each script loads and before it boots, at every API level, andHXCPP_DBG_ON_SCRIPT_LOADEDis defined for C++ that needs to know it is there. Test: CppiaScriptLoaded. docs/CppiaDebugging.md covers using it. The hxcpp-debug-server side is vshaxe/hxcpp-debugger#48.