Skip to content

LLDB never finishes importing Swift modules/setting up Swift reflection #8572

@z2oh

Description

@z2oh
image

These notifications in VS Code never go away during a debugging session. It's possible there's an issue on the client side, but I'm thinking the issue is in LLDB.

The Progress object which reports the reflection status is set up here: https://github.com/apple/llvm-project/blob/00c794fb25f1085c060d5c46e34cbb6145837f1f/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp#L505

This ctor takes an optional total parameter, which, as Progress::increment is called, is compared against to see when the operation is complete. When it's not set, the docs indicate that an indeterminate progress indicator should be displayed, but as far as I can tell, there's no way to report completion of this (which is normally triggered when Progress::m_completed == Progress::m_total).

It looks like the reflection progress object used to be constructed with a total, and with the following patch, I am no longer seeing the permanent "Setting up swift reflection" indicator:

diff --git a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp
index 76a65ead7ff9..d3b83c784571 100644
--- a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp
@@ -502,7 +502,7 @@ void SwiftLanguageRuntimeImpl::ProcessModulesToAdd() {

   auto &target = m_process.GetTarget();
   auto exe_module = target.GetExecutableModule();
-  Progress progress("Setting up Swift reflection");
+  Progress progress("Setting up Swift reflection", {}, modules_to_add_snapshot.GetSize());
   size_t completion = 0;

   // Add all defered modules to reflection context that were added to

The preferred total is less obvious for the "Importing Swift modules" progress events (here and here). Any ideas on what these totals should be?

cc @chelcassanova, it looks like you've been driving the improvements to the lldb reporting feature

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions