microsoft / microsoft/vscode-cpptools
VScode debugging with GDB doesn't show vector or map contents from header files
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Describe the bug
- OS and Version: Windows 10
- VS Code Version: 1.57.1
- C/C++ Extension Version: 1.5.0 insiders3
When debugging with gbd(mingw64 latest version of Sourceforge) and trying to access variables from header files(.hpp), it says:
can not access memory
To Reproduce
Please include a code sample and launch.json configuration.
Steps to reproduce the behavior:
Use a C++ file with a .hpp file
add a vector or map as part of the header file
debug with gdb(with pretty printing enabled)
try taking a look the vector contents
lanuch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}\\bin\\EnderKnightShell.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build"
}
]
}
Additional context
part of the log(I can't copy the full thing)
1: (5403) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) 1066: elapsed time 14\r\n"},"seq":1396}
1: (5403) 1066: elapsed time 14
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) ->&\"\\n\"\r\n"},"seq":1398}
1: (5403) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) ->^done\r\n"},"seq":1400}
1: (5403) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) ->(gdb)\r\n"},"seq":1402}
1: (5403) ->(gdb)
--> R (variables-20): {"type":"response","request_seq":20,"success":true,"command":"variables","body":{"variables":[{"name":"eklexer","value":"{...}","type":"lex::Lexer","evaluateName":"eklexer","variablesReference":1003},{"name":"var","value":"0","type":"int","evaluateName":"var","variablesReference":0,"memoryReference":"0x0000000000000000"},{"name":"DebugTokens","value":"{...}","type":"std::vector<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > >","evaluateName":"DebugTokens","variablesReference":1004},{"name":"argc","value":"1","type":"int","evaluateName":"argc","variablesReference":0,"memoryReference":"0x0000000000000001"},{"name":"argv","value":"0x11b1870","type":"char **","evaluateName":"argv","variablesReference":1005,"memoryReference":"0x00000000011b1870"}]},"seq":1404}```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue on Windows 10 with the provided launch.json, MinGW-w64 GDB, and a C++ source file that uses vector or map values from a .hpp file. Compare debugger behavior for the DebugTokens variable and consider the issue resolved when its container contents are displayed correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100