This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add an SB API to get progress events as SBStructuredData
ClosedPublic

Authored by JDevlieghere on Feb 9 2023, 3:28 PM.

Details

Summary

This is a preparatory patch to add an SB API to get the progress data as SBStructuredData. The approach is identical to the one taken for SBDebugger::GetDiagnosticFromEvent. By returning SBStructuredData we can grow the dictionary over time with more fields, which is what my follow up patch does.

Diff Detail

Event Timeline

JDevlieghere created this revision.Feb 9 2023, 3:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 9 2023, 3:28 PM
JDevlieghere requested review of this revision.Feb 9 2023, 3:28 PM
mib added inline comments.Feb 9 2023, 3:31 PM
lldb/source/API/SBDebugger.cpp
175–186

It feels wrong me that we're doing this at the SB API levels, I feel like we should have an overload of ProgressEventData::GetEventDataFromEvent that returns an actual structured data dictionary. This way, when we extend the progress events, we won't need to update all the places where GetEventDataFromEvent is called from.

JDevlieghere added inline comments.Feb 9 2023, 3:46 PM
lldb/source/API/SBDebugger.cpp
175–186

Good point, I totally agree. I'll move the code into the ProgressEventData and DiagnosticEventData respectively and have that return a StructuredData dictionary.

JDevlieghere marked an inline comment as done.

Address @mib's feedback

mib accepted this revision.Feb 10 2023, 5:08 PM

Thanks! LGTM!

This revision is now accepted and ready to land.Feb 10 2023, 5:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 10 2023, 5:18 PM