[Lldb-commits] [lldb] [lldb][Progress] Separate title and details (PR #77547)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 10 13:08:35 PST 2024


================
@@ -51,9 +56,10 @@ void Progress::Increment(uint64_t amount, std::string update) {
 void Progress::ReportProgress(std::string update) {
   if (!m_complete) {
     // Make sure we only send one notification that indicates the progress is
-    // complete.
-    m_complete = m_completed == m_total;
-    Debugger::ReportProgress(m_id, m_title, std::move(update), m_completed,
-                             m_total, m_debugger_id);
+    // complete, and only modify m_complete is m_total isn't null.
+    if (m_total.has_value())
+      m_complete = m_completed == m_total.value();
+    Debugger::ReportProgress(m_id, m_title, m_details, m_completed,
+                             m_total.value_or(0), m_debugger_id);
----------------
clayborg wrote:

This will actually mess up reporting of progress reports with no valid total. We will always sent out `completed = 0` and `total = 0` for both the start and end events. The easiest way to fix this would be to leave `m_total` as a uint64_t inside of progress, but still allow the argument to be an optional in the constructor. We need `completed` to not be equal to `total`, the start progress event will have `completed=0` and `total=<non-zero>`, and then the end event will need to have `completed=total` where total is non zero.

https://github.com/llvm/llvm-project/pull/77547


More information about the lldb-commits mailing list