Skip to content

Conversation

@ZeeWanderer
Copy link

@ZeeWanderer ZeeWanderer commented Jul 23, 2025

SO far i had gotten the tests to run but they fail with

%%% edb_dap_attach_SUITE: 
%%% edb_dap_attach_SUITE ==> test_attaches_if_node_is_alive: FAILED
%%% edb_dap_attach_SUITE ==> {timeout,{gen_server,call,
                     [<0.1584.0>,
                      #{command => <<"initialize">>,type => request,
                        arguments => #{adapterID => <<"edb for BSCode">>}}]}}
[2025-07-23T19:54:24.166000+03:00] [info] Application: compiler. Started at: nonode@nohost. [application_controller:info_started/2 L2117] <0.45.0>
[2025-07-23T19:54:24.178000+03:00] [info] Application: crypto. Started at: nonode@nohost. [application_controller:info_started/2 L2117] <0.45.0>
[2025-07-23T19:54:24.179000+03:00] [info] Application: syntax_tools. Started at: nonode@nohost. [application_controller:info_started/2 L2117] <0.45.0>
[2025-07-23T19:54:24.186000+03:00] [info] Supervisor: {local,edb_core_sup}. Started: id=edb_node_monitor,pid=<0.91.0>. [supervisor:report_progress/3 L2240] <0.90.0>
[2025-07-23T19:54:24.186000+03:00] [info] Application: edb_core. Started at: nonode@nohost. [application_controller:info_started/2 L2117] <0.45.0>
[2025-07-23T19:54:24.190000+03:00] [info] Supervisor: {local,edb_sup}. Started: id=edb_dap_thread_id_mappings,pid=<0.95.0>. [supervisor:report_progress/3 L2240] <0.94.0>
[2025-07-23T19:54:24.190000+03:00] [info] Supervisor: {local,edb_sup}. Started: id=edb_dap_frame_id_mappings,pid=<0.96.0>. [supervisor:report_progress/3 L2240] <0.94.0>
[2025-07-23T19:54:24.190000+03:00] [info] Supervisor: {local,edb_sup}. Started: id=edb_dap_vars_ref_mappings,pid=<0.97.0>. [supervisor:report_progress/3 L2240] <0.94.0>
[2025-07-23T19:54:24.192000+03:00] [info] Supervisor: {local,edb_sup}. Started: id=edb_dap_server,pid=<0.98.0>. [supervisor:report_progress/3 L2240] <0.94.0>
[2025-07-23T19:54:24.194000+03:00] [info] Supervisor: {local,edb_sup}. Started: id=edb_dap_transport,pid=<0.99.0>. [supervisor:report_progress/3 L2240] <0.94.0>
[2025-07-23T19:54:24.194000+03:00] [info] Application: edb. Started at: nonode@nohost. [application_controller:info_started/2 L2117] <0.45.0>

i assume it's not supposed to be nonode@nohost, doesn't show up in epmd -names either.

Any advice?

@jcpetruzza
Copy link
Contributor

First a quick sanity-check question:

  • Are the tests in edb_SUITE passing for you?
    • If not, since you are working on the main branch, are you using vanilla OTP-28 or have you built your own from the git submodule in the otp/ directory? (if the former, please use the otp-28.0 branch, as you may otherwise encounter test failures)

i assume it's not supposed to be nonode@nohost, doesn't show up in epmd -names either

I think this is fine. What you are seeing is the DAP server starting; it talks with the client (ie the IDE) via stdin/stdout, so it doesn't need distribution (if the ide later tells it to attach to a running node, it will start distribution, using short or long names, depending on the node it needs to attach to).

{timeout,{gen_server,call,
[<0.1584.0>,
#{command => <<"initialize">>,type => request,
arguments => #{adapterID => <<"edb for BSCode">>}}]}

This is strange. The "initialize" request is the first thing the client sends so if there's no reply, it means like the very basic communication is failing. According to the spec

The base protocol exchanges messages that consist of a header and a content part (comparable to HTTP). The header and content part are separated by a \r\n (carriage return, line feed).

So wondering if could it be related to that? E.g. Erlang replacing \r\n in strings by \n or something?

To debug this further you could perhaps enable debug logging?

@ZeeWanderer
Copy link
Author

The problem turned out twofold. Should use escript directly instead of edb.cmd because that introduces some sort of stdin/stdout layering issue, and you were right. On Windows \r is stripped out because the mode is inherited and apparently specifying binary does nothing if the inherited mode is _O_TEXT. The simplest solution is to relax <<"\r\n\r\n">> to [<<"\r\n\r\n">>, <<"\n\n">>]. When relaxed, only 56 tests fail.

@ZeeWanderer
Copy link
Author

I am having a problem with code:get_debug_info/1, it does not return calls. I checked the otp submodule otp-28.0 branch you recommended i use, and it has no difference from vanilla OPT28.0, which i am using. Did i misunderstand something?

@ZeeWanderer
Copy link
Author

Now only 3 tests relying on calls in debug info fail, and the ones needing wa_test_init all get skipped

@ZeeWanderer
Copy link
Author

Can anyone please review c0173c3? I had to twist it quite a bit to get it to work.

@ZeeWanderer
Copy link
Author

Still cant hit a breackpoint on windows with vscode + elp + edb but at the very least it interfaces correctly and loads the project modules.

@ZeeWanderer ZeeWanderer marked this pull request as ready for review August 6, 2025 20:26
@robertoaloi
Copy link
Contributor

@ZeeWanderer May I recommend to split this PR into multiple, smaller ones? That will make it easier to get them reviewed/merged. There's also a conflict on edb_bootstrap that should be addressed.

@ZeeWanderer ZeeWanderer marked this pull request as draft August 28, 2025 15:59
@ZeeWanderer
Copy link
Author

ZeeWanderer commented Aug 28, 2025

Sure, @robertoaloi how do you want it split? Also i think the rebar3 stuff needs more work. As you can see i have added a function to add ebin paths add_project_paths because otherwise they are not in the lookup table at all at the time edb starts looking, maybe the root cause is elsewhere, i just haven't found it yet.

@ZeeWanderer ZeeWanderer force-pushed the main branch 2 times, most recently from 672367f to 5356952 Compare August 28, 2025 16:08
@robertoaloi
Copy link
Contributor

@ZeeWanderer I'd say let's first get the Windows-specific bits which are not affecting the regular mechanism (e.g. the carriage return / new line changes in one PR, the escript-related ones in another one). Then we can look at the core changes (edb_server, edb_server_code). The rebar3 changes can be also separate and they probably need some generalization (e.g. one could use different profiles?)

I tested edb with ELP and it turned out that on windows there are string escaping shenanigans. Had to twist the code quite a bit to lessen the amount of things that forcefully get escaped in a manner unsupported by windows powershell.
for some reason on windows with rebatr3 edb wails with modules not found if project ebin is not added.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants