• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17using namespace std;
18using namespace lldb;
19
20void test(SBDebugger &dbg, std::vector<string> args);
21
22int 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  dbg.HandleCommand("settings set symbols.enable-external-lookup false");
35  dbg.HandleCommand(
36      "settings set plugin.process.gdb-remote.packet-timeout 60");
37
38  try {
39    if (!dbg.IsValid())
40      throw Exception("invalid debugger");
41    vector<string> args(argv + 1, argv + argc);
42
43    test(dbg, args);
44  } catch (Exception &e) {
45    cout << "ERROR: " << e.what() << endl;
46    code = 1;
47  }
48
49  SBDebugger::Destroy(dbg);
50  return code;
51}
52