Closed tanis2000 closed 3 years ago
Hey! Did you codesign the installation properly as mentioned in the install instructions? (It should actually have a guard for that error, but who knows). Also which macOS version?
@rcstuber yes, I did codesign it as it complained about the hashlink executable not being correctly signed ;) The version of macOS is Catalina 10.15.7 I would like to debug the extension to help you with that but I have no experience with VSCode extensions. I cloned the repo into my extensions folder, compiled it according to the instructions but then I open VSCode but from there I am lost. I tried with the launch.json included in this project but it just doesn't to anything, it looks like it starts a node server and then nothing else. I have no idea how to debug it at that point :)
Can you try removing the extension from the folder and install it from the VSCode Extension Store (search "HashLink Debugger")? It is up-to-date. I vaguely remember something about pre-built FFI bindings for OSX being included there. Then best restart VSCode once.
Just tried, same issue.
BTW building the current master branch of this extension throws the following error:
src/HLAdapter.hx:269: characters 56-59 : String should be { message : String }
src/HLAdapter.hx:269: characters 56-59 : ... String has no field message
src/HLAdapter.hx:269: characters 56-59 : ... For function argument 'message'
File "src/core/globals.ml", line 117, characters 1-7: Assertion failed
The terminal process "haxe '--connect', '6000', 'build.hxml'" terminated with exit code: 1.
Best join the #tools channel on the Haxe Discord: https://discord.gg/9RHEazws
I will join there, but I find it much better to keep things in issues like this as it's easier to keep the conversation and its documentation in a single searchable place :)
BTW trying to further debug the issue, I cannot make the node server work. I believe it's got to do with the macOS bindings:
➜ hashlink-debugger git:(master) ✗ /Users/tanis/.nvm/versions/node/v14.15.4/bin/node --nolazy ./adapter.js --server=4711
#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x7ffeefbfbb20
1: 0x1001142e2 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
2: 0x1010106d2 V8_Fatal(char const*, ...) [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
3: 0x1004d59b4 v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
4: 0x1001fb626 v8::ArrayBuffer::GetBackingStore() [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
5: 0x10006a01e napi_get_typedarray_info [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
6: 0x1070a7fb3 Napi::Buffer<char> Napi::Buffer<char>::New<Napi::Value FFI::WrapPointer<_ffi_type>(Napi::Env, _ffi_type*, unsigned long)::'lambda'(Napi::Env, char*)>(napi_env__*, char*, unsigned long, _ffi_type) [/Users/tanis/.vscode/extensions/hashlink-debugger/node_modules/ffi-napi/build/Release/ffi_bindings.node]
7: 0x1070a2ddb FFI::FFI::InitializeBindings(Napi::Env, Napi::Object) [/Users/tanis/.vscode/extensions/hashlink-debugger/node_modules/ffi-napi/build/Release/ffi_bindings.node]
8: 0x1070a68c3 __napi_Init(napi_env__*, napi_value__*) [/Users/tanis/.vscode/extensions/hashlink-debugger/node_modules/ffi-napi/build/Release/ffi_bindings.node]
9: 0x10007b63c napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*)) [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
10: 0x100080d95 std::__1::__function::__func<node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0, std::__1::allocator<node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>, bool (node::binding::DLib*)>::operator()(node::binding::DLib*&&) [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
11: 0x10007fd90 node::Environment::TryLoadAddon(char const*, int, std::__1::function<bool (node::binding::DLib*)> const&) [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
12: 0x10007fb5d node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
13: 0x10025a4e8 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
14: 0x100259a7c v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
15: 0x1002591a2 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
16: 0x100a7a359 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/tanis/.nvm/versions/node/v14.15.4/bin/node]
[1] 82690 illegal hardware instruction /Users/tanis/.nvm/versions/node/v14.15.4/bin/node --nolazy ./adapter.js
I'm going to close this as I managed to get it running. The actual problem was a lingering libhl.dylib in /usr/local/lib that was probably a leftover from a year ago installation. I simply removed that library and set LIBHL_PATH to the right folder for my installation and now everything is working fine. It would still be nice to have some documentation on how to debug the extension itself a I wan't really able to do that.
Ok, here's how to debug the extension itself:
1. Launch the "Adapter" configuration from the hashlink-debugger project's `launch.json` in debug mode
2. Set a breakpoint somewhere, i.e. in `HLAdapter.hx`
3. Open another project (your game) and edit your launch config to include this: `"debugServer": 4711`
4. Start a debug session from your project
You should now see the breakpoint in the extension being triggered and be able to step trough.
Regards
@rcstuber thanks so much!
I'm just trying to debug an hl binary on macOS but I'm getting the following error:
Failed to initialize debugger
Called from /Users/tanis/.vscode/extensions/haxefoundation.haxe-hl-1.1.1/adapter.js line 311 column 10 Called from /Users/tanis/.vscode/extensions/haxefoundation.haxe-hl-1.1.1/adapter.js line 103 column 29 Called from /Users/tanis/.vscode/extensions/haxefoundation.haxe-hl-1.1.1/node_modules/vscode-debugadapter/lib/debugSession.js line 342 column 22 Called from /Users/tanis/.vscode/extensions/haxefoundation.haxe-hl-1.1.1/node_modules/vscode-debugadapter/lib/protocol.js line 97 column 38 Called from /Users/tanis/.vscode/extensions/haxefoundation.haxe-hl-1.1.1/node_modules/vscode-debugadapter/lib/protocol.js line 18 column 44 Called from events.js line 315 column 20 Called from _stream_readable.js line 295 column 12 Called from _stream_readable.js line 271 column 9 Called from Readable.push (_stream_readable.js line 212 column 10) Called from internal/stream_base_commons.js line 186 column 23
This is the relevant part of my launch.json:
HashLink version is 1.12.0 compiled from the master branch yesterday.
Is there anything I can do to help you debug this issue?