[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)
via lldb-commits
lldb-commits at lists.llvm.org
Mon May 13 21:55:27 PDT 2024
================
@@ -36,17 +35,37 @@ def verify_core_file(
self.assertEqual(module_file_name, expected_file_name)
self.assertEqual(module.GetUUIDString(), expected.GetUUIDString())
+ red_zone = process.GetTarget().GetStackRedZoneSize()
for thread_idx in range(process.GetNumThreads()):
thread = process.GetThreadAtIndex(thread_idx)
self.assertTrue(thread.IsValid())
thread_id = thread.GetThreadID()
self.assertIn(thread_id, expected_threads)
+ frame = thread.GetFrameAtIndex(0)
+ sp_region = lldb.SBMemoryRegionInfo()
+ sp = frame.GetSP()
+ err = process.GetMemoryRegionInfo(sp, sp_region)
+ self.assertTrue(err.Success(), err.GetCString())
+ error = lldb.SBError()
+ # Try to read at the end of the stack red zone and succeed
+ process.ReadMemory(sp_region.GetRegionEnd() - 1, 1, error)
+ self.assertTrue(error.Success(), error.GetCString())
+ # Try to read just past the red zone and fail
+ process.ReadMemory(sp_region.GetRegionEnd() + 1, 1, error)
+ # Try to read from the base of the stack
+ self.assertTrue(error.Fail(), error.GetCString())
+ self.assertTrue(stacks_to_sps_map.__contains__(thread_id), "stacks_to_sps_map does not contain thread_idx: %d" % thread_idx)
----------------
jeffreytan81 wrote:
Use `self.assertIn()`
https://github.com/llvm/llvm-project/pull/92002
More information about the lldb-commits
mailing list