Skip to content

Static variables don't show #929

@gietljohannes

Description

@gietljohannes

Describe the bug
When debugging an ARM executable, the static variable section in the variable pane always stays empty, even if there are static variables in the source file.

To Reproduce
Steps to reproduce the behavior:

  1. Start debug session
  2. Break in any source file with static variables
  3. Expand the static variable
  4. See issue

Expected behavior
Static variables should show up

Screenshots
image

Environment:

  • Cortex-Debug Version v1.12
  • OS: Windows 10
  • GDB Version: 10.1.90.20201028-git
  • Compiler Toolchain Version: arm-none-eabi 10.2_2020q4

Please include launch.json

{
    "configurations": [
    {
        "cwd": "${workspaceFolder}",
        "executable": "build/demo.axf",
        "name": "Debug with JLink",
        "request": "launch",
        "type": "cortex-debug",
        "servertype": "jlink",
        "serverpath": "${workspaceFolder}/tools/SEGGER/JLink/JLinkGDBServerCL.exe",
        "armToolchainPath": "${workspaceFolder}/tools/10.2_2020q4/bin",
        "device": "EFR32BG22CxxxF512",
        "interface": "swd",
        "serialNumber": "",
        "liveWatch": {
            "enabled": false,
            "samplesPerSecond": 20
        },
        "numberOfProcessors": 1,
        "showDevDebugOutput": "raw",
        "runToEntryPoint": "main",
        "debugServer": 4711
    },
    ]
}

Attach text from Debug Console

41-var-create  static_var_'C:\Users\root\git\efr32-basicproject\src\main.c'::StaticVar_8127f1e9ff079ff59d7a58f4fc9935d0eaf0656650939d3f8e31eadd241c5c34 @ "'C:\Users\root\git\efr32-basicproject\src\main.c'::StaticVar"
-> 41^error,msg="-var-create: unable to create variable object"
Could not create global/static variable 'C:\Users\root\git\efr32-basicproject\src\main.c'::StaticVar
Error: -var-create: unable to create variable object (from var-create  static_var_'C:\Users\root\git\efr32-basicproject\src\main.c'::StaticVar_8127f1e9ff079ff59d7a58f4fc9935d0eaf0656650939d3f8e31eadd241c5c34 @ "'C:\Users\root\git\efr32-basicproject\src\main.c'::StaticVar")

Additional context
I did a bisect and the first bad commit is 2f07c52
I looked at the source code and it seems the issue is in gdb.ts staticVariablesRequest(). Here the exprName which is passed to gdb is prefixed with the filename. This causes the gdb server to throw an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions