Open Yatekii opened 5 years ago
@Yatekii The code is at https://github.com/microsoft/miengine as that is where everything is passed to and processed.
When a debugServer is specified, we will be using that debug server exclusively and no other debugger. Can you expand why you are using both?
CC: @Robotdad @paulmaybee
No, it will still use GDB and not just the server, but it will use the wrong GDB (At least I see the GDB CLI in VSCode ...). I need to pass various params into GDB and I need the ARM GDB. Specificially I need to download a file onto my remote target (embedded MCU). This behavior makes no sense if you still use some GDB on top of the server ;)
I too am currently experiencing issues with this. I want to debug a compiled firmware using simavr and avr-gdb. I have tried to do this with the following launch.json (running on Linux):
{
"version": "0.2.0",
"configurations": [
{
"name": "gdb (launch simavr)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/SPOS.elf",
"cwd": "${workspaceRoot}",
"externalConsole": false,
"stopAtEntry": true,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/avr-gdb",
"miDebuggerServerAddress": "localhost:1234",
"debugServerPath": "/usr/bin/simavr",
"debugServerArgs": "-v -v -v -g -m atmega644 -f 20000000 ${workspaceRoot}/SPOS.elf",
"serverStarted": "avr_gdb_init listening on port 1234",
"serverLaunchTimeout": 2000,
"preLaunchTask": "make clean then make all"
},
{
"name": "gdb (attach to simavr)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/SPOS.elf",
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/avr-gdb",
"miDebuggerServerAddress": "localhost:1234",
"externalConsole": true,
"cwd": "${workspaceRoot}"
}
]
}
The gdb (attach to simavr)
works with a manually started instance of simavr (using exactly the same parameters). gdb (launch simavr)
however does not. It fails with the message Unable to start debugging. Debug server process failed to initialize.
. To me it is not obvious why this isn't working. (Note: The launch timeout is not at fault. I have tried this with much higher timeouts and simavr is, in my experience, up and running after barely a second has passed.)
Please do correct me if I am making some wrong assumptions here, but the UI and the online docs show no hints as to what is happening (e.g. the usual "you can't use property Y with property X present"), there are no helpful logs (that I could find with a reasonable amount of googling), no easy way to troubleshoot, just an unexpected error. I would consider this a design bug, if this is indeed by design.
The classical Microsoft way of handling such things is "wontfix" and "works for me". I wouldn't expect them to change this behavior after another year went by.
We wrote our own vscode plugin in the meantime that handles things correctly, at least for Rust.
@WardenGnaw for visibility.
I have similar (or same) situation with exception that it all worked with C/C++ Extension Version v1.0.1 and stop working in v1.1.0-insiders3.
With launch.json
below, this is (valid) behavior that I observe with v1.0.1 (in windows):
debugServerPath
) and I can see jlink server instance running in windowsWith v1.1.0-insiders3:
debugServerPath
)
If I add "miDebuggerServerAddress": "localhost:2331"
then debugServerPath
is executed but then miDebuggerPath
is not used.It seams like behavior change is introduced in MIEngine with https://github.com/microsoft/MIEngine/pull/1056 (It's just a guess based on not to deep digging).
{
"version": "0.2.0",
"configurations": [
{
"name": "[MCU/GDB] Debug/JLink",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/build/${workspaceFolderBasename}.elf",
"windows": {
"miDebuggerPath": "C://toolchain//gnu//arm-none-eabi-gdb.exe",
"debugServerPath": "${workspaceRoot}/jlinkgdbserverstart.bat",
"externalConsole": true
},
"linux": {
"miDebuggerPath": "/usr/local/gcc-arm-none-eabi/bin/arm-none-eabi-gdb",
"debugServerPath": "${workspaceRoot}/jlinkgdbserverstart.sh",
"externalConsole": false
},
"stopAtEntry": true,
"cwd": "${workspaceRoot}",
"environment": [],
"MIMode": "gdb",
"miDebuggerArgs": "--cd=${workspaceRoot}",
"setupCommands": [
... my specific gdb commands to load firmware to arm target etc...
],
"preLaunchTask": "[Misc][Debug] Create JLink GDB server script"
}
]
}
jlinkgdbserverstart.bat -> this is generated with preLaunchTask [Misc][Debug] Create JLink GDB server script. Example of content is:
JLinkGDBServerCL -singlerun -select USB=440150122 -device EFM32GG380F512 -endian little -if SWD -speed 4000 -i
@Luka234 Your issue seems to be specific to 1.1.0-insiders3. I have moved it to its own issue: https://github.com/microsoft/vscode-cpptools/issues/6411
This issue has been closed automatically because it's labeled as 'by design'.
Great job.
@WardenGnaw This isn't "by design", right?
Describe the bug
When you specify a
debugServerPath
and adebugServerArgs
,miDebuggerPath
andmiDebuggerArgs
are completely ignored. Furthermore you HAVE to specify amiDebuggerServerAddress
even tho that is not necessarily required as you can specify this viamiDebuggerArgs
To Reproduce Please include a code sample and
launch.json
configuration. See thelaunch.json
below:Steps to reproduce the behavior:
launch.json
above.Additional context I tried finding the source code that uses the
miDebuggerPath
etc, but I can't even locate the variable in this repo. So I can't even see how this extension ever uses that value. If I could, I would fix it myself, but the entire extension is really intransparent, including all the config explanations (especially theproblemMatcher
).