Add ability to change localhost when starting gdb
See original GitHub issueIs there a way to change how to connect to the remote when starting gdb? To not always use localhost.
I can’t find any setting for this. I thought that preLaunchCommands or overrideLaunchCommands would do it but it seems the three first commands are hardcoded. I found several references to target-select extended-remote localhost
in debugadapter.js and extension.js. I tried changing these to the IP-adress I wanted and then I got it working as I wanted.
Reading symbols from 'xyz.elf'
Finished reading symbols
Please check OUTPUT tab (Adapter Output) for output from /mnt/c/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe
Launching server: "/mnt/c/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe" "-if" "swd" "-port" "50000" "-swoport" "50001" "-telnetport" "50002" "-device" "LPC1768" "-nolocalhostonly"
Launching GDB: "/gcc/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gdb" "-q" "--interpreter=mi2"
1-gdb-set target-async on
2-interpreter-exec console "source /home/user/.vscode-server/extensions/marus25.cortex-debug-0.3.12/support/gdbsupport.init"
3-target-select extended-remote localhost:50000
Some background information:
I am using WSL2 on windows 10 as my primary development environment where i use a cross-compiler in a docker container. Since I’m doing this all the paths in the elf file will be relative to the linux system. Since WSL2 doesn’t support USB forwarding i want to run the gdbserver in Windows and gdb in Linux. Therefore I want to change localhost:port since localhost in Linux won’t point to the localhost in Windows that gdbserver is listening to. VS code is run as a remote in WSL2 with VS code Server making it think that it is running in Linux. Therefore I can’t run both gdbserver and gdb in Windows since then gdb mi2 interpreter will spit out paths in the form of //$wsl/some_path
which doesn’t make sense under Linux.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:25 (3 by maintainers)
Yea @RisinT96 , I know, the thought of doing this makes me shudder. I feel bad about doing such a port-scan and MS may plug that hole anytime
I am closing this as USB ports work better with WSL2 and for JLink, there are other options like using their server software