prb28 / vscode-amiga-assembly

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

Debugger does not connect #270

Closed Anketell closed 1 year ago

Anketell commented 1 year ago

I've recently installed Amiga Assembly which seems to work with the supplied example (gencop). Except that when launching the debugger FS-UAE Debug vscode does not connect to the emulator. Further more, the launched instance of FS-UAE is not listening on any TCP port (let alone 6860 as specified in the launch configuration). FS-UAE Run works fine.

VSCODE v1.79.2 Amiga Assembly v1.8.2

Anketell commented 1 year ago

Looking further, the Debug Console issues:

Emulator binary not found at '${extensionResourcesFolder}/bin/linux/fs-uae' Defaulting to bundled emulator binary

Which is correct. It is located at '${extensionResourcesFolder}/bin/linux/fs-uae/fs-uae'

I tried this as the emulator specification in launch.json - no joy.

Then I looked at the directory it is:

~/.vscode/extensions/bartmanabyss.amiga-debug-1.7.2

Whereas the version of the extension that I have installed is v1.8.2

Anketell commented 1 year ago

So specifying the full path to fs-uae in launch.json launches the correct binary. However, it is not listening on port 6860 or any other port for that matter. So vscode still doesn't connect.

prb28 commented 1 year ago

Are you using a Linux ?

Anketell commented 1 year ago

Yep, Fedora 36 I've since realised that the packaged fs-uae doesn't appear to run correctly at all. It won't run or debug a binary. I suspect that I'll need to rebuild fs-uae with the debugger extensions for FC36.

prb28 commented 1 year ago

I think you ran into this issue : https://github.com/prb28/vscode-amiga-assembly/issues/264

You need to install some libs.

Anketell commented 1 year ago

OK so:

[matth@plato ~]$ ldd ./.vscode/extensions/bartmanabyss.amiga-debug-1.7.2/bin/linux/fs-uae/fs-uae linux-vdso.so.1 (0x00007ffd62449000) libm.so.6 => /lib64/libm.so.6 (0x00007f9040af0000) libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007f9040aeb000) libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f90409af000) libGL.so.1 => /lib64/libGL.so.1 (0x00007f9040928000) libpng16.so.16 => /lib64/libpng16.so.16 (0x00007f90408ee000) libz.so.1 => /lib64/libz.so.1 (0x00007f90408d4000) libSDL2-2.0.so.0 => /lib64/libSDL2-2.0.so.0 (0x00007f90406fd000) libSDL2_ttf-2.0.so.0 => /lib64/libSDL2_ttf-2.0.so.0 (0x00007f90406ea000) libmpeg2.so.0 => /lib64/libmpeg2.so.0 (0x00007f90406cc000) libmpeg2convert.so.0 => /lib64/libmpeg2convert.so.0 (0x00007f90406c3000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f9040400000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f90406a3000) libc.so.6 => /lib64/libc.so.6 (0x00007f9040000000) /lib64/ld-linux-x86-64.so.2 (0x00007f9040be9000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f9040386000) libGLX.so.0 => /lib64/libGLX.so.0 (0x00007f904066f000) libX11.so.6 => /lib64/libX11.so.6 (0x00007f904023e000) libXext.so.6 => /lib64/libXext.so.6 (0x00007f904065a000) libGLdispatch.so.0 => /lib64/libGLdispatch.so.0 (0x00007f903ff47000) libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007f903fe79000) libharfbuzz.so.0 => /lib64/libharfbuzz.so.0 (0x00007f903fd90000) libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f9040212000) libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f9040645000) libbrotlidec.so.1 => /lib64/libbrotlidec.so.1 (0x00007f9040638000) libgraphite2.so.3 => /lib64/libgraphite2.so.3 (0x00007f903fd6e000) libXau.so.6 => /lib64/libXau.so.6 (0x00007f904020c000) libbrotlicommon.so.1 => /lib64/libbrotlicommon.so.1 (0x00007f903fd4b000)

Anketell commented 1 year ago

I think it looks good. It might be a bit more subtle than missing libs.

Anketell commented 1 year ago

The window comes up but doesn't seem to do anything. Maybe I didn't wait long enough. Mind you I waited more than enough time for the FC36 fs-uae to start up.

Anketell commented 1 year ago

The wndow's been blank for 30min now consuming ~13% cpu and ~77 Mb.

prb28 commented 1 year ago

No it should be fast. Are you trying with the example ? Did you enable the stop en entry ?

Anketell commented 1 year ago

Yep - Using the gencop sample, with stopOnEntry=true

Mind you even just running the "FS-UAE Run" fails in the same manner.

I'm wondering if the gdb extensions wouldn't be better merged into FS-UAE parent repo. Do you know if this has been explored with the maintainer?

Anketell commented 1 year ago

Just realised, he's been part of the conversation.

I assume this functionality was never merged into https://github.com/FrodeSolheim/fs-uae

Anketell commented 1 year ago

Alternatively, were there ever thoughts of building a wrapper to use the console_debugger and provide a gdbserver / DAP frontend ?

prb28 commented 1 year ago

Maybe one day it will be merged... Can you try to start fs-uae binary in a console ? (The one in the extension) I will try it this weekend with a fedora vm.

Anketell commented 1 year ago

My apologies, I've been barking up the wrong tree totally. I've been looking at the wrong extension image. fs-uae packaged with "amiga assembly" is working for running the example app.

When debugging, however, as menioned above it is not listening to on a TCP port.

Anketell commented 1 year ago

So, this time with the correct fs-uae:

[matth@plato ~]$ ldd /home/matth/.vscode/extensions/prb28.amiga-assembly-1.8.2/dist/bin/fs-uae/fs-uae-linux_x64 linux-vdso.so.1 (0x00007ffcecbf7000) libm.so.6 => /lib64/libm.so.6 (0x00007fe6c8751000) libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007fe6c874c000) libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007fe6c8610000) libGL.so.1 => /lib64/libGL.so.1 (0x00007fe6c8589000) libpng16.so.16 => /lib64/libpng16.so.16 (0x00007fe6c854f000) libz.so.1 => /lib64/libz.so.1 (0x00007fe6c8535000) libSDL2-2.0.so.0 => /lib64/libSDL2-2.0.so.0 (0x00007fe6c835e000) libSDL2_ttf-2.0.so.0 => /lib64/libSDL2_ttf-2.0.so.0 (0x00007fe6c834b000) libmpeg2.so.0 => /lib64/libmpeg2.so.0 (0x00007fe6c832d000) libmpeg2convert.so.0 => /lib64/libmpeg2convert.so.0 (0x00007fe6c8324000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fe6c8000000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fe6c8304000) libc.so.6 => /lib64/libc.so.6 (0x00007fe6c7c00000) /lib64/ld-linux-x86-64.so.2 (0x00007fe6c884a000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fe6c8288000) libGLX.so.0 => /lib64/libGLX.so.0 (0x00007fe6c8256000) libX11.so.6 => /lib64/libX11.so.6 (0x00007fe6c7eb8000) libXext.so.6 => /lib64/libXext.so.6 (0x00007fe6c8241000) libGLdispatch.so.0 => /lib64/libGLdispatch.so.0 (0x00007fe6c7b47000) libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007fe6c7a79000) libharfbuzz.so.0 => /lib64/libharfbuzz.so.0 (0x00007fe6c7990000) libxcb.so.1 => /lib64/libxcb.so.1 (0x00007fe6c7e8c000) libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fe6c7e79000) libbrotlidec.so.1 => /lib64/libbrotlidec.so.1 (0x00007fe6c7e6c000) libgraphite2.so.3 => /lib64/libgraphite2.so.3 (0x00007fe6c7e4a000) libXau.so.6 => /lib64/libXau.so.6 (0x00007fe6c8237000) libbrotlicommon.so.1 => /lib64/libbrotlicommon.so.1 (0x00007fe6c7e27000)

And launch configuration:

"version": "0.2.0",
"configurations": [
    {
        "type": "fs-uae",
        "request": "launch",
        "name": "FS-UAE Debug",
        "stopOnEntry": true,
        "serverName": "localhost",
        "serverPort": 6860,
        "trace": false,
        "startEmulator": true,
        "windows": {
            "emulator": "${config:amiga-assembly.binDir}/fs-uae.exe"
        },
        "osx": {
            "emulator": "${config:amiga-assembly.binDir}/fs-uae"
        },
        "linux": {
            "emulator": "${config:amiga-assembly.binDir}/fs-uae"
        },
        "emulatorWorkingDir": "${config:amiga-assembly.binDir}",
        "program": "${workspaceFolder}/uae/dh0/gencop",
        "options": [
            "--chip_memory=2048",
            "--hard_drive_0=${workspaceFolder}/uae/dh0",
            "--joystick_port_1=none",
            "--amiga_model=A1200",
            "--remote_debugger=200",
            "--use_remote_debugger=true",
            "--automatic_input_grab=0"
        ],
        "preLaunchTask": "amigaassembly: build"
    },

netstat:

matth@plato ~]$ sudo netstat -tlnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.54:53 0.0.0.0: LISTEN 1214/systemd-resolv tcp 0 0 127.0.0.53:53 0.0.0.0: LISTEN 1214/systemd-resolv tcp 0 0 127.0.0.1:631 0.0.0.0: LISTEN 1273/cupsd
tcp 0 0 0.0.0.0:5355 0.0.0.0:
LISTEN 1214/systemd-resolv tcp6 0 0 :::5355 ::: LISTEN 1214/systemd-resolv tcp6 0 0 ::1:631 ::: LISTEN 1273/cupsd

image

Anketell commented 1 year ago

This screen appears for a few minutes prior to launching gencop. Almost looks like it might be waiting for a debugger connection? But as can be seen above, no port is being listened to. I've dropped the firewall and am not running selinux.

It starts in the console.

Anketell commented 1 year ago

Upgraded to Fedora 37 and it started working.