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

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 15 14:48:38 PDT 2024


================
@@ -757,11 +758,32 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
     const ModuleList &target_images = target.GetImages();
     m_module_sp = target_images.FindModule(m_uuid);
 
+    StreamString prog_str;
+    // 'mach_kernel' is a fake name we make up to find kernels
+    // that were located by the local filesystem scan.
+    if (GetName() != "mach_kernel")
+      prog_str << GetName() << " ";
+    if (GetUUID().IsValid())
+      prog_str << GetUUID().GetAsString() << " ";
+    if (GetLoadAddress() != LLDB_INVALID_ADDRESS) {
+      prog_str << "at 0x";
+      prog_str.PutHex64(GetLoadAddress());
+    }
+    std::unique_ptr<Progress> progress_wp;
+    if (IsKernel())
+      progress_wp = std::make_unique<Progress>("Loading kernel",
+                                               prog_str.GetString().str());
+    else
+      progress_wp = std::make_unique<Progress>("Loading kext",
+                                               prog_str.GetString().str());
+
     // Search for the kext on the local filesystem via the UUID
     if (!m_module_sp && m_uuid.IsValid()) {
       ModuleSpec module_spec;
       module_spec.GetUUID() = m_uuid;
-      module_spec.GetArchitecture() = target.GetArchitecture();
+      if (!m_uuid.IsValid())
+        module_spec.GetArchitecture() = target.GetArchitecture();
----------------
jasonmolenda wrote:

I know I shouldn't be making changes like this at the same time as adding progress status logging, but it irked me when I saw it.

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


More information about the lldb-commits mailing list