Best approach for debugging cpp target?

How do you guys work with debugging when targeting cpp? Using Haxe/Flashdevelop.
The commandline debugger? Debugging the generated c++ code in Visual studio? Whats the preferred solution for now?

I use a lot of traces and switching targets to neko sometimes gives you a bit more info. You do have to run

lime test neko

via the command line though to get any stack traces.

for cpp-only i watching traces to (while running program from console),
to show only msg from special parts of code,
its easy to switch between them with haxe-defines in project.xml like:

<haxedef name="debuginput" />
<haxedef name="debugnetwork" />
<!--<haxedef name="debugaudio" />-->

<haxedef name="no-traces" /><!-- disables traces at all for production build -->

and inside code something like:
#if debugnetwork trace('somethingwrong with ${inputBuffer.length}'); #end


In Windows, compile with HXCPP_DEBUG_LINK and use “Debug->Attach to process” in Visual Studio

If you’re using the cpp target we’re working on getting Visual Studio Code and the hxcpp debugger to play nice together so that you can set breakpoints in VSCode and debug from an IDE.

Aha… Getting the hxcpp debugger working with VSCode would be a major step then… Ofcourse i’m hoping for a debug solution for Flash/Haxedevelop but it absolutely will help the workflow… What is the status of this? Who are working on it? :slight_smile:

Me and @jeff_ward are on it. Jeff made all the work on the VSCode integration while I fixed the debugger to actually work on Mac/Linux/Windows.

It’s a work in progress but we’re getting near the end :slight_smile:


Thats really cool. Having proper cpp debugging will help so much! Really excited to see when you are releasing this!
Hopefully this could help with getting Flash/Haxedevelop integrated debugging working also?

You can follow along at the repo for the vscode-hxcpp-debug project:

And as @tanis said, there’s currently an issue using it on Mac/Windows that’s very close to being resolved:

And while this project is entirely about a Visual Studio Code plugin – there is the side benefit that people are working with the hxcpp-debugger, and making it more stable and working in more places. :slight_smile:

We’ll announce via various channels (repo, Twitter, haxe roundup, here, etc) when the PRs are in place and it’s ready to be used. Cheers!


@jeff_ward Awesome work guys! Keep it up!

FYI for future reference,

The issue #25 on the vscode-hxcpp-debug is fixed, so that should represent good progress toward stability. Note that you need to use a recent version of the hxcpp-debugger for it to work. e.g. install from git:

haxelib git hxcpp-debugger

Nice! Great work!.. Being able to debug from the cpp target in vsc is a great step forward. Now ultimately i wish for integrated haxedevelop/flashdevelop debugger support but… until then, this is very nice!

In case anybody stumbles over this old thread, these days there’s a hxcpp debugger extension available that can be downloaded conveniently from VSCode’s marketplace:

1 Like

Thank you for sharing. How do I setup this targeting Android?

I haven’t tried that myself yet, but there’s some defines you can set for the host / port:

And you would probably need an attach rather than a launch request in launch.json.

1 Like

I’ve been trying this for some time… But i cant get the hxcpp debugger to work. Dont know why.
App starts but without debugging… I’ve checked many setups and my lauch / settings / hxml files seem ok…

You could try with this workspace to make 100% sure it’s not some config error. It has working launch configs for all targets that support debugging in VSCode.

1 Like