JamieDStewart / GBA_VSCode_Basic

A 'simple' Game Boy Advance development setup using Visual Studio Code
GNU General Public License v3.0
100 stars 32 forks source link

Linux setup? #9

Open herrozerro opened 3 years ago

herrozerro commented 3 years ago

Would this work under linux? I have the build part working, but getting the launch and debugger working seems to be giving me problems.

Lrs121 commented 3 years ago

I haven't experimented with this yet but a quick look shows that some changes to the .vscode/launch.json and .vscode/tasks.json files.

There are 2 front ends for mgba in linux, the qt version and the sdl version. Each has a different name in for commands. The qt version is called mgba-qt and the sdl version is just mgba

I use mgba-qt because that is what is installed on my computer but it can be switched to mgba without problems.

for launch.json you can just rename "osx" to "linux" or copy and past the osx block and rename it to linux

"linux": {
     "miDebuggerPath": "/opt/devkitPro/devkitARM/bin/arm-none-eabi-gdb",
     "setupCommands": [
          {
          "description": "Enable pretty-printing for gdb",
          "ignoreFailures": true,
           "text": "file ${workspaceFolder}/${workspaceFolderBasename}.elf -enable-pretty-printing"
           }]
},

For the tasks.json needs changes to two parts. The "stop emulation" task and the "gdb-debug" task both need a linux section added to them.

"label": "stop emulation",
"type":"shell",
"windows": {
...
},
"osx": { 
...
},
"linux":{
    "command": "pkill -15 mgba-qt"
}

The gdb-debug needs a linux section and the location of the mgba-qt. For my computer the following would work. You'll need to find the path for mgba on your computer unless it is the same.

"label": "gdb-debug",
"type": "shell",
"dependsOn": ["make debug"],
"isBackground": false,
"windows": {
...
},
"osx":{
...
},
"linux":{
    "command": "/usr/bin/mgba-qt",
    "args": ["-g", "${workspaceFolder}/${workspaceFolderBasename}.gba"]
},
herrozerro commented 3 years ago

@Lrs121 Thanks! The build works, it brings up mGBA, but the debugging doesn't ever start. The debug tab just seems to spin, it loads breakpoints. If I turn off the mGBA server it'll play and then the debugger times out.

I saw in the instructions that 6.2 mGBA might be needed. But I was having issues installing it.

herrozerro commented 3 years ago

I'm getting the following error in the output when debugging:

Error: the description can't be converted into a problem matcher: { "background": { "activeOnStart": true, "beginsPattern": "^.*debuggerReady.*$", "endsPattern": "^.*debuggerReady.*$" } }

Lrs121 commented 3 years ago

It seems VS Code is trying to use part of a command in the tasks.json file. I don't know what your tasks file looks like but you might try removing this from the file or checking to see if there is a syntax error which is causing that section to be called or improperly setup.

            "osx":{
                  ...
            },
            "presentation": {
                 ...
            },
            "command": "debuggerReady",
            "problemMatcher": {
                "background": {
                    "activeOnStart": true,
                    "beginsPattern": "^.*debuggerReady.*$",
                    "endsPattern": "^.*debuggerReady.*$"
                },

I also do not know if that section is required or not for linux as it seems to only be directly called by the windows debug task.

herrozerro commented 3 years ago

here is what my current code looks like https://github.com/herrozerro/GBA_VSCode_Basic

JoshThibado commented 1 year ago

Not sure if you still need this but here is a working linux debug setup: https://github.com/amotez-retro/Advanced_Linux_Setup There are probably a bunch of settings that aren't needed but this should hopefully work.

herrozerro commented 1 year ago

thanks!