[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.
This commit is contained in:
Adrian Prantl
2024-10-14 16:29:26 -07:00
committed by GitHub
parent fc08ad6610
commit 9eddc8b9bf
11 changed files with 186 additions and 103 deletions

View File

@@ -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);