summaryrefslogtreecommitdiffstats
path: root/tools/lldb-server/lldb-server.cpp
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2015-07-03 16:57:06 +0000
committeremaste <emaste@FreeBSD.org>2015-07-03 16:57:06 +0000
commit8037fa4ee916fa20b3c63cbf531f4ee7e1c76138 (patch)
tree3c2e41c3be19b7fc7666ed45a5f91ec3b6e35f2a /tools/lldb-server/lldb-server.cpp
parentd61b076ede88b56f3372a55e7d1eac6a9d717120 (diff)
downloadFreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.zip
FreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.tar.gz
Import LLDB as of upstream SVN 241361 (git 612c075f)
Diffstat (limited to 'tools/lldb-server/lldb-server.cpp')
-rw-r--r--tools/lldb-server/lldb-server.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/tools/lldb-server/lldb-server.cpp b/tools/lldb-server/lldb-server.cpp
new file mode 100644
index 0000000..ec92b09
--- /dev/null
+++ b/tools/lldb-server/lldb-server.cpp
@@ -0,0 +1,76 @@
+//===-- lldb-server.cpp -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Initialization/SystemLifetimeManager.h"
+#include "lldb/Initialization/SystemInitializerCommon.h"
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/ManagedStatic.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+static llvm::ManagedStatic<lldb_private::SystemLifetimeManager> g_debugger_lifetime;
+
+static void
+display_usage (const char *progname)
+{
+ fprintf(stderr, "Usage:\n"
+ " %s g[dbserver] [options]\n"
+ " %s p[latform] [options]\n"
+ "Invoke subcommand for additional help\n", progname, progname);
+ exit(0);
+}
+
+// Forward declarations of subcommand main methods.
+int main_gdbserver (int argc, char *argv[]);
+int main_platform (int argc, char *argv[]);
+
+static void
+initialize ()
+{
+ g_debugger_lifetime->Initialize(llvm::make_unique<lldb_private::SystemInitializerCommon>(), nullptr);
+}
+
+static void
+terminate ()
+{
+ g_debugger_lifetime->Terminate();
+}
+
+//----------------------------------------------------------------------
+// main
+//----------------------------------------------------------------------
+int
+main (int argc, char *argv[])
+{
+ int option_error = 0;
+ const char *progname = argv[0];
+ if (argc < 2)
+ {
+ display_usage(progname);
+ exit(option_error);
+ }
+ else if (argv[1][0] == 'g')
+ {
+ initialize();
+ main_gdbserver(argc, argv);
+ terminate();
+ }
+ else if (argv[1][0] == 'p')
+ {
+ initialize();
+ main_platform(argc, argv);
+ terminate();
+ }
+ else {
+ display_usage(progname);
+ exit(option_error);
+ }
+}
OpenPOWER on IntegriCloud