You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu下VS Code调试无法查看std::set/std::map等STL容器内容

Ubuntu下VS Code调试无法查看std::set/std::map内容的问题

在Ubuntu系统的VS Code中使用调试器时,遇到以下问题:

  • 无法查看std::set和std::map的内容,仅能看到对应截图中的信息
  • 自定义类的std::vector内容可正常查看

已尝试的解决操作:

  • 修改launch.json配置后仅解决了std::vector的查看问题,std::set和std::map仍无法正常查看
  • 已安装最新版libstdc++6,版本信息:libstdc++6 is already the newest version (12.1.0-2ubuntu1~22.04)
  • 确认路径/usr/share/gcc/python/libstdcxx存在,包含文件:__init__.py、__pycache__、v6

当前launch.json配置如下:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "(gdb) Launch",
      "type": "cppdbg",
      "request": "launch",
      "preLaunchTask": "Build",
      "program": "pathToExecutable",
      "args": [],
      "stopAtEntry": false,
      "cwd": "/PathToProject/",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "setupCommands": [
        {
          "description": "Test",
          "text": "python import sys;sys.path.insert(0, '/usr/share/gcc/python');from libstdcxx.v6.printers import register_libstdcxx_printers;register_libstdcxx_printers(None)",
          "ignoreFailures": false
        },
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

内容的提问来源于stack exchange,提问作者MA19

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 13:34:54