microsoft / microsoft/vscode-cpptools

It's weird that the debugger works slow (almost not work!!!)

Offen
#7,214 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

debugger
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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"
      }
    ]
  }

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduzieren Sie zunächst die Verlangsamung mit dem bereitgestellten C++-Programm und launch.json unter macOS 11.1 mit VS Code 1.54.3 und der C/C++-Erweiterung 1.0.0. Vergleichen Sie das Hineinschrittweise in main() und in die Deklaration von my_str, während Sie die aufgeführten Erweiterungen CodeLLDB und Code Runner überprüfen. Als abgeschlossen gilt die Aufgabe, wenn eine reproduzierbare Ursache im Debugger identifiziert und ein verbessertes Hineinschrittverhalten bestätigt wurde.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.