Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py @@ -1,5 +1,5 @@ """ -Test the MPX registers. +Test the Intel(R) MPX registers. """ from __future__ import print_function @@ -21,23 +21,18 @@ def setUp(self): TestBase.setUp(self) - self.has_teardown = False - - def tearDown(self): - self.dbg.GetSelectedTarget().GetProcess().Destroy() - TestBase.tearDown(self) @skipIf(compiler="clang") - @skipIf(oslist=["linux"], compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports MPX. @skipIf(oslist=no_match(['linux'])) @skipIf(archs=no_match(['i386', 'x86_64'])) + @skipIf(oslist=["linux"], compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports Intel(R) MPX. def test_mpx_registers_with_example_code(self): - """Test MPX registers with example code.""" + """Test Intel(R) MPX registers with example code.""" self.build() self.mpx_registers_with_example_code() def mpx_registers_with_example_code(self): - """Test MPX registers after running example code.""" + """Test Intel(R) MPX registers after running example code.""" self.line = line_number('main.cpp', '// Set a break point here.') exe = os.path.join(os.getcwd(), "a.out") @@ -50,7 +45,7 @@ process = target.GetProcess() if (process.GetState() == lldb.eStateExited): - self.skipTest("HW doesn't support MPX feature.") + self.skipTest("Intel(R) MPX is not supported.") else: self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, substrs = ["stop reason = breakpoint 1."]) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp @@ -14,23 +14,11 @@ int main(int argc, char const *argv[]) { - unsigned int rax, rbx, rcx, rdx; - - // Check if XSAVE is enabled. - if (!__get_cpuid(1, &rax, &rbx, &rcx, &rdx) || (rcx & bit_OSXSAVE) != bit_OSXSAVE) - return -1; - - // Check if MPX is enabled. - if (__get_cpuid_max(0, NULL) > 7) - { - __cpuid_count(7, 0, rax, rbx, rcx, rdx); - if ((rbx & bit_MPX) != bit_MPX) - return -1; - } - else + // This call returns 0 only if the CPU and the kernel support Intel(R) MPX. + if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0) return -1; -// Run MPX test code. +// Run Intel(R) MPX test code. #if defined(__x86_64__) asm("mov $16, %rax\n\t" "mov $9, %rdx\n\t"