This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add the ability to provide a message to a progress event update
ClosedPublic

Authored by JDevlieghere on Feb 9 2023, 4:00 PM.

Details

Summary

This patch adds the ability to add a message to a progress event update.

Consider the following example as motivation. Say you have to load symbols for 3 dynamic libraries: libFoo, libBar, libBaz. Currently, there are two ways to report this:

  • As 3 separate progress instances. In this case you create a progress instance with the message "Loading symbols: libFoo", ""Loading symbols: libBar", and "Loading symbols: libBaz" respectively. If the operations are completely separate, i.e. they belong to different modules, this approach makes sense. This is what we do for parsing the symbol table, loading the dwarf index, etc.
  • As 1 progress instance with 3 units of work. This is the preferred approach is you know the number of units of work in advance, because you can report determinate progress. The title would be "Loading symbols" and you call Progress::Increment for each of the libraries. Note that with the current design, there's no way to include the name of the libraries, which is what this patch addresses.

Diff Detail

Event Timeline

JDevlieghere created this revision.Feb 9 2023, 4:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 9 2023, 4:00 PM
mib added a comment.Feb 9 2023, 4:44 PM

Makes sense! LGTM!

mib accepted this revision.Feb 9 2023, 4:44 PM
This revision is now accepted and ready to land.Feb 9 2023, 4:44 PM
bulbazord accepted this revision.Feb 10 2023, 11:06 AM

Thanks for including the motivation in your summary, that made following this change a lot easier.

LGTM

kastiglione accepted this revision.Feb 10 2023, 11:35 AM

nice

lldb/include/lldb/Core/DebuggerEvents.h
53–54

Are these going to be needed in a follow up?

59

minor quibble, but maybe m_current_subtitle (or some other m_current_<noun>) – I know that's wordy but "update" is a bit vague. Do as you please tho.

JDevlieghere marked 2 inline comments as done.Feb 10 2023, 12:00 PM
JDevlieghere added inline comments.
lldb/include/lldb/Core/DebuggerEvents.h
53–54

Yes, they're going in the dict from D143690. I saw Ismail's comments while working on this patch so I knew I was going to change it.

59

How about m_details. I don't think we need to include current here, as this is all part of a single event. I'll add comments to set expectations about the title being fixed and the details potentially changing.

JDevlieghere marked 2 inline comments as done.
  • update -> details
  • expose title and details separately in structured data

details is good, thanks

This revision was landed with ongoing or failed builds.Feb 12 2023, 11:19 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 12 2023, 11:19 AM