apolyakov created this revision.
apolyakov added reviewers: aprantl, clayborg.
Herald added a subscriber: ki.stfu.

https://reviews.llvm.org/D47914

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);
+  void SetError(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 enter error information into the command's
+//          metadata object and set the command's error status.
+// Type:    Method.
+// Args:    error - (R) Command result description.
+// Return:  None.
+// Throws:  None.
+//--
+void CMICmdBase::SetError(const lldb::SBError &error) {
+  const char *error_cstr = error.GetCString();
+  if (error_cstr)
+    SetError(error_cstr);
+  else
+    SetError("unknown error");
+}
+
+//++
+//------------------------------------------------------------------------------------
 // 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);
+  void SetError(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 enter error information into the command's
+//          metadata object and set the command's error status.
+// Type:    Method.
+// Args:    error - (R) Command result description.
+// Return:  None.
+// Throws:  None.
+//--
+void CMICmdBase::SetError(const lldb::SBError &error) {
+  const char *error_cstr = error.GetCString();
+  if (error_cstr)
+    SetError(error_cstr);
+  else
+    SetError("unknown error");
+}
+
+//++
+//------------------------------------------------------------------------------------
 // Details: Ask a command to provide its unique identifier.
 // Type:    Method.
 // Args:    A unique identifier for this command class.
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to