HaxeDevelop debug does not stop on breakpoint
Asked Answered
C

2

5

I am new to HaxeDevelop (but experienced with FlashDevelop) and it has essentially no useful documentation that I can find via a Google search. I am trying to get a simple app up and running with OpenFL and Starling. It had an issue so I tried putting a breakpoint. However, it doesn't stop at the breakpoint. I even put several breakpoints in the main class code and it won't stop. I've even tried making a new project with just a main class and a dummy class and it won't breakpoint on this either. Do I have to tell it to use a special debug process or something? Do I need to install any more software? Should I just use VS Code?

I installed HaxeDevelop and haxe and lime and OpenFL. I made a new OpenFL project and did some simple work in the Main file (make some integer variables, prints some stuff etc.) and littered it with breakpoints. I run it and the output prints (but does not stop at any breakpoints):

Build succeeded
Done(0)
haxelib run lime run "project.xml" neko -debug
Running process: C:\HaxeToolkit\haxe\haxelib.exe run lime run "project.xml" neko -debug
Main.hx:17: Hello World!
Main.hx:21: Did some stuff... Did it stop?
Done(0)

I've tried it using neko, html5, and flash and none of them will stop at the breakpoints.

If anyone knows of a good tutorial for getting Haxe to run in debug mode in HaxeDevelop, FlashDevelop, or VS Code, I would super appreciate it.

Cormack answered 8/4, 2019 at 21:8 Comment(0)
S
9

HaxeDevelop / FlashDevelop only support breakpoint debugging on the Flash target. It can be a bit tricky to set up since it requires a 32 bit Java to be in your PATH (this limitation does not exist with Flash debugging in VSCode). You also need to make sure that a Flash Debug Player is associated with .swf files. You can find more details here and here.


VSCode on the other hand supports debugging a much wider range of targets:

  • JavaScript
  • HashLink
  • HXCPP
  • Eval (macros)
  • Flash

There is no debugging support for the Neko target in any IDE.

If you are using OpenFL, you should install the Lime extension, which handles all the configuration of the individual debug adapters for you (note: this requires Lime 7.3.0 or newer). In a fresh project, simply "Start Debugging" and select "Lime" from the dropdown:

This creates a Lime launch configuration in .vscode/launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Lime",
            "type": "lime",
            "request": "launch"
        }
    ]
}

Debugging should now work out of the box with the currently selected target (just make sure you have the "Debug" configuration of the target selected). You can click the status bar indicator to switch between configurations:

If you're missing a debug extension, the Lime extension should open a popup that offers to install it.

Sweater answered 8/4, 2019 at 21:32 Comment(4)
So I followed the steps to get HaxeDevelop to debug, and it worked (but requires me to open another instance of HaxeDevelop every time)! Unfortunately, I'm using Starling and it appears to not work when building to flash (it has a #if flash statement that throws an error saying stuff about use AIR instead of flash). So VS code it is!Cormack
I'm trying to follow these steps on a fresh update of VSCode (March 2019), installed the Lime extension, it installed the Haxe extension. I've run "lime setup" in the console, got a few dependency errors, and now it's stuck on "Type not found : CommandLineTools" - as I try to run lime setup. Google isn't being much help. (New to Haxe / Lime, etc)Kalbli
This isn't really the best place to discuss that, as that sounds like a more general setup issue with Lime rather than something debugging-related. Try the OpenFL forums / Discord.Sweater
How is it not? People come here for help to get things working. I was able to get closer to success; I had a misconfigured haxelib path. I ran haxelib setup and made sure everything was installed to the same spot. But now, I hit F5, selected "Windows / Debug" configuration, and get the error pop up: convertToDTo: unexpected typeKalbli
A
1

If you use HaxeDevelop and target JavaScript, you can make a debug build (add -debug to your HXML or select 'debug' dropdown), 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.

image

https://haxe.org/manual/debugging-javascript.html

Armory answered 17/5, 2019 at 9:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.