[Lldb-commits] [PATCH] D97284: [lldb][AArch64] Add MTE CPU feature	test predicate
    David Spickett via Phabricator via lldb-commits 
    lldb-commits at lists.llvm.org
       
    Mon Mar  8 08:30:14 PST 2021
    
    
  
DavidSpickett updated this revision to Diff 329030.
DavidSpickett added a comment.
Rebase
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97284/new/
https://reviews.llvm.org/D97284
Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1269,7 +1269,7 @@
             return True
         return False
 
-    def isAArch64SVE(self):
+    def hasAArch64LinuxCPUFeature(self, feature):
         triple = self.dbg.GetSelectedPlatform().GetTriple()
 
         # TODO other platforms, please implement this function
@@ -1283,14 +1283,18 @@
         else:
             cpuinfo_path = "/proc/cpuinfo"
 
-        try:
-            f = open(cpuinfo_path, 'r')
-            cpuinfo = f.read()
-            f.close()
-        except:
+        with open(cpuinfo_path, 'r') as f:
+            for line in f.readlines():
+                if line.startswith("Features"):
+                    features = line.split(':')[1].split()
+                    return feature in features
             return False
 
-        return " sve " in cpuinfo
+    def isAArch64SVE(self):
+        return self.hasAArch64LinuxCPUFeature("sve")
+
+    def isAArch64MTE(self):
+        return self.hasAArch64LinuxCPUFeature("mte")
 
     def hasLinuxVmFlags(self):
         """ Check that the target machine has "VmFlags" lines in
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97284.329030.patch
Type: text/x-patch
Size: 1288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210308/0845a641/attachment.bin>
    
    
More information about the lldb-commits
mailing list