[Lldb-commits] [PATCH] D17030: Add new option to lldb-server to display its version

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 9 08:01:34 PST 2016


tberghammer created this revision.
tberghammer added a reviewer: labath.
tberghammer added a subscriber: lldb-commits.

Add new option to lldb-server to display its version

http://reviews.llvm.org/D17030

Files:
  tools/lldb-server/lldb-server.cpp

Index: tools/lldb-server/lldb-server.cpp
===================================================================
--- tools/lldb-server/lldb-server.cpp
+++ 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 @@
 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 @@
         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);
     }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17030.47320.patch
Type: text/x-patch
Size: 1737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160209/d416c839/attachment.bin>


More information about the lldb-commits mailing list