2 Test signal reporting when debugging with linux core files.
5 from __future__ import print_function
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
16 class LinuxCoreThreadsTestCase(TestBase):
17 NO_DEBUG_INFO_TESTCASE = True
19 mydir = TestBase.compute_mydir(__file__)
20 _initial_platform = lldb.DBG.GetSelectedPlatform()
25 # Thread id for the failing thread.
29 @skipIf(oslist=['windows'])
30 @skipIf(triple='^mips')
32 """Test that lldb can read the process information from an i386 linux core file."""
33 self.do_test("linux-i386", self._i386_pid, self._i386_tid)
35 @skipIf(oslist=['windows'])
36 @skipIf(triple='^mips')
37 def test_x86_64(self):
38 """Test that lldb can read the process information from an x86_64 linux core file."""
39 self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_tid)
41 def do_test(self, filename, pid, tid):
42 target = self.dbg.CreateTarget("")
43 process = target.LoadCore(filename + ".core")
44 self.assertTrue(process, PROCESS_IS_VALID)
45 self.assertEqual(process.GetNumThreads(), 3)
46 self.assertEqual(process.GetProcessID(), pid)
48 for thread in process:
49 reason = thread.GetStopReason()
50 if( thread.GetThreadID() == tid ):
51 self.assertEqual(reason, lldb.eStopReasonSignal)
52 signal = thread.GetStopReasonDataAtIndex(1)
53 # Check we got signal 4 (SIGILL)
54 self.assertEqual(signal, 4)
56 signal = thread.GetStopReasonDataAtIndex(1)
57 # Check we got no signal on the other threads
58 self.assertEqual(signal, 0)
60 self.dbg.DeleteTarget(target)
61 lldb.DBG.SetSelectedPlatform(self._initial_platform)