-
Notifications
You must be signed in to change notification settings - Fork 258
Description
Describe the bug
When any frame filter is installed and enabled, even a do-nothing frame filter, all stack frames in the call stack have "Unknown Source". This is due to an upstream GDB bug, that python-generated frame records are missing the fullname= field.
To Reproduce
Steps to reproduce the behavior:
- Make a simple do-nothing frame filter called my_filter.py in your workspace dir.
class MyFrameFilter: def __init__(self) -> None: self.name = 'MyFrameFilter' self.priority = 100 self.enabled = True def filter( self, iterator: Iterator[FrameDecorator | DAPFrameDecorator] ) -> Iterator[FrameDecorator | DAPFrameDecorator]: return iterator ff = MyFrameFilter() frame_filters[ff.name] = ff
- In your launch.json configuration, add
"--command=${workspaceFolder}/my_filter.py"
todebuggerArgs
. - In your launch.json configuration, add
"-enable-frame-filters"
topreLaunchCommands
. - Start a debugging session
- Observe that all frames in the call stack pane have "Unknown Source".
Expected behavior
Frames with associated source code show the file and line of that source code.

Actual behavior
Frames all have "Unknown Source"

Environment (please complete the following information):
- Cortex-Debug Version (this extension): v1.13.0-pre6
- OS: Linux Manjaro 25.0.8
- GDB Version: arn-none-eabi V 16.2
- Compiler Toolchain Version: arm-none-eabi-gcc 14.2.0 (Arch Repository)
Please include launch.json
Note: We are unlikely to look at the issue if you do not supply this
Attach text from Debug Console
Please enable debug output in your launch.json ("showDevDebugOutput": "raw"
). It this is too large, please attach it as a file
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Native Tests",
"type": "cppdbg",
"request": "launch",
"program": "${cmake.testProgram}",
"args": [ "${cmake.testArgs}" ],
"cwd": "${cmake.testWorkingDirectory}",
"stopAtEntry": false,
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"presentation": { "hidden": true },
},
{
"name": "Debug with J-Link",
"cwd": "${workspaceFolder}",
"executable": "${input:ensureARMToolchain}${command:cmake.launchTargetPath}",
"request": "launch",
"type": "cortex-debug",
"runToEntryPoint": "main",
"showDevDebugOutput": "raw",
"servertype": "jlink",
"interface": "jtag",
"device": "${input:DEVICE}",
"serverArgs": ["-speed", "${input:JTAG_SPEED}"],
"serverpath": "${input:ensureARMToolchain}${input:JLINK_GDB_SERVER}",
"rtos": "${command:cmake.buildDirectory}/RTOSPlugin_OpenRTOS_GCC_ARM_CRx_MPU_FPU",
"windows": {
"gdbPath": "gdb-multiarch.exe",
"objdumpPath": "objdump",
},
"debuggerArgs": [
"--init-eval-command=set python print-stack full",
"--init-eval-command=add-auto-load-safe-path ${workspaceFolder}",
"--command=tools/quit-on-_exit.gdb",
],
"debugServer": 4711,
"liveWatch": {
"enabled": true,
"samplesPerSecond": 4
},
"svdFile": "${input:SVD_FILE}",
"rttConfig": {
"enabled": true,
"address": "auto",
"decoders": [
{
"port": 0,
"type": "console"
}
]
},
"preLaunchCommands": [
"-enable-frame-filters"
],
},
],
"inputs": [
{
// Evaluates to an empty string, but first, gives the user a chance
// to correct a misconfiguration if necessary.
"id": "ensureARMToolchain",
"type": "command",
"command": "cmake-extras.ensureToolchainTarget",
"args": ["arm-none-eabi", "selectLaunchTarget"]
},
{
"id": "JLINK_GDB_SERVER",
"type": "command",
"command": "cmake.cacheVariable",
"args": {
"name": "JLINK_GDB_SERVER",
"default": "JLinkGDBServerCL.exe"
}
},
{
"id": "DEVICE",
"type": "command",
"command": "cmake.cacheVariable",
"args": {
"name": "DEVICE",
"default": "swd"
}
},
{
"id": "SVD_FILE",
"type": "command",
"command": "cmake.cacheVariable",
"args": {
"name": "SVD_FILE",
"default": ""
}
},
{
"id": "JTAG_SPEED",
"type": "command",
"command": "cmake.cacheVariable",
"args": {
"name": "JTAG_SPEED",
"default": "4000"
}
},
]
}
Additional context
This is ultimately an upstream bug which I've reported to GDB, but there's an easy work-around that's working for me. I'll put up a PR with it in case you're interested.
diff --git a/src/backend/mi2/mi2.ts b/src/backend/mi2/mi2.ts
index 0349e92..749719a 100644
--- a/src/backend/mi2/mi2.ts
+++ b/src/backend/mi2/mi2.ts
@@ -833,7 +833,7 @@ export class MI2 extends EventEmitter implements IBackend {
ret.push({
address: addr,
fileName: filename,
- file: file,
+ file: file || filename,
function: func || from,
level: level,
line: line