summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2010-12-23 20:21:44 +0000
committerJohnny Chen <johnny.chen@apple.com>2010-12-23 20:21:44 +0000
commit31c39dac6db4423546e3018ad75b409870f07ea8 (patch)
tree145bdb17abb4b5bc8dced567ace78d6de75c13d9 /lldb/source/Commands
parentd99bd55a5e092774214ba31fc5a871bfc31e711c (diff)
downloadbcm5719-llvm-31c39dac6db4423546e3018ad75b409870f07ea8.tar.gz
bcm5719-llvm-31c39dac6db4423546e3018ad75b409870f07ea8.zip
Add a simple command: 'version' to the command interpreter, and an accompanying
test case test_help_version(). llvm-svn: 122515
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandObjectVersion.cpp48
-rw-r--r--lldb/source/Commands/CommandObjectVersion.h42
2 files changed, 90 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectVersion.cpp b/lldb/source/Commands/CommandObjectVersion.cpp
new file mode 100644
index 00000000000..5e159e1cbc8
--- /dev/null
+++ b/lldb/source/Commands/CommandObjectVersion.cpp
@@ -0,0 +1,48 @@
+//===-- CommandObjectVersion.cpp --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "CommandObjectVersion.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+//-------------------------------------------------------------------------
+// CommandObjectVersion
+//-------------------------------------------------------------------------
+
+CommandObjectVersion::CommandObjectVersion (CommandInterpreter &interpreter) :
+ CommandObject (interpreter, "version", "Show version of LLDB debugger.", "version")
+{
+}
+
+CommandObjectVersion::~CommandObjectVersion ()
+{
+}
+
+bool
+CommandObjectVersion::Execute
+(
+ Args& args,
+ CommandReturnObject &result
+)
+{
+ StreamString &output_stream = result.GetOutputStream();
+ output_stream.Printf ("%s\n", lldb_private::GetVersion());
+ result.SetStatus (eReturnStatusSuccessFinishResult);
+ return true;
+}
+
diff --git a/lldb/source/Commands/CommandObjectVersion.h b/lldb/source/Commands/CommandObjectVersion.h
new file mode 100644
index 00000000000..3da2deaa789
--- /dev/null
+++ b/lldb/source/Commands/CommandObjectVersion.h
@@ -0,0 +1,42 @@
+//===-- CommandObjectVersion.h ----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandObjectVersion_h_
+#define liblldb_CommandObjectVersion_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Interpreter/CommandObject.h"
+
+namespace lldb_private {
+
+//-------------------------------------------------------------------------
+// CommandObjectVersion
+//-------------------------------------------------------------------------
+
+class CommandObjectVersion : public CommandObject
+{
+public:
+
+ CommandObjectVersion (CommandInterpreter &interpreter);
+
+ virtual
+ ~CommandObjectVersion ();
+
+ virtual bool
+ Execute (Args& args,
+ CommandReturnObject &result);
+
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CommandObjectVersion_h_
OpenPOWER on IntegriCloud