[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:47:11 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:

If I have a UUID, it's authoritative, whereas the ArchSpec might be heuristically determined.  I don't like setting both in a ModuleSpec if the UUID is valid, it it noramlly fine but it's a little footgun waiting for some unusual combination where the heuristically determined ArchSpec is not quite the same ("compatible") with the arch of the UUID specified.

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


More information about the lldb-commits mailing list