summaryrefslogtreecommitdiff
path: root/lldb/source/API/SBCommandReturnObject.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2024-10-14 16:29:26 -0700
committerGitHub <noreply@github.com>2024-10-14 16:29:26 -0700
commit9eddc8b9bf4e4e0b01e2ecc90a71c4b3b4e9c8af (patch)
treec5525898a47401b0e6ebb6d4cc8b72569fd5d953 /lldb/source/API/SBCommandReturnObject.cpp
parentfc08ad6610c66856f48559e543eb7be317e908e7 (diff)
[lldb] Expose structured command diagnostics via the SBAPI. (#112109)
This allows IDEs to render LLDB expression diagnostics to their liking without relying on characterprecise ASCII art from LLDB. It is exposed as a versioned SBStructuredData object, since it is expected that this may need to be tweaked based on actual usage.
Diffstat (limited to 'lldb/source/API/SBCommandReturnObject.cpp')
-rw-r--r--lldb/source/API/SBCommandReturnObject.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lldb/source/API/SBCommandReturnObject.cpp b/lldb/source/API/SBCommandReturnObject.cpp
index a94eff75ffcb..9df8aa48b993 100644
--- a/lldb/source/API/SBCommandReturnObject.cpp
+++ b/lldb/source/API/SBCommandReturnObject.cpp
@@ -11,6 +11,8 @@
#include "lldb/API/SBError.h"
#include "lldb/API/SBFile.h"
#include "lldb/API/SBStream.h"
+#include "lldb/API/SBStructuredData.h"
+#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Instrumentation.h"
@@ -96,6 +98,15 @@ const char *SBCommandReturnObject::GetError() {
return output.AsCString(/*value_if_empty*/ "");
}
+SBStructuredData SBCommandReturnObject::GetErrorData() {
+ LLDB_INSTRUMENT_VA(this);
+
+ StructuredData::ObjectSP data(ref().GetErrorData());
+ SBStructuredData sb_data;
+ sb_data.m_impl_up->SetObjectSP(data);
+ return sb_data;
+}
+
size_t SBCommandReturnObject::GetOutputSize() {
LLDB_INSTRUMENT_VA(this);