[Lldb-commits] [lldb] [lldb] Enable locate module callback for main executable (PR #160199)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 1 16:03:43 PDT 2025


================
@@ -126,6 +127,18 @@ class ModuleSpec {
 
   lldb::DataBufferSP GetData() const { return m_data; }
 
+  Target *GetTargetPtr() {
+    auto locked = m_target.lock();
+    return locked.get();
+  }
----------------
JDevlieghere wrote:

This is inherently unsafe: once you return the pointer nothing ensures the refcount doesn't drop to zero and you're holding on to an invalid reference. If you need this, you must return a TargetSP to ensure the target remains alive until the shared pointer goes out of scope.

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


More information about the lldb-commits mailing list