[Lldb-commits] [lldb] Add settings and code that limits the number of progress events. (PR #75769)
via lldb-commits
lldb-commits at lists.llvm.org
Sun Dec 17 23:09:24 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 2aaeef1fad0c1b233f6d3ca67a6c05877dc9e998 598115f4d8240b6199493e6380369b0074af8411 -- lldb/include/lldb/Core/Debugger.h lldb/include/lldb/Core/DebuggerEvents.h lldb/include/lldb/Utility/LLDBLog.h lldb/source/Core/Debugger.cpp lldb/source/Utility/LLDBLog.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h
index 5ee2ef93fe..91b8921b7c 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -743,8 +743,8 @@ protected:
using ProgressTimePoint = std::chrono::time_point<ProgressClock>;
using ProgressDuration = ProgressTimePoint::duration;
struct ProgressInfo {
- ProgressInfo(ProgressEventData *data_ptr, uint64_t min_duration_ms) :
- data_up(data_ptr), start(ProgressClock::now()) {
+ ProgressInfo(ProgressEventData *data_ptr, uint64_t min_duration_ms)
+ : data_up(data_ptr), start(ProgressClock::now()) {
next_event_time = start + std::chrono::milliseconds(min_duration_ms);
}
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index b8c8b5bf82..f679f1a58b 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -606,8 +606,6 @@ uint64_t Debugger::GetProgressMinDuration() const {
idx, g_debugger_properties[idx].default_uint_value);
}
-
-
#pragma mark Debugger
// const DebuggerPropertiesSP &
@@ -1445,8 +1443,7 @@ void Debugger::SetDestroyCallback(
m_destroy_callback_baton = baton;
}
-
- /// Notify the progress thread that there is new progress data.
+/// Notify the progress thread that there is new progress data.
void Debugger::NotifyProgress(std::unique_ptr<ProgressEventData> &data_up) {
// Start the progress thread if it isn't already running.
if (!m_progress_thread.IsJoinable())
@@ -1470,10 +1467,12 @@ void Debugger::NotifyProgress(std::unique_ptr<ProgressEventData> &data_up) {
data_up.get(), data_up->GetID(), data_up->GetTitle(),
data_up->GetCompleted(), data_up->GetTotal());
else
- LLDB_LOG(log, "NotifyProgress id = {1}, title = \"{2}\", "
- "detail = \"{3}\" {4}/{5}", data_up.get(), data_up->GetID(),
- data_up->GetTitle(), data_up->GetDetails(),
- data_up->GetCompleted(), data_up->GetTotal());
+ LLDB_LOG(log,
+ "NotifyProgress id = {1}, title = \"{2}\", "
+ "detail = \"{3}\" {4}/{5}",
+ data_up.get(), data_up->GetID(), data_up->GetTitle(),
+ data_up->GetDetails(), data_up->GetCompleted(),
+ data_up->GetTotal());
}
const uint64_t progress_id = data_up->GetID();
@@ -1486,15 +1485,16 @@ void Debugger::NotifyProgress(std::unique_ptr<ProgressEventData> &data_up) {
ProgressInfo &info = pos->second;
bool replace_data = false;
if (info.last_notification_time) {
- LLDB_LOG(log, "NotifyProgress id = {0} replace_data = 1 (event sent "
- "already)", progress_id);
+ LLDB_LOG(log,
+ "NotifyProgress id = {0} replace_data = 1 (event sent "
+ "already)",
+ progress_id);
// We have sent an event for this already, always replace the progress
// data as this means we already sent a progress start event so we
// always want to send the most up to date information.
replace_data = true;
} else {
- LLDB_LOG(log, "NotifyProgress id = {0} no event sent yet",
- progress_id);
+ LLDB_LOG(log, "NotifyProgress id = {0} no event sent yet", progress_id);
// We haven't sent any notifications yet for this progress.
if (info.data_up) {
// If we are done already, then set the data so we don't send any
@@ -1502,13 +1502,17 @@ void Debugger::NotifyProgress(std::unique_ptr<ProgressEventData> &data_up) {
// the original start progress notification in the progress info in
// case we send it.
replace_data = data_up->IsDone();
- LLDB_LOG(log, "NotifyProgress id = {0} replace_data = {1} (only "
- "true if done)", progress_id, replace_data);
+ LLDB_LOG(log,
+ "NotifyProgress id = {0} replace_data = {1} (only "
+ "true if done)",
+ progress_id, replace_data);
} else {
// There is no data in the ProgressInfo as it was sent in an event
// and the unique pointer was reset, so set the data.
- LLDB_LOG(log, "NotifyProgress id = {0} replace_data = 1 ("
- "ProgressEventData is NULL)", progress_id, replace_data);
+ LLDB_LOG(log,
+ "NotifyProgress id = {0} replace_data = 1 ("
+ "ProgressEventData is NULL)",
+ progress_id, replace_data);
replace_data = true;
}
}
@@ -1543,7 +1547,7 @@ lldb::thread_result_t Debugger::ProgressThread() {
// std::condition_variable::wait or std::condition_variable::wait_for calls
// below. Exit the std::condition_variable wait(...) or wait_for(...) calls if
// we haven't seen this update ID or if we want the thread to exit.
- auto predicate = [this, &update_id]{
+ auto predicate = [this, &update_id] {
return update_id != m_progress_update_id || !m_progress_thread_running;
};
const uint32_t event_type = Debugger::eBroadcastBitProgress;
@@ -1558,7 +1562,8 @@ lldb::thread_result_t Debugger::ProgressThread() {
std::optional<ProgressDuration> opt_wait_duration;
while (m_progress_thread_running) {
if (opt_wait_duration.has_value()) {
- LLDB_LOG(log, "ProgressThread wait_for(timeout = {0})", *opt_wait_duration);
+ LLDB_LOG(log, "ProgressThread wait_for(timeout = {0})",
+ *opt_wait_duration);
m_progress_condition.wait_for(lock, *opt_wait_duration, predicate);
} else {
// We have no progress events or updates pending wait for a notification.
@@ -1582,7 +1587,7 @@ lldb::thread_result_t Debugger::ProgressThread() {
// completed.
std::set<uint64_t> done_ids;
const auto now = ProgressClock::now();
- for (auto &pair: m_progress_map) {
+ for (auto &pair : m_progress_map) {
// If we send a notification and use a ProgressEventData, we will set the
// ProgressEventData unique pointer to NULL, so if we don't have current
// ProgressEventData, then skip to the next progress info as we are
@@ -1603,8 +1608,10 @@ lldb::thread_result_t Debugger::ProgressThread() {
if (is_done_event) {
// Progress is done and can be removed and we need to send an event
// to signal we are done.
- LLDB_LOG(log, "ProgressThread id = {0} send_event = 1 (done), "
- "elapsed_time = {1}", pair.first, now - info.start);
+ LLDB_LOG(log,
+ "ProgressThread id = {0} send_event = 1 (done), "
+ "elapsed_time = {1}",
+ pair.first, now - info.start);
send_event = true;
} else {
// If we aren't done, check if we need to send updates for this. For
@@ -1622,8 +1629,10 @@ lldb::thread_result_t Debugger::ProgressThread() {
if (!opt_wait_duration || *opt_wait_duration > wait_duration)
opt_wait_duration = wait_duration;
}
- LLDB_LOG(log, "ProgressThread id = {0} send_event = {1}} "
- "(update check)", pair.first, send_event);
+ LLDB_LOG(log,
+ "ProgressThread id = {0} send_event = {1}} "
+ "(update check)",
+ pair.first, send_event);
}
}
@@ -1637,9 +1646,10 @@ lldb::thread_result_t Debugger::ProgressThread() {
if (is_done_event) {
// We are already done before we sent a start progress event, so
// nothing to do as the progress was too short be be displayed.
- LLDB_LOG(log, "ProgressThread id = {0} send_event = 0, elapsed_time"
- " = {1} (less than minimum duration {2})", pair.first,
- now - info.start, min_duration);
+ LLDB_LOG(log,
+ "ProgressThread id = {0} send_event = 0, elapsed_time"
+ " = {1} (less than minimum duration {2})",
+ pair.first, now - info.start, min_duration);
} else {
// We will send our progress start event only if we exceed the
// minimum progress duration will cause us to enter this loop.
@@ -1656,8 +1666,10 @@ lldb::thread_result_t Debugger::ProgressThread() {
if (!opt_wait_duration || *opt_wait_duration > wait_duration)
opt_wait_duration = wait_duration;
}
- LLDB_LOG(log, "ProgressThread id = {0} send_event = {1} (min "
- "notify time check)", pair.first, send_event);
+ LLDB_LOG(log,
+ "ProgressThread id = {0} send_event = {1} (min "
+ "notify time check)",
+ pair.first, send_event);
}
}
@@ -1683,7 +1695,7 @@ lldb::thread_result_t Debugger::ProgressThread() {
}
// Remove any progress infos that are done.
- for (uint64_t progress_id: done_ids)
+ for (uint64_t progress_id : done_ids)
m_progress_map.erase(progress_id);
}
LLDB_LOG(log, "ProgressThread thread exited");
``````````
</details>
https://github.com/llvm/llvm-project/pull/75769
More information about the lldb-commits
mailing list