Open jcward opened 8 years ago
@jcward said:
@mpoint4u thanks for the note. You can safely ignore those errors in launch.json. The latter are a bug in vscode ("node" isn't the only debug type that's accepted.) My debug adapter doesn't use "program" -- I suppose you could add "program":"" to make validation happy, but it hasn't caused problems for me without it.
I think the app seems like it isn't launching because it's actually crashing near time 0. Check out /tmp/adapter.log
and see what's at the end. You might see something like this:
1450216349.08474: Starting VSCHaxeServer port 6972...
1450216349.08487: Launching application...
1450216349.08492: Sending 109 bytes:
1450216349.08494: {"type":"event","body":{"category":"console","output":"Launching application...\n"},"event":"output","seq":5}
1450216349.09055: VSCHS: Listening for client connection on localhost:6972 ...
1450216349.12907: cmd: open /tmp/run
1450216349.12916: args: open|/tmp/run
1450216349.12962: Starting: open /tmp/run, pid=13210
1450216366.30884: VSCHS: Received connection from 127.0.0.1.
1450216366.33897: Got message: OK
1450216366.39408: Got message: ThreadStopped(0,1,debugger.HaxeRemote,new,debugger/HaxeRemote.hx,73)
1450216366.39416:
Thread 0 stopped in debugger.HaxeRemote.new() at debugger/HaxeRemote.hx:73.
1450216366.39433: VSCH: got cmd: Files
1450216366.39452: VSCH: got cmd: FilesFullPath
1450216366.39459: VSCH: got cmd: SetCurrentThread(0)
1450216366.39465: VSCH: got cmd: WhereCurrentThread(false)
1450225796.29153: VSCHS: Client disconnected.
So in the above, the client starts (pid=13210) and connects, but after I send a couple commands (Files, FilesFullPath, SetCurrentThread, etc) the client disconnects (and I think crashes with the stack trace I put in the bug report above.)
The /tmp/adapter.log file is available on linux and mac, and if you create a C:\tmp folder on windows, also there.
@mpoint4u said:
sorry, a little late ... but here is what I get in /tmp/adapter.log when I try to launch the debugger in VS Code on the DisplayingABitmap - test project ...
(PS: I am using Haxe Compiler 3.2.1 / hxcpp: [3.2.193] / lime: [2.7.0] with MacBook 64 bit on OSX El Capitan 10.11.2)
------- /tmp/adapter.log -----------------------------------
1450452063.3344: Reading 124 bytes...
1450452063.33459: {"type":"request","seq":1,"command":"initialize","arguments":{"adapterID":"hxcpp","linesStartAt1":true,"pathFormat":"path"}}
1450452063.33514: Got command: initialize
1450452063.33518: Initializing...
1450452063.33522: Sending 55 bytes:
1450452063.33523: {"success":true,"command":"initialize","request_seq":1}
1450452063.38643: Reading 489 bytes...
1450452063.38669: {"type":"request","seq":2,"command":"launch","arguments":{"runtimeExecutable":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron","args":["runPath=/Users/marcus/DEV/haxe_stuff/test-openfl/Export/mac64/cpp/bin/","runCommand=DisplayingABitmap","runInTerminal=false"],"name":"Debug","type":"hxcpp","request":"launch","program":null,"stopOnEntry":true,"outDir":null,"address":"localhost","cwd":"/Users/marcus/DEV/haxe_stuff/test-openfl","runtimeArgs":null,"extensionHostData":null}}
1450452063.38676: Got command: launch
1450452063.38677: Launching... proj_dir=/Users/marcus/DEV/haxe_stuff/test-openfl
1450452063.38679: Arg runPath is /Users/marcus/DEV/haxe_stuff/test-openfl/Export/mac64/cpp/bin/
1450452063.3868: Arg runCommand is DisplayingABitmap
1450452063.38681: Arg runInTerminal is false
1450452063.38683: Starting VSCHaxeServer port 6972...
1450452063.38692: Launching application...
1450452063.38696: Sending 109 bytes:
1450452063.38697: {"type":"event","body":{"category":"console","output":"Launching application...\n"},"event":"output","seq":1}
1450452063.38709: cmd: DisplayingABitmap
1450452063.38878: VSCHS: Listening for client connection on localhost:6972 ...
1450452063.38931: args: DisplayingABitmap
1450452063.38987: Starting: DisplayingABitmap, pid=8407
1450452063.38996: Sending 51 bytes:
1450452063.38997: {"success":true,"command":"launch","request_seq":2}
1450452078.98895: Reading 101 bytes...
1450452078.98903: {"type":"request","seq":3,"command":"disconnect","arguments":{"extensionHostData":{"restart":false}}}
1450452078.98905: Got command: disconnect
1450452078.98912: Sending 55 bytes:
1450452078.98913: {"success":true,"command":"disconnect","request_seq":3}
1450452078.98918: Killing _run_process
1450452095.14045: Reading 124 bytes...
1450452095.14053: {"type":"request","seq":1,"command":"initialize","arguments":{"adapterID":"hxcpp","linesStartAt1":true,"pathFormat":"path"}}
1450452095.14055: Got command: initialize
1450452095.14056: Initializing...
1450452095.14059: Sending 55 bytes:
1450452095.14059: {"success":true,"command":"initialize","request_seq":1}
1450452095.19573: Reading 489 bytes...
1450452095.19606: {"type":"request","seq":2,"command":"launch","arguments":{"runtimeExecutable":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron","args":["runPath=/Users/marcus/DEV/haxe_stuff/test-openfl/Export/mac64/cpp/bin/","runCommand=DisplayingABitmap","runInTerminal=false"],"name":"Debug","type":"hxcpp","request":"launch","program":null,"stopOnEntry":true,"outDir":null,"address":"localhost","cwd":"/Users/marcus/DEV/haxe_stuff/test-openfl","runtimeArgs":null,"extensionHostData":null}}
1450452095.19614: Got command: launch
1450452095.19615: Launching... proj_dir=/Users/marcus/DEV/haxe_stuff/test-openfl
1450452095.19617: Arg runPath is /Users/marcus/DEV/haxe_stuff/test-openfl/Export/mac64/cpp/bin/
1450452095.19619: Arg runCommand is DisplayingABitmap
1450452095.1962: Arg runInTerminal is false
1450452095.19623: Starting VSCHaxeServer port 6972...
1450452095.19642: Launching application...
1450452095.1965: Sending 109 bytes:
1450452095.19653: {"type":"event","body":{"category":"console","output":"Launching application...\n"},"event":"output","seq":1}
1450452095.19674: cmd: DisplayingABitmap
1450452095.197: args: DisplayingABitmap
1450452095.19773: Starting: DisplayingABitmap, pid=8413
1450452095.19784: Sending 51 bytes:
1450452095.19786: {"success":true,"command":"launch","request_seq":2}
1450452095.19971: VSCHS: Listening for client connection on localhost:6972 ...
1450452107.12429: Reading 101 bytes...
1450452107.12435: {"type":"request","seq":3,"command":"disconnect","arguments":{"extensionHostData":{"restart":false}}}
1450452107.12439: Got command: disconnect
1450452107.12441: Sending 55 bytes:
1450452107.12441: {"success":true,"command":"disconnect","request_seq":3}
1450452107.12446: Killing _run_process
Later in the evening I will try to debug the DisplayingABitmap - test project in VS Code on 64bit Linux ... and see what I will get ... and report then ...
Hi @mpoint4u - in your log, you can see that the client never connected -- in the below "disconnect" means you hit the stop button in the GUI:
1450452095.19971: VSCHS: Listening for client connection on localhost:6972 ... 1450452107.12429: Reading 101 bytes... 1450452107.12435: {"type":"request","seq":3,"command":"disconnect","arguments":{"extensionHostData":{"restart":false}}} 1450452107.12439: Got command: disconnect
What're you're missing is:
1450216366.30884: VSCHS: Received connection from 127.0.0.1.
Did you put the new HaxeRemote(true, "127.0.0.1");
in your code, as well as the steps in "your app needs to" in the readme? Those things cause it to launch a debug client. I've also seen weird problems on mac where server/client uses 127.0.0.1 / localhost and they don't connect.
Thanks for your feedback!
Hi Jeff,
now I switched in the new HaxeRemote(true, "127.0.0.1"); statement in the constructor of the Main.hx class ...
recompiled ... and ...
... it's still not connecting ... !!
I will check all the other stuff, which could disrupt a socket connection on '127.0.0.1' (firewall is turned off in my case, a bunch of other connections on '127.0.0.1' exists - as you can see in the screenshot ... ).
How could I get a proof that the 'server part' of the hxcpp-debug-adapter effectively works on Mac OSX ... ?!?
Cheers, Marcus
------- end of /tmp/adapter.log ----------------------------- .......... .......... 1450686481.20449: Compiler: xcrun --sdk macosx10.11 clang++ -o ApplicationMain-debug -stdlib=libstdc++ -framework Cocoa -isysroot /Applica$
1450686481.20458: Sending 382 bytes: 1450686481.20459: {"type":"event","body":{"category":"console","output":"xcrun --sdk macosx10.11 clang++ -o ApplicationMain-debug -stdlib=$ 1450686481.20462: Sending 83 bytes: 1450686481.20463: {"type":"event","body":{"category":"console","output":""},"event":"output","seq":6} 1450686483.2145: Compile succeeded! 1450686483.2146: Sending 103 bytes: 1450686483.21462: {"type":"event","body":{"category":"console","output":"Compile succeeded!\n"},"event":"output","seq":7} 1450686483.21469: Starting VSCHaxeServer port 6972... 1450686483.21487: Launching application... 1450686483.21495: Sending 109 bytes: 1450686483.21497: {"type":"event","body":{"category":"console","output":"Launching application...\n"},"event":"output","seq":8} 1450686483.21522: cmd: DisplayingABitmap 1450686483.21532: args: DisplayingABitmap 1450686483.21623: Starting: DisplayingABitmap, pid=34012 1450686483.21847: VSCHS: Listening for client connection on localhost:6972 ...
could it be that, for whatever reason, the current MacOSX operating system allows only port connections higher than 10000 on the local network interface ('127.0.0.1' or 'localhost') ... ?!? It just hits the eye that all client connections on '127.0.0.1' in my above screenshot are higher than that ... I had a quick Google research on that, but that did not reveal very much either ...
While your vscode is sitting waiting for the connection, try:
telnet localhost 6972
or
telnet 127.0.0.1 6972
From a terminal window. This will attempt to connect to the server. If you get "connection refused", then something with the network or server isn't working. If you get "Connected to localhost, Escape character is ^]" then it did connect, and the problem is on the client app side.
Also, do i pull and rebuild (haxe build-mac.hxml) -- I put in some more error/warning messages that could help in pointing out issues.
pmMacBookPro:Desktop marcus$ telnet 127.0.0.1 6972 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Haxe debug server v1.1 ready and willing, sir!
server part seems to be OK ... so it should be the client ...
full output for last attempt of compile & debug ...
1450713215.29324: Reading 124 bytes... 1450713215.29353: {"type":"request","seq":1,"command":"initialize","arguments":{"adapterID":"hxcpp","linesStartAt1":true,"pathFormat":"path"}} 1450713215.2936: Got command: initialize 1450713215.29362: Initializing... 1450713215.29368: Sending 55 bytes: 1450713215.29369: {"success":true,"command":"initialize","request_seq":1} 1450713215.34757: Reading 591 bytes... 1450713215.3481: {"type":"request","seq":2,"command":"launch","arguments":{"runtimeExecutable":"/Applications/Visual Studio Code.app/Contents/MacOS/Electr$ 1450713215.34822: Got command: launch 1450713215.34824: Launching... proj_dir=/Users/marcus/DEV/haxe_stuff/test-openfl 1450713215.34827: Arg compilePath is /Users/marcus/DEV/haxe_stuff/test-openfl 1450713215.34829: Arg compileCommand is openfl build mac -64 -debug -DHXCPP_DEBUGGER 1450713215.34831: Arg runPath is /Users/marcus/DEV/haxe_stuff/test-openfl/Export/mac64/cpp/bin/ 1450713215.34833: Arg runCommand is DisplayingABitmap 1450713215.34834: Arg runInTerminal is false 1450713215.34837: Compiling... 1450713215.34842: Sending 97 bytes: 1450713215.34844: {"type":"event","body":{"category":"console","output":"Compiling...\n"},"event":"output","seq":1} 1450713215.34868: cmd: openfl build mac -64 -debug -DHXCPP_DEBUGGER 1450713215.34894: args: openfl|build|mac|-64|-debug|-DHXCPP_DEBUGGER 1450713215.34986: Starting: openfl build mac -64 -debug -DHXCPP_DEBUGGER, pid=2054 1450713215.35027: Sending 51 bytes: 1450713215.3503: {"success":true,"command":"launch","request_seq":2} 1450713223.72217: Compiler: xcrun --sdk macosx10.11 clang++ -Iinclude -c -fvisibility=hidden -stdlib=libstdc++ -g -I/usr/local/lib/haxe/lib/hxcpp/3,2,193/$ 1450713223.72226: Sending 593 bytes: 1450713223.72227: {"type":"event","body":{"category":"console","output":"xcrun --sdk macosx10.11 clang++ -Iinclude -c -fvisibility=hidden -stdlib=libstdc+$ 1450713223.72231: Sending 83 bytes: 1450713223.72232: {"type":"event","body":{"category":"console","output":""},"event":"output","seq":3} 1450713225.17157: Compiler: xcrun --sdk macosx10.11 clang++ -o ApplicationMain-debug -stdlib=libstdc++ -framework Cocoa -isysroot /Applications/Xcode.app/$
1450713225.17173: Sending 382 bytes: 1450713225.17175: {"type":"event","body":{"category":"console","output":"xcrun --sdk macosx10.11 clang++ -o ApplicationMain-debug -stdlib=libstdc++ -frame$ 1450713225.17182: Sending 83 bytes: 1450713225.17185: {"type":"event","body":{"category":"console","output":""},"event":"output","seq":5} 1450713226.51686: Compile succeeded! 1450713226.51702: Sending 103 bytes: 1450713226.51704: {"type":"event","body":{"category":"console","output":"Compile succeeded!\n"},"event":"output","seq":6} 1450713226.51712: Starting VSCHaxeServer port 6972... 1450713226.5173: Launching application... 1450713226.51744: Sending 109 bytes: 1450713226.51746: {"type":"event","body":{"category":"console","output":"Launching application...\n"},"event":"output","seq":7} 1450713226.51767: cmd: DisplayingABitmap 1450713226.51774: args: DisplayingABitmap 1450713226.5187: Starting: DisplayingABitmap, pid=2087 1450713226.5208: VSCHS: Listening for client connection on localhost:6972 ...
Did you pull and rebuild? There should be a warning that the client didn't reconnect.
So then, make sure the app has all 3:
1) Compiled in -debug
mode
2) new HaxeRemote(...)
3) -D HXCPP_DEBUGGER
just tried another few things, but it looks like that the compiles client NOT EVEN tries to connect ...
my Main.hx looks like this:
package;
import openfl.display.Bitmap; import openfl.display.BitmapData; import openfl.display.Sprite; import openfl.Assets;
import debugger.HaxeRemote;
class Main extends Sprite {
public function new () {
new debugger.HaxeRemote(true, "127.0.0.1");
//new debugger.Local(true);
super ();
var bitmap = new Bitmap (Assets.getBitmapData ("assets/openfl.png"));
addChild (bitmap);
bitmap.x = (stage.stageWidth - bitmap.width) / 2;
bitmap.y = (stage.stageHeight - bitmap.height) / 2;
}
}
and compiles without a halt ....
but when I try to build it from the command line, I get ....
openfl build mac -64 -debug -DHXCPP_DEBUGGER xcrun --sdk macosx10.11 clang++ -Iinclude -c -fvisibility=hidden -stdlib=libstdc++ -g -I/usr/local/lib/haxe/lib/hxcpp/3,2,193/include -DHX_MACOS -m64 -Wno-parentheses -Wno-null-dereference -Wno-unused-value -Wno-format-extra-args -Wno-bool-conversion -DHXCPP_DEBUG -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS -DHXCPP_DEBUGGER -DHXCPP_API_LEVEL=321 -x c++ -frtti -Wno-invalid-offsetof ./src/ApplicationMain.cpp -o/Users/marcus/DEV/haxe_stuff/test-openfl/Export/mac64/cpp/obj/obj/darwin64-debug/2af284d7_ApplicationMain.o xcrun --sdk macosx10.11 clang++ -o ApplicationMain-debug -stdlib=libstdc++ -framework Cocoa -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -m64 @/Users/marcus/DEV/haxe_stuff/test-openfl/Export/mac64/cpp/obj/obj/darwin64-debug/all_objs
which does not look so good anymore (it's talking about NULL references etc) ...
my launch.json now looks like this ...
{ "version": "0.2.0", "configurations": [ { "runtimeExecutable": "${execPath}", "args": [ "compilePath=${workspaceRoot}", "compileCommand=openfl build mac -64 -debug -DHXCPP_DEBUGGER", "runPath=${workspaceRoot}/Export/mac64/cpp/bin/", "runCommand=DisplayingABitmap", "runInTerminal=false" ], "name": "Build and debug", "type": "hxcpp", "request": "launch", "stopOnEntry": true }, { "runtimeExecutable": "${execPath}", "args": [ "runPath=${workspaceRoot}/Export/mac64/cpp/bin/", "runCommand=DisplayingABitmap", "runInTerminal=false" ], "name": "Debug", "type": "hxcpp", "request": "launch", "program": "myProgram", "stopOnEntry": true } ] }
Hmm, it seems like you have all the elements. I'll do some more Mac testing this evening and get back to you. It could also be interesting, while your code server is waiting for a connection, to try launching it from the commandline to see what your app says in the terminal.
(I don't see the null references in the output above -- did you paste the whole output?)
OK, I will check that later ... have to leave for meeting family at dinner ... ;-)
Hi Jeff ... seems like I got the "Mac version" of the "Blue Screen of Death" on my MacBook now ...
after some recherche I assume it will be something like https://discussions.apple.com/message/29125114#29125114
so it looks like I am not able to investigate for some time on our issue... anyway, I am on Linux Mint 17 "Qiana" now on my second Notebook now, and as this distro is based on Ubuntu 14.04 ... https://www.google.com.ua/?gfe_rd=cr&ei=Yzp7Vre6PIyu8wftkL2IBA&gws_rd=ssl#q=linux+mint+17+is+based+on+ubuntu+LTS ... I can at least continue to use vscode-hxcpp-debug on Linux (as long as it takes to restore the MacBook to MacOSX Yosemite ... no El Capitan anymore ...))
not particularely GOOD news, but ... anyway ... cheers & a happy holiday season !!
@mpoint4u - sorry about your crash. If you're up and running again, FYI, a large fix was checked in #19 / #31. I'm not sure it's the same as the issue you're experiencing, but it may be worth trying again.
Hi, I tried right now on osx and got the very same result. Any suggestions? Edit: It turns out you need to pass complete osx executable on runCommand (like "MyApp.app/Contents/MacOS/MyApp"). Then it executes and attaches debugger correctly.
@arthurferrai ah, ok, I'm not entirely familiar the conventions of OSX apps directory structure. So the test openfl
app's launch.json
run path may need to be modified?
@jcward the run path is ok, the problem is with run command. My entry is as follows:
{
"name": "OSX: Debug",
"runtimeExecutable": "${execPath}",
"args": [
"runPath=${workspaceRoot}/export/mac64/cpp/bin/",
"runCommand=adventure-card-game.app/Contents/MacOS/adventure-card-game",
"runInTerminal=false"
],
"type": "hxcpp",
"request": "launch",
"stopOnEntry": true
}
That's interesting, have to try that !! ... (Just read that now, did not appear on my radar earlier / was also a few month away from computing due to family/moving/house stuff) ...
Hi @mpoint4u -- I think the issue you're experiencing is different than #19, so I've moved it here to its own thread.
@mpoint4u said on Dec 16:
same happens to me, when I try to start the actual executable on 64bit Mac (in '/Export/mac64/cpp/bin/DisplayingABitmap.app/Contents/MacOS/DisplayingABitmap') from the command line (because it does not launch from VS Code directly ... )
and if I try to debug the compiled program from VS Code debug perspective (via launch.json) I get a few error messages for missing property 'program' or wrong type value .... ....
PS: I am using Haxe Compiler 3.2.1 / hxcpp: [3.2.193] / lime: [2.7.0] with MacBook 64 bit on OSX El Capitan 10.11.1
all in all ... VS Code seems to be a quite nice editor / debugging enviroment ... (have to try it on Linux soon ... )