[Lldb-commits] [lldb] [lldb][progress][NFC] Add groundwork to keep track of progress reports (PR #81026)

Chelsea Cassanova via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 7 13:55:32 PST 2024


================
@@ -9,26 +9,34 @@
 #include "lldb/Core/Progress.h"
 
 #include "lldb/Core/Debugger.h"
-#include "lldb/Utility/StreamString.h"
 
 #include <optional>
 
 using namespace lldb;
 using namespace lldb_private;
 
 std::atomic<uint64_t> Progress::g_id(0);
+std::atomic<uint64_t> Progress::g_refcount(1);
+std::unordered_map<std::string, uint64_t> Progress::g_map = {};
 
 Progress::Progress(std::string title, std::string details,
                    std::optional<uint64_t> total,
-                   lldb_private::Debugger *debugger)
+                   lldb_private::Debugger *debugger, bool type)
     : m_title(title), m_details(details), m_id(++g_id), m_completed(0),
-      m_total(Progress::kNonDeterministicTotal) {
+      m_total(Progress::kNonDeterministicTotal), m_type(type) {
   if (total)
     m_total = *total;
 
   if (debugger)
     m_debugger_id = debugger->GetID();
   std::lock_guard<std::mutex> guard(m_mutex);
+
+  if (m_type == Progress::eProgressCoalecseReports) {
+    g_map.emplace(title, g_refcount);
----------------
chelcassanova wrote:

Using a global refcount shouldn't be necessary here, we can just initialize the value to 1 and increment/decrement as needed.

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


More information about the lldb-commits mailing list