From f5e5074c40be29d3a0c5d4ac616df8e61e4ddc63 Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Tue, 8 Feb 2022 14:43:36 -0800 Subject: [lldb/test] Fix TestScriptedProcess.py timeout on x86_64 This patch fixes a timeout issue on the ScriptedProcess test that was happening on intel platforms. The timeout was due to a misreporting of the StopInfo in the ScriptedThread that caused the ScriptedProcess to never stop. To solve this, this patch changes the way a ScriptedThread reports its stop reason by making it more architecture specific. In order to do so, this patch also refactors the ScriptedProcess & ScriptedThread initializer methods to provide an easy access to the target architecture. Differential Revision: https://reviews.llvm.org/D118484 Signed-off-by: Med Ismail Bennani --- .../scripted_process/TestScriptedProcess.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py') diff --git a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py index 2e80f74622fb..c8ce37c24d49 100644 --- a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py +++ b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py @@ -196,6 +196,22 @@ class ScriptedProcesTestCase(TestBase): self.assertTrue(thread, "Invalid thread.") self.assertEqual(thread.GetName(), "StackCoreScriptedThread.thread-2") + self.assertTrue(target.triple, "Invalid target triple") + arch = target.triple.split('-')[0] + supported_arch = ['x86_64', 'arm64', 'arm64e'] + self.assertIn(arch, supported_arch) + # When creating a corefile of a arm process, lldb saves the exception + # that triggers the breakpoint in the LC_NOTES of the corefile, so they + # can be reloaded with the corefile on the next debug session. + if arch in 'arm64e': + self.assertTrue(thread.GetStopReason(), lldb.eStopReasonException) + # However, it's architecture specific, and corefiles made from intel + # process don't save any metadata to retrieve to stop reason. + # To mitigate this, the StackCoreScriptedProcess will report a + # eStopReasonSignal with a SIGTRAP, mimicking what debugserver does. + else: + self.assertTrue(thread.GetStopReason(), lldb.eStopReasonSignal) + self.assertEqual(thread.GetNumFrames(), 6) frame = thread.GetSelectedFrame() self.assertTrue(frame, "Invalid frame.") -- cgit v1.2.3