prb28 / vscode-amiga-assembly

Amiga Assembly extension for Visual Studio Code
GNU General Public License v3.0
178 stars 12 forks source link

Waiting for debugger, FS-UAE on MacM1 #280

Closed akikoplays closed 2 months ago

akikoplays commented 10 months ago

Hello, I have adjusted the launch config to use 68020 and JIT, and it happens very often that VSCode hangs while waiting for the debugger:

...
[LAUNCH] Connecting to remote debugger... [9]
[LAUNCH] Connecting to remote debugger... [10]
[LAUNCH] Connecting to remote debugger... [11]
[LAUNCH] Connecting to remote debugger... [12]
...

And then after a while I see this:

To client: {"seq":0,"type":"event","event":"terminated"}
14
TypeError: Cannot read properties of undefined (reading 'message') Unhandled Rejection at Promise [object Promise]
From client: disconnect({"restart":false})
To client: {"seq":0,"type":"response","request_seq":3,"command":"disconnect","success":true}
Shutting down

When I disable debug in the settings everything runs fine. When I change to 68000 it happens less frequently than with 68020. But it still happens occasionally.

p.s. this extension is amazing in every other aspect!! Thank you so much for it, even with this glitch I am using it without the debugger ON, to quickly cook some Amiga code :)

grahambates commented 10 months ago

This will be an issue in uae-dap, so I'll look into it. I wonder if its a timing issue where the emulator/program start quicker than the debugger. I'll see if I can reproduce it. It also looks like the error handling on timeout isn't right.

akikoplays commented 9 months ago

Thanks a lot for looking into it. It seems to me that it has something to do with the speed of the cpu selected. Here are a couple more findings, maybe helpful: when the issue occurs, you can't kill fs-uae, at least not via VS Code, nor if you click the X button to close fs-uae which is stuck. I kill it by launching terminal and invoking:

pkill -9 fs-uae-darwin_x64

This kills the instance, alright. However, if I now launch a debugger again (F5), I notice that in the output I get something like this:

[LAUNCH] Connecting to remote debugger... [3]
[LAUNCH] Connecting to remote debugger... [12]
[LAUNCH] Connecting to remote debugger... [4]
[LAUNCH] Connecting to remote debugger... [5]
[LAUNCH] Connecting to remote debugger... [13]
[LAUNCH] Connecting to remote debugger... [6]
[LAUNCH] Connecting to remote debugger... [7]

To me this seems as if there are concurrently two fs-uae's running and/or waiting to connect to the remote debugger, hence the 3,4,5... and 12,13,... in parallel.

If I then kill and reload vs code, the next time I get stuck there seems to be only one instance (as the order is 1,2,3,4,5.. without overlapping). So, it seems it's not enought to pkill the fs-uae, vs code needs to be reloaded (either via Developer: Reload Window, or kill and restart).

Interesting.

akikoplays commented 9 months ago

Maybe I am hallucinating, but I was working today with the debugger, and not once got the aforementioned issue. The only difference is that I was always exiting the debugger using vscode stop (or shift+F5 shortcut). I will keep doing that just to check if it's a false positive :)