[Lldb-commits] [lldb] [lldb] progressive progress reporting for darwin kernel/firmware (PR #98845)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 16 16:33:10 PDT 2024


================
@@ -195,20 +196,40 @@ ModuleSP DynamicLoader::LoadBinaryWithUUIDAndAddress(
   Target &target = process->GetTarget();
   Status error;
 
+  StreamString prog_str;
+  if (!name.empty()) {
+    prog_str << name.str() << " ";
+  }
+  if (uuid.IsValid())
+    prog_str << uuid.GetAsString();
+  if (value_is_offset == 0 && value != LLDB_INVALID_ADDRESS) {
+    prog_str << "at 0x";
+    prog_str.PutHex64(value);
+  }
+
   if (!uuid.IsValid() && !value_is_offset) {
+    Progress progress_memread("Reading load commands from memory",
+                              prog_str.GetString().str());
     memory_module_sp = ReadUnnamedMemoryModule(process, value, name);
 
-    if (memory_module_sp)
+    if (memory_module_sp) {
       uuid = memory_module_sp->GetUUID();
+      if (uuid.IsValid()) {
+        prog_str << " ";
+        prog_str << uuid.GetAsString();
+      }
+    }
   }
   ModuleSpec module_spec;
   module_spec.GetUUID() = uuid;
   FileSpec name_filespec(name);
-  if (FileSystem::Instance().Exists(name_filespec))
-    module_spec.GetFileSpec() = name_filespec;
 
   if (uuid.IsValid()) {
+    Progress progress("Locating external symbol file",
+                      prog_str.GetString().str());
+
     // Has lldb already seen a module with this UUID?
+    // Or have external lookup enabled in DebugSymbols on macOS.
----------------
clayborg wrote:

My only concern here is this will spam the progress notifications and also be a bit misleading. The title says "Locating external symbol file" when what this is actually doing is loading the module from a module_spec. It _might_ end up locating an external symbol file. We know reading modules from memory is slow, so fine to make a progress for this, but It would be better to actually put this in the `DownloadObjectAndSymbolFile()` with this label, or change the label to something more like "Loading module" with the detail being the `prog_str`

https://github.com/llvm/llvm-project/pull/98845


More information about the lldb-commits mailing list