[Lldb-commits] [lldb] [lldb][progress][NFC] Add groundwork to keep track of progress reports (PR #81026)
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Wed Feb 7 13:42:01 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);
+
+ if (g_map.at(title) >= 1)
----------------
medismailben wrote:
This needs to be strictly greater than 1, otherwise you'll increment the refcount twice in the first progress report instantiation.
https://github.com/llvm/llvm-project/pull/81026
More information about the lldb-commits
mailing list