diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2023-02-10 11:55:02 -0800 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2023-02-10 17:18:00 -0800 |
commit | 0ac8dfd0587a1a95e8ed464bc59741837aae9c1f (patch) | |
tree | fea1d2d0e1175cf7dc0dc5893dd944f2f5a636aa /lldb/source/API/SBDebugger.cpp | |
parent | dc6427d687c4640e33c9bdab0c888b6f7d0569be (diff) | |
download | llvm-0ac8dfd0587a1a95e8ed464bc59741837aae9c1f.zip llvm-0ac8dfd0587a1a95e8ed464bc59741837aae9c1f.tar.gz llvm-0ac8dfd0587a1a95e8ed464bc59741837aae9c1f.tar.bz2 |
[lldb] Add an SB API to get progress events as SBStructuredData
This is a preparatory patch to add an SB API to get the progress data as
SBStructuredData. The advantage of using SBStructuredData is that the
dictionary can grow over time with more fields.
This approach is identical to the way this is implemented for diagnostic
events.
Differential revision: https://reviews.llvm.org/D143687
Diffstat (limited to 'lldb/source/API/SBDebugger.cpp')
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index be86078..2fa93e4 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -169,6 +169,21 @@ const char *SBDebugger::GetProgressFromEvent(const lldb::SBEvent &event, } lldb::SBStructuredData +SBDebugger::GetProgressDataFromEvent(const lldb::SBEvent &event) { + LLDB_INSTRUMENT_VA(event); + + StructuredData::DictionarySP dictionary_sp = + ProgressEventData::GetAsStructuredData(event.get()); + + if (!dictionary_sp) + return {}; + + SBStructuredData data; + data.m_impl_up->SetObjectSP(std::move(dictionary_sp)); + return data; +} + +lldb::SBStructuredData SBDebugger::GetDiagnosticFromEvent(const lldb::SBEvent &event) { LLDB_INSTRUMENT_VA(event); |