aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
new file mode 100644
index 000000000000..5a11a52e93a6
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
@@ -0,0 +1,52 @@
+"""
+Test signal reporting when debugging with linux core files.
+"""
+
+from __future__ import print_function
+
+import shutil
+import struct
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class GCoreTestCase(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ mydir = TestBase.compute_mydir(__file__)
+ _initial_platform = lldb.DBG.GetSelectedPlatform()
+
+ _i386_pid = 5586
+ _x86_64_pid = 5669
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
+ def test_i386(self):
+ """Test that lldb can read the process information from an i386 linux core file."""
+ self.do_test("linux-i386", self._i386_pid)
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
+ def test_x86_64(self):
+ """Test that lldb can read the process information from an x86_64 linux core file."""
+ self.do_test("linux-x86_64", self._x86_64_pid)
+
+ def do_test(self, filename, pid):
+ target = self.dbg.CreateTarget("")
+ process = target.LoadCore(filename + ".core")
+ self.assertTrue(process, PROCESS_IS_VALID)
+ self.assertEqual(process.GetNumThreads(), 3)
+ self.assertEqual(process.GetProcessID(), pid)
+
+ for thread in process:
+ reason = thread.GetStopReason()
+ self.assertEqual(reason, lldb.eStopReasonSignal)
+ signal = thread.GetStopReasonDataAtIndex(1)
+ # Check we got signal 19 (SIGSTOP)
+ self.assertEqual(signal, 19)
+
+ self.dbg.DeleteTarget(target)
+ lldb.DBG.SetSelectedPlatform(self._initial_platform)