]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/api/multithreaded/driver.cpp.template
Vendor import of lldb release_39 branch r287912:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / api / multithreaded / driver.cpp.template
1
2 /// LLDB C API Test Driver
3
4 #include <algorithm>
5 #include <iostream>
6 #include <iterator>
7 #include <string>
8 #include <vector>
9 #if !defined(_MSC_VER)
10   #include <signal.h>
11 #endif
12
13 %include_SB_APIs%
14
15 #include "common.h"
16
17 using namespace std;
18 using namespace lldb;
19
20 void test(SBDebugger &dbg, std::vector<string> args);
21
22 int main(int argc, char** argv) {
23
24 // Ignore SIGPIPE.  The lldb driver does this as well,
25 // because we seem to get spurious SIGPIPES on some
26 // Unixen that take the driver down.
27 #if !defined(_MSC_VER)
28   signal(SIGPIPE, SIG_IGN);
29 #endif
30   int code = 0;
31
32   SBDebugger::Initialize();
33   SBDebugger dbg = SBDebugger::Create();
34
35   try {
36     if (!dbg.IsValid())
37       throw Exception("invalid debugger");
38     vector<string> args(argv + 1, argv + argc);
39
40     test(dbg, args);
41   } catch (Exception &e) {
42     cout << "ERROR: " << e.what() << endl;
43     code = 1;
44   }
45
46   SBDebugger::Destroy(dbg);
47   return code;
48 }