问题
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.
回答1:
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.
回答2:
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.
https://haxe.org/manual/debugging-javascript.html
来源:https://stackoverflow.com/questions/55581778/haxedevelop-debug-does-not-stop-on-breakpoint