Problem Statement:
The debugger is not able to provide the content of an STL container (i.e. vector or string).
Overview:
Below is my launch.json
, where I have added -enable-pretty-printing
as per this thread but I'm unable to see the content of the STL Container.
{
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true,
}
],
"preLaunchTask": "C/C++: g++.exe build active file"
}
]
}
I tried even adding expression in the watch window. But that also didn't work for me. Or maybe I am missing something. this thread
Firstly, you probably used x64 Windows.
I found one valid solution, when installing MinGW in x64 Windows, install
i686 (win32)
version (the bottom of this comment gives its official download link) of MinGW instead ofx86_64
version, see below:win32 version of MinGW download:
i686-win32-dwarf
I just extracted the downloaded file into the folder
D:\MinGW
, then add the bin path of MinGWD:\MinGW\i686-8.1.0-release-posix-dwarf-rt_v6-rev0\mingw32\bin
to thePATH
of System Variable of environment.The related config files are below:
.vscode\tasks.json
.vscode\launch.json
.vscode\c_cpp_properties.json
Environment of my PC
Initially posted on https://github.com/microsoft/vscode-cpptools/issues/3921#issuecomment-780379258.
May it be helpful for you.