microsoft / microsoft/vscode-cpptools
It's weird that the debugger works slow (almost not work!!!)
Open
Nobody has claimed this yet.
debugger
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Type: Debugger
Describe the bug
- OS and Version: MacOS 11.1
- VS Code Version: 1.54.3
- C/C++ Extension Version: 1.0.0
- Other extensions you installed (and if the issue persists after disabling them):
CodeLLDB 1.6.1 , Code Runner 0.11.3 - A clear and concise description of what the bug is.
When I finished the c_cpp_properties.json, tasks.json and launch.json according to the offical site "Using Clang in VS Code" with my own cpp.
The compile and output progress is right. However when I use debugger and enter the main(), when I press the "step debug" button, the speed of the debugger is really slow.
example: the debugger debug an "string my_str" use almost 3mins!!!!
code
#include <iostream>
#include <unordered_map>
#include <string>
#include <random>
#include <ctime>
#define NUM 200000
using namespace std;
string strRand(int length);
int main(){
unordered_map<string, int> my_map;
string my_str[NUM];
for(auto it: my_str)
it = strRand(10);
for(int i=0;i<10;i++)
cout << my_str[i] << endl;
// cout << strRand(10) << endl << strRand(10) << endl << strRand(10) << endl;
return 0;
}
string strRand(int length){
char tmp;
string buffer;
random_device rd;
default_random_engine random(rd());
for(int i=0;i<length;i++){
tmp = random() % 36;
if(tmp<10)
tmp+= '0';
else{
tmp -= 10;
tmp += 'a';
}
buffer += tmp;
}
return buffer;
}
launch.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": "clang++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "clang++ build active file"
}
]
}
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 slowdown with the provided C++ program and launch.json on macOS 11.1 using VS Code 1.54.3 and the C/C++ extension 1.0.0. Compare stepping into main() and the string my_str declaration, while checking the listed CodeLLDB and Code Runner extensions. Done means identifying a repeatable debugger cause and confirming improved stepping behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100