apolyakov created this revision.
apolyakov added reviewers: aprantl, clayborg, labath.
Herald added a subscriber: ki.stfu.
The new method takes one parameter of type SBError and, if it has an error,
sets error message and returns MIstatus::failure,
returns MIstatus::success otherwise.
https://reviews.llvm.org/D48295
Files:
tools/lldb-mi/MICmdBase.cpp
tools/lldb-mi/MICmdBase.h
Index: tools/lldb-mi/MICmdBase.h
===================================================================
--- tools/lldb-mi/MICmdBase.h
+++ tools/lldb-mi/MICmdBase.h
@@ -12,6 +12,8 @@
// C Includes
// C++ Includes
// Other libraries and framework includes
+#include "lldb/API/SBError.h"
+
// Project includes
#include "MICmdArgSet.h"
#include "MICmdData.h"
@@ -80,6 +82,7 @@
// Methods:
protected:
void SetError(const CMIUtilString &rErrMsg);
+ bool ReturnMIStatus(const lldb::SBError &error);
template <class T> T *GetOption(const CMIUtilString &vStrOptionName);
bool ParseValidateCmdOptions();
Index: tools/lldb-mi/MICmdBase.cpp
===================================================================
--- tools/lldb-mi/MICmdBase.cpp
+++ tools/lldb-mi/MICmdBase.cpp
@@ -214,6 +214,23 @@
//++
//------------------------------------------------------------------------------------
+// Details: Short cut function to check MI command's execute status and
+// set an error in case of failure.
+// Type: Method.
+// Args: error - (R) Error description object.
+// Return: None.
+// Throws: None.
+//--
+bool CMICmdBase::ReturnMIStatus(const lldb::SBError &error) {
+ if (error.Success())
+ return MIstatus::success;
+
+ SetError(error.GetCString());
+ return MIstatus::failure;
+}
+
+//++
+//------------------------------------------------------------------------------------
// Details: Ask a command to provide its unique identifier.
// Type: Method.
// Args: A unique identifier for this command class.
Index: tools/lldb-mi/MICmdBase.h
===================================================================
--- tools/lldb-mi/MICmdBase.h
+++ tools/lldb-mi/MICmdBase.h
@@ -12,6 +12,8 @@
// C Includes
// C++ Includes
// Other libraries and framework includes
+#include "lldb/API/SBError.h"
+
// Project includes
#include "MICmdArgSet.h"
#include "MICmdData.h"
@@ -80,6 +82,7 @@
// Methods:
protected:
void SetError(const CMIUtilString &rErrMsg);
+ bool ReturnMIStatus(const lldb::SBError &error);
template <class T> T *GetOption(const CMIUtilString &vStrOptionName);
bool ParseValidateCmdOptions();
Index: tools/lldb-mi/MICmdBase.cpp
===================================================================
--- tools/lldb-mi/MICmdBase.cpp
+++ tools/lldb-mi/MICmdBase.cpp
@@ -214,6 +214,23 @@
//++
//------------------------------------------------------------------------------------
+// Details: Short cut function to check MI command's execute status and
+// set an error in case of failure.
+// Type: Method.
+// Args: error - (R) Error description object.
+// Return: None.
+// Throws: None.
+//--
+bool CMICmdBase::ReturnMIStatus(const lldb::SBError &error) {
+ if (error.Success())
+ return MIstatus::success;
+
+ SetError(error.GetCString());
+ return MIstatus::failure;
+}
+
+//++
+//------------------------------------------------------------------------------------
// Details: Ask a command to provide its unique identifier.
// Type: Method.
// Args: A unique identifier for this command class.
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits