Debugging cppia?

Howdy.

I’ve got a hxcpp host loading .cppia files from a watched directory. All is working great, but I can’t figure out how to step into the loaded modules. Is there a way to do that? I’d love to be able to set breakpoints with vscode in the .hx file that generated the .cppia file…

Thanks!

I’m not an expert, so I might be wrong, but I don’t think it’s currently possible. The cppia files do not contain any kind of information about the breakpoints set in an external editor (even the debug version of a cppia file looks like it lacks any kind of reference to debug info)

You could maybe try calling cpp.vm.Debugger methods from within your cppia Haxe code and see if you can control the host debug process/thread. Just an idea. Although I once created a cppia plugin system for a specific project, I never used the debugger from code

Well, I stand corrected, it looks like debugging cppia modules by launching the host app in a debugger is actually working as expected (tested it in VSCode). I set my breakpoints in the cppia’s Haxe code, I launched the host app by vscode’s Run and Debug, and voilá, the execution stopped at the breakpoint, with proper call stack, variables etc displayed.

Some important things to point out:

  • Needless to say but both the host app and the cppia module have to be debug builds
  • The cppia module’s source must be visible to the host (I had to import the actual cppia plugin’s code in the host app’s Haxe source), which makes module/extension/plugin development/debugging kind of difficult, since you have to have access to both the host source and the cppia source, and you also have to make sure you rebuild/recompile both the cppia module and the host app if the source changes.

image

This is intriguing, but I’m wondering if you are actually looking at the runtime loaded cppia code, or the imported .hx file?

Could you post the test project somewhere? I’d love to poke around with it. Also, when you say ‘debug builds’, what flags are you using? (-debug, -D HXCPP_DEBUGGER, -D scriptable, --lib hxcpp-debugger, -lib hxcpp-debug-server for vscode?)

Thanks!