hashlink-debugger
hashlink-debugger copied to clipboard
CLI debugger exits after spawning hl process and connecting
Summary
Using hashlink-debugger as a command-line debugger does not appear to work for the hl build. When I start the debugger, it spawns the process to be debugged, then immediately exits.
This is how I'm building & running the debugger:
cd debugger
haxe compile.hxml
hl debug.hl ~/src/heaps-hello/hello.hl
Analysis
Digging into the source, it looks like it's hard-coded not to work for HLDebugApi.hx. This is the call-chain I traced:
After the connection is established Debugger.init()
calls api.start()
and will return false if the API fails to start:
https://github.com/vshaxe/hashlink-debugger/blob/5d021ccf066e8b3e5a0b65d2b90282fefe450e1f/hld/Debugger.hx#L163-L171
In my case api
is HLDebugApi, and its implementation is simply to return debugStart()
:
https://github.com/vshaxe/hashlink-debugger/blob/5d021ccf066e8b3e5a0b65d2b90282fefe450e1f/hld/HLDebugApi.hx#L31-L33
Which will always return false
:
https://github.com/vshaxe/hashlink-debugger/blob/5d021ccf066e8b3e5a0b65d2b90282fefe450e1f/hld/HLDebugApi.hx#L8
Questions
Is there a way to debug a process from the command-line using the hashlink vm?
debugStart is a native call so it will call debug_start C API from std.hdll (see the @:hlNative at the class declaration)
Le dim. 19 févr. 2023 à 21:34, David M. Lary @.***> a écrit :
Summary
Using hashlink-debugger as a command-line debugger does not appear to work for the hl build. When I start the debugger, it spawns the process to be debugged, then immediately exits.
This is how I'm building & running the debugger:
cd debugger haxe compile.hxml hl debug.hl ~/src/heaps-hello/hello.hl
Analysis
Digging into the source, it looks like it's hard-coded not to work for HLDebugApi.hx. This is the call-chain I traced:
After the connection is established Debugger.init() calls api.start() and will return false if the API fails to start:
https://github.com/vshaxe/hashlink-debugger/blob/5d021ccf066e8b3e5a0b65d2b90282fefe450e1f/hld/Debugger.hx#L163-L171
In my case api is HLDebugApi, and its implementation is simply to return debugStart():
https://github.com/vshaxe/hashlink-debugger/blob/5d021ccf066e8b3e5a0b65d2b90282fefe450e1f/hld/HLDebugApi.hx#L35-L37
Which will always return false:
https://github.com/vshaxe/hashlink-debugger/blob/5d021ccf066e8b3e5a0b65d2b90282fefe450e1f/hld/HLDebugApi.hx#L8 Questions
Is there a way to debug a process from the command-line using the hashlink vm?
— Reply to this email directly, view it on GitHub https://github.com/vshaxe/hashlink-debugger/issues/116, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZXQFTY37LJVTJI2LTEPTWYJ7T7ANCNFSM6AAAAAAVBFB7YM . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Ok, I’ll dig into the c code to see what’s going wrong. I’m getting no prompt from the debugger; it just drops back to the command line.
Ahh, damnit, I figured it out. I used homebrew to install hashlink. The homebrew recipe does not run the make codesign_osx
step.
Is there any way to add an error message somewhere along the mac codepath to remind the user to check for codesigning? Right now the debugger just exits with no output.
This is only implemented in the VSCode extension. See here: https://github.com/vshaxe/hashlink-debugger/blob/c609db82b438e209baea84ad1980696f17605782/src/Extension.hx#L28-L35
Note that the Mac Debugger won't work on Apple Silicon processors with Rosetta2!
You're welcome to submit a PR 😉
Le lun. 20 févr. 2023 à 10:09, rcstuber @.***> a écrit :
This is only implemented in the VSCode extension. See here: https://github.com/vshaxe/hashlink-debugger/blob/c609db82b438e209baea84ad1980696f17605782/src/Extension.hx#L28-L35
Note that the Mac Debugger won't work on Apple Silicon processors with Rosetta2!
— Reply to this email directly, view it on GitHub https://github.com/vshaxe/hashlink-debugger/issues/116#issuecomment-1436590894, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZXQFXDWRHSDKCY6IVK4TWYMYGFANCNFSM6AAAAAAVBFB7YM . You are receiving this because you commented.Message ID: @.***>