blob: f18ee807351f39b54e6dea0a41d692d296d19712 [file]
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class SharedCacheHostMemoryTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@requireDarwin
@skipIfRemote
def test_host_lldb_memory(self):
"""Stop in a shared cache binary loaded from lldb's own memory and
backtrace through it."""
self.build()
self.runCmd("settings set symbols.shared-cache-binary-loading host-lldb-memory")
self.addTearDownHook(
lambda: self.runCmd("settings clear symbols.shared-cache-binary-loading")
)
# Breaking on puts forces lldb to load and symbolicate the shared cache
# binary it lives in. The breakpoint resolves once that library is
# loaded as the process launches.
_, _, thread, breakpoint = lldbutil.run_to_name_breakpoint(
self, "puts", has_locations_before_run=False
)
self.assertGreater(
breakpoint.GetNumLocations(),
0,
"puts breakpoint should resolve in the shared cache binary",
)
# We should be able to walk the stack out of the shared cache binary
# and back to main without crashing.
self.assertEqual(thread.GetFrameAtIndex(0).GetFunctionName(), "puts")
self.assertGreater(thread.GetNumFrames(), 1)
frame_names = [
thread.GetFrameAtIndex(i).GetFunctionName()
for i in range(thread.GetNumFrames())
]
self.assertIn("main", frame_names)