Files
clang-p2996/lldb/test/API/functionalities/thread/create_after_attach/main.cpp
Jordan Rupprecht 99451b4453 [lldb][test] Remove symlink for API tests.
Summary: Moves lldbsuite tests to lldb/test/API.

This is a largely mechanical change, moved with the following steps:

```
rm lldb/test/API/testcases
mkdir -p lldb/test/API/{test_runner/test,tools/lldb-{server,vscode}}
mv lldb/packages/Python/lldbsuite/test/test_runner/test lldb/test/API/test_runner
for d in $(find lldb/packages/Python/lldbsuite/test/* -maxdepth 0 -type d | egrep -v "make|plugins|test_runner|tools"); do mv $d lldb/test/API; done
for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-vscode -maxdepth 1 -mindepth 1 | grep -v ".py"); do mv $d lldb/test/API/tools/lldb-vscode; done
for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-server -maxdepth 1 -mindepth 1 | egrep -v "gdbremote_testcase.py|lldbgdbserverutils.py|socket_packet_pump.py"); do mv $d lldb/test/API/tools/lldb-server; done
```

lldb/packages/Python/lldbsuite/__init__.py and lldb/test/API/lit.cfg.py were also updated with the new directory structure.

Reviewers: labath, JDevlieghere

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D71151
2020-02-11 10:03:53 -08:00

62 lines
1.4 KiB
C++

#include <stdio.h>
#include <chrono>
#include <thread>
using std::chrono::microseconds;
volatile int g_thread_2_continuing = 0;
void *
thread_1_func (void *input)
{
// Waiting to be released by the debugger.
while (!g_thread_2_continuing) // Another thread will change this value
{
std::this_thread::sleep_for(microseconds(1));
}
// Return
return NULL; // Set third breakpoint here
}
void *
thread_2_func (void *input)
{
// Waiting to be released by the debugger.
int child_thread_continue = 0;
while (!child_thread_continue) // The debugger will change this value
{
std::this_thread::sleep_for(microseconds(1)); // Set second breakpoint here
}
// Release thread 1
g_thread_2_continuing = 1;
// Return
return NULL;
}
int main(int argc, char const *argv[])
{
lldb_enable_attach();
// Create a new thread
std::thread thread_1(thread_1_func, nullptr);
// Waiting to be attached by the debugger.
int main_thread_continue = 0;
while (!main_thread_continue) // The debugger will change this value
{
std::this_thread::sleep_for(microseconds(1)); // Set first breakpoint here
}
// Create another new thread
std::thread thread_2(thread_2_func, nullptr);
// Wait for the threads to finish.
thread_1.join();
thread_2.join();
printf("Exiting now\n");
}