-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb][enums] Remove broadcast bits from debugger #91618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb][enums] Remove broadcast bits from debugger #91618
Conversation
@llvm/pr-subscribers-lldb Author: Chelsea Cassanova (chelcassanova) ChangesRemoves the debugger broadcast bits from Full diff: https://github.com/llvm/llvm-project/pull/91618.diff 6 Files Affected:
diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h
index c0f7c732ad2d..ea994bf8c28d 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -78,15 +78,6 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
public UserID,
public Properties {
public:
- /// Broadcaster event bits definitions.
- enum {
- eBroadcastBitProgress = (1 << 0),
- eBroadcastBitWarning = (1 << 1),
- eBroadcastBitError = (1 << 2),
- eBroadcastSymbolChange = (1 << 3),
- eBroadcastBitProgressCategory = (1 << 4),
- };
-
using DebuggerList = std::vector<lldb::DebuggerSP>;
static llvm::StringRef GetStaticBroadcasterClass();
@@ -628,7 +619,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
ReportProgress(uint64_t progress_id, std::string title, std::string details,
uint64_t completed, uint64_t total,
std::optional<lldb::user_id_t> debugger_id,
- uint32_t progress_category_bit = eBroadcastBitProgress);
+ uint32_t progress_category_bit = lldb::eBroadcastBitProgress);
static void ReportDiagnosticImpl(lldb::Severity severity, std::string message,
std::optional<lldb::user_id_t> debugger_id,
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index 437971b3364c..8e05f6ba9c87 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -1344,7 +1344,8 @@ enum DebuggerBroadcastBit {
eBroadcastBitProgress = (1 << 0),
eBroadcastBitWarning = (1 << 1),
eBroadcastBitError = (1 << 2),
- eBroadcastBitProgressCategory = (1 << 3),
+ eBroadcastSymbolChange = (1 << 3),
+ eBroadcastBitProgressCategory = (1 << 4),
};
/// Used for expressing severity in logs and diagnostics.
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 976420a43443..1c2d4e378e20 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1485,10 +1485,10 @@ static void PrivateReportDiagnostic(Debugger &debugger, Severity severity,
assert(false && "eSeverityInfo should not be broadcast");
return;
case eSeverityWarning:
- event_type = Debugger::eBroadcastBitWarning;
+ event_type = lldb::eBroadcastBitWarning;
break;
case eSeverityError:
- event_type = Debugger::eBroadcastBitError;
+ event_type = lldb::eBroadcastBitError;
break;
}
@@ -1572,7 +1572,7 @@ void Debugger::ReportSymbolChange(const ModuleSpec &module_spec) {
std::lock_guard<std::recursive_mutex> guard(*g_debugger_list_mutex_ptr);
for (DebuggerSP debugger_sp : *g_debugger_list_ptr) {
EventSP event_sp = std::make_shared<Event>(
- Debugger::eBroadcastSymbolChange,
+ lldb::eBroadcastSymbolChange,
new SymbolChangeEventData(debugger_sp, module_spec));
debugger_sp->GetBroadcaster().BroadcastEvent(event_sp);
}
@@ -1879,8 +1879,8 @@ lldb::thread_result_t Debugger::DefaultEventHandler() {
CommandInterpreter::eBroadcastBitAsynchronousErrorData);
listener_sp->StartListeningForEvents(
- &m_broadcaster, eBroadcastBitProgress | eBroadcastBitWarning |
- eBroadcastBitError | eBroadcastSymbolChange);
+ &m_broadcaster, lldb::eBroadcastBitProgress | lldb::eBroadcastBitWarning |
+ lldb::eBroadcastBitError | lldb::eBroadcastSymbolChange);
// Let the thread that spawned us know that we have started up and that we
// are now listening to all required events so no events get missed
@@ -1932,11 +1932,11 @@ lldb::thread_result_t Debugger::DefaultEventHandler() {
}
}
} else if (broadcaster == &m_broadcaster) {
- if (event_type & Debugger::eBroadcastBitProgress)
+ if (event_type & lldb::eBroadcastBitProgress)
HandleProgressEvent(event_sp);
- else if (event_type & Debugger::eBroadcastBitWarning)
+ else if (event_type & lldb::eBroadcastBitWarning)
HandleDiagnosticEvent(event_sp);
- else if (event_type & Debugger::eBroadcastBitError)
+ else if (event_type & lldb::eBroadcastBitError)
HandleDiagnosticEvent(event_sp);
}
}
diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index 161038284e21..1a779e2ddf92 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -172,7 +172,7 @@ void ProgressManager::ReportProgress(
Debugger::ReportProgress(progress_data.progress_id, progress_data.title, "",
completed, Progress::kNonDeterministicTotal,
progress_data.debugger_id,
- Debugger::eBroadcastBitProgressCategory);
+ lldb::eBroadcastBitProgressCategory);
}
void ProgressManager::Expire(llvm::StringRef key) {
diff --git a/lldb/unittests/Core/DiagnosticEventTest.cpp b/lldb/unittests/Core/DiagnosticEventTest.cpp
index d06f164e87e7..0916e05f78ab 100644
--- a/lldb/unittests/Core/DiagnosticEventTest.cpp
+++ b/lldb/unittests/Core/DiagnosticEventTest.cpp
@@ -55,9 +55,9 @@ TEST_F(DiagnosticEventTest, Warning) {
ListenerSP listener_sp = Listener::MakeListener("test-listener");
listener_sp->StartListeningForEvents(&broadcaster,
- Debugger::eBroadcastBitWarning);
+ lldb::eBroadcastBitWarning);
EXPECT_TRUE(
- broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitWarning));
+ broadcaster.EventTypeHasListeners(lldb::eBroadcastBitWarning));
Debugger::ReportWarning("foo", debugger_sp->GetID());
@@ -81,8 +81,8 @@ TEST_F(DiagnosticEventTest, Error) {
ListenerSP listener_sp = Listener::MakeListener("test-listener");
listener_sp->StartListeningForEvents(&broadcaster,
- Debugger::eBroadcastBitError);
- EXPECT_TRUE(broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitError));
+ lldb::eBroadcastBitError);
+ EXPECT_TRUE(broadcaster.EventTypeHasListeners(lldb::eBroadcastBitError));
Debugger::ReportError("bar", debugger_sp->GetID());
@@ -111,7 +111,7 @@ TEST_F(DiagnosticEventTest, MultipleDebuggers) {
listeners.push_back(listener);
listener->StartListeningForEvents(&debugger->GetBroadcaster(),
- Debugger::eBroadcastBitError);
+ lldb::eBroadcastBitError);
}
Debugger::ReportError("baz");
@@ -140,9 +140,9 @@ TEST_F(DiagnosticEventTest, WarningOnce) {
ListenerSP listener_sp = Listener::MakeListener("test-listener");
listener_sp->StartListeningForEvents(&broadcaster,
- Debugger::eBroadcastBitWarning);
+ lldb::eBroadcastBitWarning);
EXPECT_TRUE(
- broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitWarning));
+ broadcaster.EventTypeHasListeners(lldb::eBroadcastBitWarning));
std::once_flag once;
Debugger::ReportWarning("foo", debugger_sp->GetID(), &once);
diff --git a/lldb/unittests/Core/ProgressReportTest.cpp b/lldb/unittests/Core/ProgressReportTest.cpp
index f0d253be9bf6..141244feb1f0 100644
--- a/lldb/unittests/Core/ProgressReportTest.cpp
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -61,7 +61,7 @@ class ProgressReportTest : public ::testing::Test {
};
TEST_F(ProgressReportTest, TestReportCreation) {
- ListenerSP listener_sp = CreateListenerFor(Debugger::eBroadcastBitProgress);
+ ListenerSP listener_sp = CreateListenerFor(lldb::eBroadcastBitProgress);
EventSP event_sp;
const ProgressEventData *data;
@@ -135,7 +135,7 @@ TEST_F(ProgressReportTest, TestReportCreation) {
TEST_F(ProgressReportTest, TestProgressManager) {
ListenerSP listener_sp =
- CreateListenerFor(Debugger::eBroadcastBitProgressCategory);
+ CreateListenerFor(lldb::eBroadcastBitProgressCategory);
EventSP event_sp;
const ProgressEventData *data;
@@ -173,7 +173,7 @@ TEST_F(ProgressReportTest, TestProgressManager) {
TEST_F(ProgressReportTest, TestOverlappingEvents) {
ListenerSP listener_sp =
- CreateListenerFor(Debugger::eBroadcastBitProgressCategory);
+ CreateListenerFor(lldb::eBroadcastBitProgressCategory);
EventSP event_sp;
const ProgressEventData *data;
@@ -214,7 +214,7 @@ TEST_F(ProgressReportTest, TestOverlappingEvents) {
TEST_F(ProgressReportTest, TestProgressManagerDisjointReports) {
ListenerSP listener_sp =
- CreateListenerFor(Debugger::eBroadcastBitProgressCategory);
+ CreateListenerFor(lldb::eBroadcastBitProgressCategory);
EventSP event_sp;
const ProgressEventData *data;
uint64_t expected_progress_id;
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but let's give Alex and Ismail a chance to take a look too.
(edit: with the formatting fixed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Removes the debugger broadcast bits from `Debugger.h` and instead uses the enum from `lldb-enumerations.h`. Also adds the `eBroadcastSymbolChange` bit to the enum in `lldb-enumerations.h`.
f338108
to
167850e
Compare
Removes the debugger broadcast bits from `Debugger.h` and instead uses the enum from `lldb-enumerations.h` and adds the `eBroadcastSymbolChange` bit to the enum in `lldb-enumerations.h`. This fixes a bug wherein the incorrect broadcast bit could be referenced due both of these enums previously existing and being out-of-sync with each other. (cherry picked from commit b9e3fa8)
…r-broadcast-bits-from-debugger [lldb][enums] Remove broadcast bits from debugger (llvm#91618)
Removes the debugger broadcast bits from
Debugger.h
and instead uses the enum fromlldb-enumerations.h
. Also adds theeBroadcastSymbolChange
bit to the enum inlldb-enumerations.h
.