Thank you very much Bruno, I got it working just before seeing your post!
For anyone finding this thread & looking for similar information, I managed to run the LK8000 linux executable on Windows / WSL2. I installed X410 on Windows (x-terminal client), adjusted the DISPLAY variable on WSL to point to the correct IP address and now I can launch LK8000 (linux) that opens via X410 under Windows. I also managed to run the debugger in vscode / WSL2 with a launch.json almost identical to Bruno's:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/LK8000-LINUX_debug-ns",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build"
}
]
}
In tasks.json I also made a very simple build task, called through the launch.json via "preLaunchTask": "build" :
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "make",
"args": ["DEBUG=y"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$gcc"
}
]
}
So to validate my code tweaks I will keep using WSL2 rather than going the cygwin_x86/mingw32 or using a Linux VM or booting to Linux. I’m pretty pleased with WSL2, including build speed! To top it off Microsoft announced that later this year WSL2 will natively support launching GUI applications without installing a 3rd party X-terminal.
@brunotl, do you have a more fancy make/build tasks.json on vscode?
My current issue is the debugger sometimes telling me it doesn’t find a source file coming from an external library, eg :
Error: Unable to resolve non-existing file 'vscode-remote://wsl+ubuntu-20.04/build/glibc-YYA7BZ/glibc-2.31/sysdeps/unix/sysv/linux/raise.c').
Is there a way to configure vscode to not try to step into external libraries in debug?