================
@@ -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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to