Open RolfNoot opened 5 years ago
I would love that too!
Does the cortex-debug extension generate a launch.json
for debugging? If it does, then there is the potential to take a dependency on a build task. However, it looks like we would still need to create a task provider to expose the build command since tasks.json
doesn't let you run extension commands directly today.
I don’t know how the extensions exactly works, but it doesn’t generate a launch.json. It lauches and interfaces with the OpenOCD debugger, uses launch.json to insert ‘additional’ GDB commands to program the device before debug starts
fwiw I specified following launch.json entry:
{
"name": "CMake launch WB35",
"type": "cortex-debug",
"request": "launch",
"servertype": "openocd",
"cwd": "${workspaceRoot}",
// "runToEntryPoint": "main",
"executable": "${command:cmake.launchTargetPath}",
"gdbPath": "C:/prg/kompilatory/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb.exe",
"device": "STM32WB35CE",
"svdFile": "c:/prg/kompilatory/stm_svd/STM32WB_svd_V1.1/STM32WB35_CM4.svd",
"configFiles": [
"interface/stlink.cfg",
"target/stm32wbx.cfg"
],
"searchDir": [
"c:/prg/kompilatory/OpenOCD-20230202-0.12.0/share/openocd/scripts"
]
},
and that always builds the currently selected cmake target before launching the debugger, exactly as requested. The "executable": "${command:cmake.launchTargetPath}",
line is the key.
What I'd really like though is to be able to influence this launch configuration's parameters, so that device
and configFiles
could be adjusted depending on cmake vars - I have a project which builds for different devices and currently I have to have multiple copies of launch entries, which only differ in those parameters. Something like ability to expand ${command:cmake.var.CMAKE_VAR_NAME}
would be great.
It would be great if this extention could we integrated with another.
Currently I have to take the following steps if I want to change code after debugging: 1) Switch to cmake-tools extension 2) Press build 3) Switch to cortex-debug extension 4) Press debug
By forgetting step 3, the project debugs without being built. This is unwanted.
I know it's possible to integrate the debugger actions into CMake but this is not what I am looking for, as I need the register view, stack trace, disassembly etc.
I made a mockup to clearify things:![vscbuilddebug](https://user-images.githubusercontent.com/44534542/50708823-f6363600-1065-11e9-89c7-6caa417f6069.png)
Thanks! Rolf