Files
clang-p2996/lldb/tools/lldb-server/lldb-server.cpp
Robert Flack ab3269d275 Reduce the number of components initialized by lldb-server to reduce static binary size.
Separate out the necessary component initialization for lldb-server such that the linker can greatly reduce the binary size. With this patch the size of lldb-server on my 64 bit linux release build drops from 46MB to 26MB.

Differential Revision: http://reviews.llvm.org/D7880

llvm-svn: 230963
2015-03-02 15:14:50 +00:00

72 lines
1.6 KiB
C++

//===-- 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/lldb-private.h"
#include <stdio.h>
#include <stdlib.h>
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 ()
{
lldb_private::InitializeForLLGS();
}
static void
terminate ()
{
lldb_private::WillTerminate();
lldb_private::TerminateLLGS();
}
//----------------------------------------------------------------------
// 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);
}
}