Skip to content

Commit 7479b9c

Browse files
committed
[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. llvm-svn: 370848
1 parent 5d5150f commit 7479b9c

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
LEVEL = ../../../make
2+
CXX_SOURCES := main.cpp
3+
include $(LEVEL)/Makefile.rules
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from lldbsuite.test import lldbinline
2+
from lldbsuite.test import decorators
3+
4+
lldbinline.MakeInlineTest(__file__, globals(),
5+
lldbinline.expectedFailureAll(oslist=["windows", "linux"]))
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
int storage = 45;
2+
thread_local int tl_global_int = 123;
3+
thread_local int *tl_global_ptr = &storage;
4+
5+
int main(int argc, char **argv) {
6+
//% self.expect("expr tl_local_int", error=True, substrs=["couldn't get the value of variable tl_local_int"])
7+
//% self.expect("expr *tl_local_ptr", error=True, substrs=["couldn't get the value of variable tl_local_ptr"])
8+
thread_local int tl_local_int = 321;
9+
thread_local int *tl_local_ptr = nullptr;
10+
tl_local_ptr = &tl_local_int;
11+
tl_local_int++;
12+
//% self.expect("expr tl_local_int + 1", substrs=["int", "= 323"])
13+
//% self.expect("expr *tl_local_ptr + 2", substrs=["int", "= 324"])
14+
//% self.expect("expr tl_global_int", substrs=["int", "= 123"])
15+
//% self.expect("expr *tl_global_ptr", substrs=["int", "= 45"])
16+
return 0;
17+
}

0 commit comments

Comments
 (0)