[Lldb-commits] [lldb] [lldb] Don't cache symtabs for memory modules w/ corefile (PR #237050)

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 2 20:11:05 PST 2026


================
@@ -1047,10 +1052,15 @@ class Module : public std::enable_shared_from_this<Module>,
   /// \param[in] memory_module
   ///     True if this binary exists only in memory.
   ///
+  /// \param[in] disable_memory_symtab_caching
+  ///     If true, ignore the setting that enables the index cache for memory
----------------
jasonmolenda wrote:

Just to get back to this:  Yes I am calling
```
DataFileCache *cache = Module::GetIndexCache(m_objfile->IsInMemory(),
                                               m_disable_memory_symtab_caching);
```

with the idea that `Module::GetIndexCache` implements all the policy decisions about when we enable caching or not, given the context provided in the arguments (`Module::GetIndexCache` is a static method, it has nothing) and the user settings.  At the two callers in Symtab.cpp I could do

```
  if (m_objfile->IsInMemory() && m_disable_memory_symtab_caching)
    return;
```

but I _think_ it's easier to centralize all of the "should we cache things" in `Module::GetIndexCache()` and give it all the context needed to do that.

I opened an RFC where I talk about the settings structure, and how I'll be adding a new type of file in DataFileCache soon, bloom filters, and so I imagine Module::GetIndexCache() will soon look like

```
  GetIndexCache(bool memory_module, bool bloom_filter, bool disable_memory_symtab_caching = false);
```

as we need to provide this additional piece of context.  

Another approach would be to have separate named GetIndexCache methods for each different context, like

```
  Module::GetIndexCache()
  Module::GetIndexCacheMemoryModule(bool disable_memory_symtab_caching = false)
  Module::GetIndexCacheBloomFilter()
```




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


More information about the lldb-commits mailing list