microsoft / microsoft/vscode-cpptools

macos: very long wait time until applicationDidFinishLaunching is reached in VSCode but not XCode

Offen
#13,193 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

Environment
  • OS and version: macOS 15.2
  • VS Code: 1.96.4
  • C/C++ extension: 1.22.11
  • GDB / LLDB version: system lldb is lldb-1600.0.39.109
Bug Summary and Steps to Reproduce

Bug Summary:

NOTE: This is not a new problem, but it seems to get worse with each new macOS version :/

When debugging a Cocoa application in VSCode with the C/C++ extension, it takes 10 seconds or so in each debug session until the applicationDidFinishLaunching callback is reached. Most of that time is spent between [NSApp run] and applicationDidFinishLaunching. This long wait time is the same between the first and followup debug sessions.

In Xcode, only the first debug session after starting Xcode shows a similar slow behaviour, while the following debug sessions start much faster (not quite instantly, but fast enough to not be an issue).

It would be good to at least investigate why there is this difference between VScode and XCode.

Steps to reproduce:

  1. In Xcode, create the 'Game' builtin project, build and do some debugging. Note how everything is reasonably fast, especially in the followup debug sessions.
  2. Create a launch.json in VSCode pointing to the same executable (which is a bit tricky to find: in Xcode Product => Show Build Folder in Finder to find the executable.
  3. Debug the same executable in VSCode and note how very long it takes until window appears

...in VSCode, there's a metric shitton of log output on the debug console during that waiting time, all about loading symbols from system frameworks like this:

Loaded '/System/Library/PrivateFrameworks/CoreSDB.framework/Versions/A/CoreSDB'. Symbols loaded.

...maybe this symbol loading is the main reason for the long waiting time, and this is somehow cached in XCode?

Personally I'm not interested in those symbols anyway, maybe there's an LLDB setting for this system framework symbol loading to be skipped, or delayed until they are actually needed?

Debugger Configurations
{
    "configurations": [
    {
        "name": "(lldb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "/Users/floh/Library/Developer/Xcode/DerivedData/test-game-bwcgwlktppxrepgyqrpwyczwdpqx/Build/Products/Debug/test-game.app/Contents/MacOS/test-game",
        "args": [],
        "stopAtEntry": true,
        "cwd": "${fileDirname}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "lldb"
    }
    ]
}
Debugger Logs
Debug output log is too long attach, but it's about 1000 lines of lines like this:

Loaded '/System/Library/PrivateFrameworks/LinkServices.framework/Versions/A/LinkServices'. Symbols loaded.
Other Extensions

No response

Additional Information

No response

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

Reproduziere die Verzögerung mit der bereitgestellten launch.json für die mit Xcode erstellte Cocoa-Executable auf macOS und untersuche die Debugger-Konsole während der Pause nach [NSApp run]. Vergleiche wiederholte VS Code-Sitzungen mit Xcode-Sitzungen und prüfe die zahlreichen LLDB-Meldungen zum Laden von Symbolen für System-Frameworks. Als abgeschlossen gilt die Aufgabe, wenn identifiziert wurde, warum sich das Startverhalten von VS Code von dem von Xcode unterscheidet, und eine unterstützte Möglichkeit dokumentiert oder implementiert wurde, um die unnötige Wartezeit zu vermeiden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, macos, typescript
Bereich
desktop-dev, devtools, operating-systems
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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