[Lldb-commits] [lldb] r260366 - Add new option to lldb-server to display its version

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 10 02:36:16 PST 2016


Author: tberghammer
Date: Wed Feb 10 04:35:48 2016
New Revision: 260366

URL: http://llvm.org/viewvc/llvm-project?rev=260366&view=rev
Log:
Add new option to lldb-server to display its version

Modified:
    lldb/trunk/tools/lldb-server/lldb-server.cpp

Modified: lldb/trunk/tools/lldb-server/lldb-server.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-server.cpp?rev=260366&r1=260365&r2=260366&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/lldb-server.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-server.cpp Wed Feb 10 04:35:48 2016
@@ -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')
-    {
-        initialize();
-        main_gdbserver(argc, argv);
-        terminate();
-    }
-    else if (argv[1][0] == 'p')
+
+    switch (argv[1][0])
     {
-        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);
     }
 }




More information about the lldb-commits mailing list