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

VSCode悬停调试std::vector变量时出现summary string parsing error错误

解决Ubuntu 18.04下VSCode+Clang-14调试std::vector显示"summary string parsing error"的问题

以下是按优先级排序的验证解决方案:

  • 匹配Clang-14对应的LLDB版本
    Ubuntu 18.04默认LLDB版本偏低,与Clang-14不兼容会导致STL容器解析失败。先安装配套调试器:

    sudo apt update && sudo apt install lldb-14
    

    再在VSCode的.vscode/launch.json中指定调试器路径:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "clang++ - Build and debug active file",
                "type": "cppdbg",
                "request": "launch",
                "program": "${fileDirname}/${fileBasenameNoExtension}",
                "args": [],
                "stopAtEntry": false,
                "cwd": "${fileDirname}",
                "environment": [],
                "externalConsole": false,
                "MIMode": "lldb",
                "miDebuggerPath": "/usr/bin/lldb-mi-14",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ],
                "preLaunchTask": "C/C++: clang++ build active file"
            }
        ]
    }
    
  • 修正编译选项生成有效调试信息
    打开.vscode/tasks.json,确保编译命令包含-g(生成调试符号)、禁用优化(无-O系列参数),并匹配代码使用的C++标准:

    {
        "tasks": [
            {
                "type": "cppbuild",
                "label": "C/C++: clang++ build active file",
                "command": "/usr/bin/clang++",
                "args": [
                    "-g",
                    "-std=c++17",
                    "-o",
                    "${fileDirname}/${fileBasenameNoExtension}",
                    "${file}"
                ],
                "options": {
                    "cwd": "${fileDirname}"
                },
                "problemMatcher": ["$gcc"],
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "detail": "Task generated by Debugger."
            }
        ],
        "version": "2.0.0"
    }
    
  • 安装libstdc++调试符号包
    Ubuntu 18.04默认libstdc++缺少完整调试符号,导致调试器无法解析STL容器:

    sudo apt install libstdc++6-dbg
    
  • 禁用调试器自动摘要解析
    若以上方法无效,关闭VSCode调试器对STL容器的自动格式化,直接显示原始值:
    在launch.json的setupCommands中添加:

    {
        "description": "Disable std container pretty-printing",
        "text": "settings set target.max-children-count 100",
        "ignoreFailures": true
    }
    

    或直接添加配置项:

    "showDisplayString": false
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.16 21:55:30