From 2e912ec705192b77709b15a91f0c278fc1a6477c Mon Sep 17 00:00:00 2001 From: Tamas Berghammer Date: Wed, 10 Feb 2016 10:35:48 +0000 Subject: [PATCH] Add new option to lldb-server to display its version llvm-svn: 260366 --- lldb/tools/lldb-server/lldb-server.cpp | 36 +++++++++++++++----------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/lldb/tools/lldb-server/lldb-server.cpp b/lldb/tools/lldb-server/lldb-server.cpp index ec92b094f485..9ece640b2885 100644 --- a/lldb/tools/lldb-server/lldb-server.cpp +++ b/lldb/tools/lldb-server/lldb-server.cpp @@ -9,6 +9,7 @@ #include "lldb/Initialization/SystemLifetimeManager.h" #include "lldb/Initialization/SystemInitializerCommon.h" +#include "lldb/lldb-private.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/ManagedStatic.h" @@ -22,9 +23,10 @@ static void display_usage (const char *progname) { fprintf(stderr, "Usage:\n" + " %s v[ersion]\n" " %s g[dbserver] [options]\n" " %s p[latform] [options]\n" - "Invoke subcommand for additional help\n", progname, progname); + "Invoke subcommand for additional help\n", progname, progname, progname); exit(0); } @@ -57,20 +59,24 @@ main (int argc, char *argv[]) display_usage(progname); exit(option_error); } - else if (argv[1][0] == 'g') + + switch (argv[1][0]) { - 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); + case 'g': + initialize(); + main_gdbserver(argc, argv); + terminate(); + break; + case 'p': + initialize(); + main_platform(argc, argv); + terminate(); + break; + case 'v': + fprintf(stderr, "%s\n", lldb_private::GetVersion()); + break; + default: + display_usage(progname); + exit(option_error); } }