[Lldb-commits] [lldb] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 29 08:53:48 PDT 2025


================
@@ -121,6 +121,15 @@ size_t Module::GetNumberAllocatedModules() {
   return GetModuleCollection().size();
 }
 
+Module *Module::GetAllocatedModuleWithUID(lldb::user_id_t uid) {
+  std::lock_guard<std::recursive_mutex> guard(
+      GetAllocationModuleCollectionMutex());
+  for (Module *mod : GetModuleCollection())
+    if (mod->GetID() == uid)
+      return mod;
+  return nullptr;
+}
+
----------------
labath wrote:

Ah, yes, that's tricky. We have something sort of similar in (e.g.) `SymbolFileDWARF::GetDIEToType()` which returns the DWARFDebugMap die-to-type map when dealing with a MachO .o files. It's not completely ideal, but I think it wouldn't be *too* bad if we had a SymbolFileDWARF function to return the ID of the "main" module.

Alternatively, since main symbol file which creates the type system (and the type system creates the DWARFASTParser), we may be able to plumb the module ID to the DWARFASTParser constructor.

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


More information about the lldb-commits mailing list