[Lldb-commits] [PATCH] D25328: Improve test for Intel(R) MPX registers.

Valentina Giusti via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 6 08:58:09 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL283461: Improve test for Intel(R) MPX registers. (authored by valentinagiusti).

Changed prior to commit:
  https://reviews.llvm.org/D25328?vs=73798&id=73804#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25328

Files:
  lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py
  lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp


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"
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."])


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25328.73804.patch
Type: text/x-patch
Size: 3202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161006/58eb0f7c/attachment.bin>


More information about the lldb-commits mailing list