Repository navigation
Set breakpoints in cppia scripts loaded after the server attaches - #48
Open
dimensionscape wants to merge 1 commit into
Open
dimensionscape wants to merge 1 commit into
dimensionscape wants to merge 1 commit into
Conversation
The server built its file list once, as it attached, which is before a cppia host loads any script, so a breakpoint in a script mapped to no file and never stopped. It now registers hxcpp's script-loaded callback where the runtime has it (API level 500, or libhxcpp at any level, which defines HXCPP_DBG_ON_SCRIPT_LOADED), reads the files again there and sets the breakpoints that were waiting. Script file names, often relative, are matched to the editor's paths by their end, and a breakpoint in a file the server does not know yet makes it read the files again, so one added while a script runs is set too. A stop in a file the server has no path for no longer throws on the debugger thread.
This was referenced Oct 23, 2026
Jarrio
pushed a commit
to Jarrio/hxcpp-debugger
that referenced
this pull request
Oct 24, 2026
…rver attaches Server.hx's setBreakpoints conflicted with this fork's changes. vshaxe#48's shared setBreakpoints function stays, answering as this fork does: one id per requested breakpoint, -1 for one whose condition doesn't parse (instead of an error for the whole request) or whose file has no code loaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019VkYci7PZjWWY3LJTcTpsa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The server builds its file list once, as it attaches, which is before a cppia host loads any script. A breakpoint in a script then maps to no file,
addFileLineBreakpointgets null and returns -1, and the script never stops. A stop in a script also found no file for it, and iterating the missing breakpoint list threw on the debugger thread.This change:
__hxcpp_dbg_setOnScriptLoadedFunction, [cppia] Allow setting callback for script load HaxeFoundation/hxcpp#1203) when the host is scriptable and the runtime has it: API level 500, or libhxcpp at any level, which definesHXCPP_DBG_ON_SCRIPT_LOADED. Other runtimes build as beforeChecked with libhxcpp 6.0.0 and Haxe 4.3.7. On Windows, Linux and macOS (Intel and arm64), a breakpoint set before the script loads stops, interpreted and with the JIT, locals read correctly, and next, step out and continue go where they should. On Windows, a breakpoint set while the script runs stops too, also on this branch as rebased on master.