diff --git a/lldb/test/API/commands/gui/expand-threads-tree/Makefile b/lldb/test/API/commands/gui/expand-threads-tree/Makefile index 0c11fbdd8669..566938ca0cc4 100644 --- a/lldb/test/API/commands/gui/expand-threads-tree/Makefile +++ b/lldb/test/API/commands/gui/expand-threads-tree/Makefile @@ -1,3 +1,3 @@ -C_SOURCES := main.c +CXX_SOURCES := main.cpp ENABLE_THREADS := YES include Makefile.rules diff --git a/lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py b/lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py index c3ec4b285ecd..9eed5b0ef6c3 100644 --- a/lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py +++ b/lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py @@ -22,7 +22,7 @@ class TestGuiExpandThreadsTree(PExpectTest): self.build() self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,500)) - self.expect("breakpoint set -r thread_start_routine", substrs=["Breakpoint 1", "address ="]) + self.expect("breakpoint set -n break_here", substrs=["Breakpoint 1", "address ="]) self.expect("run", substrs=["stop reason ="]) escape_key = chr(27).encode() @@ -33,7 +33,7 @@ class TestGuiExpandThreadsTree(PExpectTest): self.child.expect_exact("Threads") # The thread running thread_start_routine should be expanded. - self.child.expect_exact("frame #0: thread_start_routine") + self.child.expect_exact("frame #0: break_here") # Exit GUI. self.child.send(escape_key) diff --git a/lldb/test/API/commands/gui/expand-threads-tree/main.c b/lldb/test/API/commands/gui/expand-threads-tree/main.c deleted file mode 100644 index 32e6d17c799a..000000000000 --- a/lldb/test/API/commands/gui/expand-threads-tree/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -void *thread_start_routine(void *arg) { return NULL; } - -int main() { - pthread_t thread; - pthread_create(&thread, NULL, thread_start_routine, NULL); - pthread_join(thread, NULL); - return 0; -} diff --git a/lldb/test/API/commands/gui/expand-threads-tree/main.cpp b/lldb/test/API/commands/gui/expand-threads-tree/main.cpp new file mode 100644 index 000000000000..5a7cbb78563c --- /dev/null +++ b/lldb/test/API/commands/gui/expand-threads-tree/main.cpp @@ -0,0 +1,24 @@ +#include "pseudo_barrier.h" +#include + + +pseudo_barrier_t barrier_before; +pseudo_barrier_t barrier_after; + +void break_here() {} + +void thread_func() { + pseudo_barrier_wait(barrier_before); + break_here(); + pseudo_barrier_wait(barrier_after); +} + +int main() { + pseudo_barrier_init(barrier_before, 2); + pseudo_barrier_init(barrier_after, 2); + std::thread thread(thread_func); + pseudo_barrier_wait(barrier_before); + pseudo_barrier_wait(barrier_after); + thread.join(); + return 0; +}