-
Notifications
You must be signed in to change notification settings - Fork 2
Hxcpptest
Here I will explain how to setup a separate environment to test the debugger. I expect that you already have Visual Studio 2010 and neko installed.
-
Setup Haxe
-
Setup hxcpp
-
Build FlashDevelop
-
Setup your project (hxcpp)
-
Setup OpenFL
-
Setup your project (openfl)
Haxe 3.1.1 just got released and it's new enough to support debugging. Yay!
First make yourself a test directory where you'll be doing this experiment. I'll be working in C:\haxetest.
- Start Visual Studio Command Prompt (2010)
- Download 3.1.1 from http://haxe.org/download
- Extract the contents of the zip into C:\haxetest\haxe , but check, there is a "build" dir that we don't need.
- add haxe to your path and create HAXEPATH
- set PATH=%CD%\haxe;%PATH%
- set HAXEPATH=%CD%\haxe
- run haxelib to check tat it works
- check what your current haxe lib dir is:
- haxelib config
- You want to write this down somewhere, because you can only have one haxe lib location active in your system, and when you want to switch back to your regular haxe environment, you'll need to run the next command again, but with the original location
- switch your lib location to this temporary setup
- haxelib setup %CD%\haxe\lib
- check that it worked
- haxelib config
Now we are ready to install some libs.
- haxelib install hxcpp
That's it.
Currently the code is available on https://github.com/zobo/flashdevelop.git branch feature/hxcppdebugger
- git clone https://github.com/zobo/flashdevelop.git
- cd flashdevelop
- git checkout feature/hxcppdebugger
Build it
- msbuild /p:Configuration=Debug;Platform=x86
Run it
- FlashDevelop\Bin\Debug\FlashDevelop.exe
You will also need a special debugger middleware implementation to work with FD.
- git clone https://github.com/zobo/fdorg-hxcpp-debugger
- haxelib dev fdorg-hxcpp-debugger fdorg-hxcpp-debugger
Note. Until a certain fix is available in haxe (https://github.com/HaxeFoundation/haxe/pull/2804) compilation of this component will probably fail. Apply the fix manually:
- Open %HAXEPATH%/std/cpp/vm/Debugger.hx
- on line 153 add a "Int ->" at the beginning of the list.
In FD create a new project
- Project/New Project
- Haxe/C++ Project
- Project name: testcpp1
- Location: C:\haxetest
- check Create directory for project
Now first thing is to add the classpath to the debugger code.
- Project/Properties...
- Compiler options
- Set "Enable Debugger" to true
- Open General/Directives and add HXCPP_DEBUGGER
- Open General/Libraries and add "fdorg-hxcpp-debugger"
Select Debug configuration. If you did everything right you can set a breakpoint, F5 and project will run. I suggest adding a few lines of traces at the end of main function and breaking there.
Fun, lets try something else. Go back to your CMD window and install OpenFL
- haxelib install lime
- haxelib run lime setup
- haxelib run lime install openfl
- haxelib run lime install actuate
Go back to FD and create a new project
- Project/New Project
- Haxe/OpenFL Project
- Project name: testfl1
- Location: C:\haxetest
- check Create directory for project
Open application.xml and add the following at the end, before </project>
<haxedef name="HXCPP_DEBUGGER" />
<haxelib name="fdorg-hxcpp-debugger" />
Again, select Debug configuration and check if Enable debugger is set in project properties. Also select "windows" target.
NOTE! At the time of writing, openfls hxlibc is too old to compile, you need to use hxcpp. To do that just the following line at the end of application.xml, before the closing tag:
<cpp build-library="hxcpp" />
In your main hx file, where you have "static public function main()" add the following code:
#if HXCPP_DEBUGGER
new org.flashdevelop.cpp.debugger.HaxeRemote(true, "127.0.0.1");
#end
If your code starts, but you don't see what you expect, start by enabling verbose debugger output:
- Tools/Program Settings...
- FlashDebugger
- Verbose Output - True
This will help analyze what is going on with the protocol.