2 Test the Intel(R) MPX bound violation signal.
5 from __future__ import print_function
13 from lldbsuite.test.decorators import *
14 from lldbsuite.test.lldbtest import *
15 from lldbsuite.test import lldbutil
18 class RegisterCommandsTestCase(TestBase):
20 mydir = TestBase.compute_mydir(__file__)
22 @skipIf(compiler="clang")
23 @skipIf(oslist=no_match(['linux']))
24 @skipIf(archs=no_match(['i386', 'x86_64']))
25 @skipIf(oslist=["linux"], compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports Intel(R) MPX.
26 def test_mpx_boundary_violation(self):
27 """Test Intel(R) MPX bound violation signal."""
29 self.mpx_boundary_violation()
31 def mpx_boundary_violation(self):
32 exe = os.path.join(os.getcwd(), "a.out")
33 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
35 self.runCmd("run", RUN_SUCCEEDED)
37 target = self.dbg.GetSelectedTarget()
38 process = target.GetProcess()
40 if (process.GetState() == lldb.eStateExited):
41 self.skipTest("Intel(R) MPX is not supported.")
43 if (process.GetState() == lldb.eStateStopped):
44 self.expect("thread backtrace", STOPPED_DUE_TO_SIGNAL,
45 substrs = ['stop reason = signal SIGSEGV: upper bound violation',
46 'fault address:', 'lower bound:', 'upper bound:'])
48 self.runCmd("continue")
50 if (process.GetState() == lldb.eStateStopped):
51 self.expect("thread backtrace", STOPPED_DUE_TO_SIGNAL,
52 substrs = ['stop reason = signal SIGSEGV: lower bound violation',
53 'fault address:', 'lower bound:', 'upper bound:'])
55 self.runCmd("continue")
56 self.assertTrue(process.GetState() == lldb.eStateExited,