I am debugging a VectorCAST environment on Windows (host x64, MinGW GDB 9.2) using VS Code with cppdbg.
When I try to watch a global variable (e.g., vcSlotIteration) through the VS Code Debug Console, I always get:
-var-create: unable to create variable object
Even though:
The program is compiled with debug symbols (-g),
The variable is global and visible (I can watch it easily in the GUI or when I run gdb.exe UUT_INTE.EXE manually and use watch vcSlotIteration),
Breakpoints work fine and I can halt execution at startup.
It looks like VS Code’s MI interface (-var-create) cannot resolve the symbol, even though plain GDB can.
Has anyone seen this behavior before with VectorCAST builds and VS Code? Is there a known workaround to watch global variables through MI (e.g., special syntax, configuration, or .gdbinit tricks), or is the only solution to inject watch commands directly into .gdbinit?
What I already tried (unsuccessful):
Using .gdbinit with commands like display vcSlotIteration or watch vcSlotIteration.
Debugger starts, but VS Code still shows the -var-create error.
Running -var-create manually from the Debug Console.
Always fails, even after execution is halted at main.
Prefixing the variable with different scopes:
::vcSlotIteration
'Driver_vcast.c'::vcSlotIteration
Quoted forms "vcSlotIteration" None resolved the issue.
Verified that symbols are loaded (info files / info variables vc*) inside GDB — variable is visible.
Ensured debug info is available in .exe (not stripped).
Tried delaying the watch until after hitting a breakpoint — still the same error.
So far it seems that GDB MI interface in VS Code cannot resolve this global variable, while plain GDB can.