How best to Debug Haxe Code?

I don’t if this has been asked before. How best to debug haxe code. Eg option to step through the haxe code.

Some users suggested using Visual studio code. I think Haxe Develop may have a way to debug Haxe code.

Any suggestions?

1 Like

I gave a detailed breakdown of HaxeDevelop’s and VSCode’s debugging capabilities here:

1 Like

Great!! Thanks for this. I’ll try not to ask too many questions I’m limited to seven replies a day :slight_smile:

If you target JavaScript, you can make a debug build (add -debug to your hxml), which provides source-maps. Then you can use the browsers devtools (F12) and step through all Haxe code.

You can easily place a debugger statements in your code using js.Lib.debug() to place a “breakpoint” at this position. From there you can also start stepping.

This isn’t HaxeDevelop specific, but works very good when using HaxeDevelop + JavaScript target.

Of course, IntelliJ IDEA Ultimate Edition with the Haxe Toolkit plugin can debug C++ and Flash/Air targets using Haxe original sources. See http://intellij-haxe.org/debugging and intellij-haxe/ExampleProjects/HxcppDebugging at master · HaxeFoundation/intellij-haxe · GitHub.

JavaScript targets can be debugged in original source mode using source maps in most browsers. It’s not a bad experience.

vsCode with the vsHaxe plugin has a more extensive list of targets that can be debugged, including HashLink and interpreted (–interp) and honestly, probably has the best debugging capability right now.

1 Like

Thanks, everyone for your reply.
I’m still having problems getting either Visual studio code or HaxeDevelp to work in Haxe debug mode. I’ll keep at it. :wink:

What’s the problem, are you running into any errors?

If you’re stuck, a quick chat in the Haxe Discord or Gitter might help figure out what’s wrong.

Thanks for this I may use them.

Main problem is trying the get Vscode setup for basic debug. This depends on the target application. I’m working on bothwe Hashlink & haxecpp debuging