Configure debugger with VSCode
See original GitHub issueHi,
I’m trying to configure debugger using Openocd 0.10.0
with VSCode from this reference on Windows 10. I can run Openocd
and arm-none-eabi-gdb
manually with exact configuration without any problem but on VS Code it seems that gdb debugger doesn’t run at all and only the debugger server runs.
Here is launch.json
that generated with mbed export
.
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/BUILD/ARCH_MAX/GCC_ARM/${workspaceRootFolderName}.elf",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": false,
"debugServerArgs": "-f interface/stlink-v2.cfg -f target/stm32f4x.cfg",
"serverLaunchTimeout": 20000,
"filterStderr": true,
"filterStdout": false,
"serverStarted": "GDB\\ server\\ started",
"preLaunchTask": "mbed",
"setupCommands": [
{ "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
{ "text": "-file-exec-and-symbols ${workspaceRoot}/BUILD/ARCH_MAX/GCC_ARM/${workspaceRootFolderName}.elf", "description": "load file", "ignoreFailures": false},
{ "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
{ "text": "-target-download", "description": "flash target", "ignoreFailures": false }
],
"logging": {
"moduleLoad": true,
"trace": true,
"engineLogging": true,
"programOutput": true,
"exceptions": true
},
"linux": {
"MIMode": "gdb",
"MIDebuggerPath": "/usr/bin/arm-none-eabi-gdb",
"debugServerPath": "pyocd-gdbserver"
},
"osx": {
"MIMode": "gdb",
"MIDebuggerPath": "/usr/local/bin/arm-none-eabi-gdb",
"debugServerPath": "pyocd-gdbserver"
},
"windows": {
"preLaunchTask": "mbed",
"MIMode": "gdb",
"MIDebuggerPath": "C:\\Program Files (x86)\\GNU Tools ARM Embedded\\7 2017-q4-major\\bin\\arm-none-eabi-gdb.exe",
"debugServerPath": "C:\\openocd-0.10.0\\openocd-0.10.0\\bin-x64\\openocd.exe",
"setupCommands": [
{ "text": "-environment-cd ${workspaceRoot}\\BUILD\\ARCH_MAX\\GCC_ARM" },
{ "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
{ "text": "-file-exec-and-symbols ${workspaceRootFolderName}.elf", "description": "load file", "ignoreFailures": false},
{ "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
{ "text": "-target-download", "description": "flash target", "ignoreFailures": false }
]
}
}
]
}
And tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"name": "mbed",
"isShellCommand": true,
"showOutput": "always",
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}/mbed-os"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
},
"args": ["compile", "--profile=debug", "-t", "GCC_ARM", "-m", "ARCH_MAX"],
"linux": {
"command": "mbed"
},
"osx": {
"command": "mbed"
},
"windows": {
"command": "mbed"
}
}
And here is the output log on debugger:
1: (163) LaunchOptions<LocalLaunchOptions xmlns=‘http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014’ 1: (173) LaunchOptions ExePath=‘C:\Users\Masoud\Desktop\mbed_test\mbed-os-example-blinky\BUILD\ARCH_MAX\GCC_ARM\mbed-os-example-blinky.elf’ 1: (173) LaunchOptions WorkingDirectory=‘C:\Users\Masoud\Desktop\mbed_test\mbed-os-example-blinky’ 1: (173) LaunchOptions ExeArguments=‘’ 1: (173) LaunchOptions MIMode=‘gdb’ 1: (173) LaunchOptions MIDebuggerPath=‘C:\Program Files (x86)\GNU Tools ARM Embedded\7 2017-q4-major\bin\arm-none-eabi-gdb.exe’ 1: (173) LaunchOptions WaitDynamicLibLoad=‘false’ 1: (173) LaunchOptions DebugServer=‘C:\openocd-0.10.0\openocd-0.10.0\bin-x64\openocd.exe’ 1: (173) LaunchOptions DebugServerArgs=‘-f interface/stlink-v2.cfg -f target/stm32f4x.cfg’ 1: (173) LaunchOptions ServerStarted=‘GDB\ server\ started’ 1: (173) LaunchOptions FilterStderr=‘true’ 1: (173) LaunchOptions ServerLaunchTimeout=‘20000’ 1: (173) LaunchOptions> 1: (173) LaunchOptions <SetupCommands> 1: (173) LaunchOptions <Command IgnoreFailures='false' Description=''>-environment-cd C:\Users\Masoud\Desktop\mbed_test\mbed-os-example-blinky\BUILD\ARCH_MAX\GCC_ARM</Command> 1: (173) LaunchOptions <Command IgnoreFailures='false' Description='connect to target'>-target-select remote localhost:3333</Command> 1: (173) LaunchOptions <Command IgnoreFailures='false' Description='load file'>-file-exec-and-symbols C:\Users\Masoud\Desktop\mbed_test\mbed-os-example-blinky/BUILD/ARCH_MAX/GCC_ARM/mbed-os-example-blinky.elf</Command> 1: (173) LaunchOptions <Command IgnoreFailures='false' Description=''>-interpreter-exec console “monitor endian little”</Command> 1: (173) LaunchOptions <Command IgnoreFailures='false' Description=''>-interpreter-exec console “monitor reset”</Command> 1: (173) LaunchOptions <Command IgnoreFailures='false' Description=''>-interpreter-exec console “monitor halt”</Command> 1: (173) LaunchOptions <Command IgnoreFailures='false' Description=''>-interpreter-exec console “monitor arm semihosting enable”</Command> 1: (173) LaunchOptions <Command IgnoreFailures='false' Description='flash target'>-target-download</Command> 1: (173) LaunchOptions </SetupCommands> 1: (173) LaunchOptions</LocalLaunchOptions> 1: (225) Starting: “C:\openocd-0.10.0\openocd-0.10.0\bin-x64\openocd.exe” -f interface/stlink-v2.cfg -f target/stm32f4x.cfg 1: (20237) <-logout
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
@masoudr This repo or the mbed-os repo are probably was the correct location for this particular issue.
My comment was in regard to your earlier statement
@masoudr See https://gist.github.com/janjongboom/51f2edbee8c965741465fa5feefe4cf1 - the
serverStarted
command needs to be different for OpenOCD and theserverArgs
need to have the full path I believe.