VSCode GDB调试控制台报错"-var-create: unable to create variable object" 背景 在使用 Visual Studio Code (1.97.2) 进行 GDB 调试时,想使用 x 命令看一下某地址处的数值。出现如下报错: -var-create: unable to create variable object 1 -var-create: unable to create variable object 解决方案 其实,在刚刚开始调试程序时,就以黄色字体给出了解决方案。 Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger) 1 Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger) 也就是说: 如果是想查看某个变量的值,直接在输入框里输入变量名就好了; 如果要执行GDB命令,则需要加-exec前缀,如下图: 参考链接 VSCode GDB调试控制台只能查看变量不能执行调试命令的解决方案-var-create: unable to create variable object Linux / Ubuntu上使用vscode编译运行和调试C/C++ 发布者 默默 码农 查看默默的所有文章