================
@@ -0,0 +1,45 @@
+"""
+Test lldb's ability to read the Arm TLS register.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+@skipUnlessArch("arm")
+@skipUnlessPlatform(["linux"])
+class ArmLinuxTLSRegister(TestBase):
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def test_tls_reg_read(self):
+        self.build()
+        (_, _, thread, _) = lldbutil.run_to_source_breakpoint(
+            self, "// Set breakpoint here.", lldb.SBFileSpec("main.c")
+        )
+        frame = thread.GetFrameAtIndex(0)
+
+        tpidruro_var = frame.FindVariable("tpidruro")
+        self.assertTrue(tpidruro_var.IsValid())
+
+        regs = frame.GetRegisters()
+        tls_regs = regs.GetFirstValueByName("Thread Local Storage Registers")
+        self.assertTrue(tls_regs.IsValid(), "No TLS registers found.")
+        tpidruro_reg = tls_regs.GetChildMemberWithName("tpidruro")
+        self.assertTrue(tpidruro_reg.IsValid(), "tpidruro register not found.")
+
+        val = tpidruro_var.GetValueAsUnsigned()
+        self.assertEqual(tpidruro_reg.GetValueAsUnsigned(), val)
+        self.expect("reg read tp", substrs=[hex(val)])
+
+    def test_tls_reg_write(self):
+        self.build()
+        lldbutil.run_to_source_breakpoint(
+            self, "// Set breakpoint here.", lldb.SBFileSpec("main.c")
+        )
+        self.expect(
----------------
DavidSpickett wrote:

I think its fine to put this on the end of the first test. You can just call 
the combined test test_tls_reg_access. Saves us spinning up another process, 
and even if it does fail part way, it's not hard to unpick what went wrong here.

https://github.com/llvm/llvm-project/pull/182438
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to