Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / api / multiple-targets / main.cpp
blob35fb4e0d613ed6ea5f530604c04a055ea1afc20f
1 #include <thread>
3 #include "lldb/API/LLDB.h"
4 #include "lldb/API/SBDebugger.h"
5 #include "lldb/API/SBTarget.h"
7 using namespace lldb;
8 int main (int argc, char **argv)
10 // We are expecting the program path and a path to an executable to load
11 if (argc != 2)
12 return 1;
13 const char *program_file = argv[1];
14 SBDebugger::Initialize();
15 SBDebugger debugger = SBDebugger::Create(false);
16 auto lambda = [&](){
17 SBError error;
18 SBTarget target = debugger.CreateTarget(program_file, nullptr, nullptr,
19 false, error);
22 // Create 3 targets at the same time and make sure we don't crash.
23 std::thread thread1(lambda);
24 std::thread thread2(lambda);
25 std::thread thread3(lambda);
26 thread1.join();
27 thread2.join();
28 thread3.join();
29 SBDebugger::Terminate();
30 return 0;