[Lldb-commits] [lldb] [lldb][Mach-O] Don't read symbol table of specially marked binary (PR #129967)

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 6 11:39:48 PST 2025


================
@@ -0,0 +1,81 @@
+"""
+Test that we read don't read the nlist symbols for a specially marked dylib
+when read from memory.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+from time import sleep
+
+
+class NoNlistsTestCase(TestBase):
+    NO_DEBUG_INFO_TESTCASE = True
+
+    @skipIfRemote
+    @skipUnlessDarwin
+    def test_no_nlist_symbols(self):
+        self.build()
+
+        exe = os.path.realpath(self.getBuildArtifact("a.out"))
+
+        popen = self.spawnSubprocess(exe)
+        pid = popen.pid
+
+        self.dbg.SetAsync(False)
+
+        m_no_nlist = lldb.SBModule()
+        m_has_nlist = lldb.SBModule()
+        target = lldb.SBTarget()
+        process = lldb.SBProcess()
+        reattach_count = 0
+
+        # Attach to the process, see if we have a memory module
+        # for libno-nlists.dylib and libhas-nlists.dylib.
+        # If not, detach, delete the Target, and flush the orphaned
+        # modules from the Debugger so we don't hold on to a reference
+        # of the on-disk binary.
+
+        # If we haven't succeeded after ten attemps of attaching and
----------------
jasonmolenda wrote:

Good point.

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


More information about the lldb-commits mailing list