[Lldb-commits] [lldb] r370848 - [lldb][NFC] Add a simple test for thread_local storage.

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 4 01:02:52 PDT 2019


Author: teemperor
Date: Wed Sep  4 01:02:52 2019
New Revision: 370848

URL: http://llvm.org/viewvc/llvm-project?rev=370848&view=rev
Log:
[lldb][NFC] Add a simple test for thread_local storage.

Seems we fail to read TLS data on Linux, so the test only runs on
macOS for now. We will see how this test runs on the BSD bots.

Added:
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile?rev=370848&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile Wed Sep  4 01:02:52 2019
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py?rev=370848&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py Wed Sep  4 01:02:52 2019
@@ -0,0 +1,5 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(),
+                          lldbinline.expectedFailureAll(oslist=["windows", "linux"]))

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp?rev=370848&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp Wed Sep  4 01:02:52 2019
@@ -0,0 +1,17 @@
+int storage = 45;
+thread_local int tl_global_int = 123;
+thread_local int *tl_global_ptr = &storage;
+
+int main(int argc, char **argv) {
+  //% self.expect("expr tl_local_int", error=True, substrs=["couldn't get the value of variable tl_local_int"])
+  //% self.expect("expr *tl_local_ptr", error=True, substrs=["couldn't get the value of variable tl_local_ptr"])
+  thread_local int tl_local_int = 321;
+  thread_local int *tl_local_ptr = nullptr;
+  tl_local_ptr = &tl_local_int;
+  tl_local_int++;
+  //% self.expect("expr tl_local_int + 1", substrs=["int", "= 323"])
+  //% self.expect("expr *tl_local_ptr + 2", substrs=["int", "= 324"])
+  //% self.expect("expr tl_global_int", substrs=["int", "= 123"])
+  //% self.expect("expr *tl_global_ptr", substrs=["int", "= 45"])
+  return 0;
+}




More information about the lldb-commits mailing list