Author: Med Ismail Bennani Date: 2022-07-05T16:25:40-07:00 New Revision: ea8b811bf800680e7d7bde1e8d6ff43f8ecf17cf
URL: https://github.com/llvm/llvm-project/commit/ea8b811bf800680e7d7bde1e8d6ff43f8ecf17cf DIFF: https://github.com/llvm/llvm-project/commit/ea8b811bf800680e7d7bde1e8d6ff43f8ecf17cf.diff LOG: [lldb/Core] Fix finite progress event reporting This patch should fix event handling for finite progress reports. Previously, the event handler would get stuck when receiving a finite progress report, and stop displaying upcoming reports. This was due to the fact that we were checking if the progress event was completed by calling `GetCompleted` but returns the completion amount instead of saying whether it's completed. That caused the current event id to remain the same, preventing all the following progress reports to be shown to the user. This patch also adds some logging to facilitate debugging progress events. rdar://91788326 Differential Revision: https://reviews.llvm.org/D128768 Signed-off-by: Med Ismail Bennani <medismail.benn...@gmail.com> Added: Modified: lldb/source/Core/Debugger.cpp Removed: ################################################################################ diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index f17cd8856a6db..62857c181af89 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1835,9 +1835,20 @@ void Debugger::HandleProgressEvent(const lldb::EventSP &event_sp) { // going to show the progress. const uint64_t id = data->GetID(); if (m_current_event_id) { + Log *log = GetLog(LLDBLog::Events); + if (log && log->GetVerbose()) { + StreamString log_stream; + log_stream.AsRawOstream() + << static_cast<void *>(this) << " Debugger(" << GetID() + << ")::HandleProgressEvent( m_current_event_id = " + << *m_current_event_id << ", data = { "; + data->Dump(&log_stream); + log_stream << " } )"; + log->PutString(log_stream.GetString()); + } if (id != *m_current_event_id) return; - if (data->GetCompleted()) + if (data->GetCompleted() == data->GetTotal()) m_current_event_id.reset(); } else { m_current_event_id = id; @@ -1860,7 +1871,7 @@ void Debugger::HandleProgressEvent(const lldb::EventSP &event_sp) { // Print over previous line, if any. output->Printf("\r"); - if (data->GetCompleted()) { + if (data->GetCompleted() == data->GetTotal()) { // Clear the current line. output->Printf("\x1B[2K"); output->Flush(); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits