Skip to content

[lldb][enums] Remove broadcast bits from debugger (#91618) #8729

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lldb/bindings/python/static-binding/LLDBWrapPython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98821,6 +98821,10 @@ SWIG_init(void) {
SWIG_Python_SetConstant(d, "eAddressMaskRangeAll",SWIG_From_int(static_cast< int >(lldb::eAddressMaskRangeAll)));
SWIG_Python_SetConstant(d, "ChildCacheState_eRefetch",SWIG_From_int(static_cast< int >(lldb::ChildCacheState::eRefetch)));
SWIG_Python_SetConstant(d, "ChildCacheState_eReuse",SWIG_From_int(static_cast< int >(lldb::ChildCacheState::eReuse)));
SWIG_Python_SetConstant(d, "eBroadcastBitProgress",SWIG_From_int(static_cast< int >(lldb::eBroadcastBitProgress)));
SWIG_Python_SetConstant(d, "eBroadcastBitWarning",SWIG_From_int(static_cast< int >(lldb::eBroadcastBitWarning)));
SWIG_Python_SetConstant(d, "eBroadcastBitError",SWIG_From_int(static_cast< int >(lldb::eBroadcastBitError)));
SWIG_Python_SetConstant(d, "eBroadcastBitProgressCategory",SWIG_From_int(static_cast< int >(lldb::eBroadcastBitProgressCategory)));
SWIG_Python_SetConstant(d, "SBCommandInterpreter_eBroadcastBitThreadShouldExit",SWIG_From_int(static_cast< int >(lldb::SBCommandInterpreter::eBroadcastBitThreadShouldExit)));
SWIG_Python_SetConstant(d, "SBCommandInterpreter_eBroadcastBitResetPrompt",SWIG_From_int(static_cast< int >(lldb::SBCommandInterpreter::eBroadcastBitResetPrompt)));
SWIG_Python_SetConstant(d, "SBCommandInterpreter_eBroadcastBitQuitCommandReceived",SWIG_From_int(static_cast< int >(lldb::SBCommandInterpreter::eBroadcastBitQuitCommandReceived)));
Expand Down
8 changes: 8 additions & 0 deletions lldb/bindings/python/static-binding/lldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,14 @@ def lldb_iter(obj, getsize, getelem):

ChildCacheState_eReuse = _lldb.ChildCacheState_eReuse

eBroadcastBitProgress = _lldb.eBroadcastBitProgress

eBroadcastBitWarning = _lldb.eBroadcastBitWarning

eBroadcastBitError = _lldb.eBroadcastBitError

eBroadcastBitProgressCategory = _lldb.eBroadcastBitProgressCategory

class SBAddress(object):
r"""
A section + offset based address class.
Expand Down
11 changes: 1 addition & 10 deletions lldb/include/lldb/Core/Debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ConstString GetStaticBroadcasterClass();
Expand Down Expand Up @@ -637,7 +628,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,
Expand Down
3 changes: 2 additions & 1 deletion lldb/include/lldb/lldb-enumerations.h
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,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.
Expand Down
17 changes: 9 additions & 8 deletions lldb/source/Core/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1521,10 +1521,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;
}

Expand Down Expand Up @@ -1608,7 +1608,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);
}
Expand Down Expand Up @@ -1928,8 +1928,9 @@ 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
Expand Down Expand Up @@ -1981,11 +1982,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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Core/Progress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
17 changes: 7 additions & 10 deletions lldb/unittests/Core/DiagnosticEventTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ TEST_F(DiagnosticEventTest, Warning) {
ListenerSP listener_sp = Listener::MakeListener("test-listener");

listener_sp->StartListeningForEvents(&broadcaster,
Debugger::eBroadcastBitWarning);
EXPECT_TRUE(
broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitWarning));
lldb::eBroadcastBitWarning);
EXPECT_TRUE(broadcaster.EventTypeHasListeners(lldb::eBroadcastBitWarning));

Debugger::ReportWarning("foo", debugger_sp->GetID());

Expand All @@ -80,9 +79,8 @@ TEST_F(DiagnosticEventTest, Error) {
Broadcaster &broadcaster = debugger_sp->GetBroadcaster();
ListenerSP listener_sp = Listener::MakeListener("test-listener");

listener_sp->StartListeningForEvents(&broadcaster,
Debugger::eBroadcastBitError);
EXPECT_TRUE(broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitError));
listener_sp->StartListeningForEvents(&broadcaster, lldb::eBroadcastBitError);
EXPECT_TRUE(broadcaster.EventTypeHasListeners(lldb::eBroadcastBitError));

Debugger::ReportError("bar", debugger_sp->GetID());

Expand Down Expand Up @@ -111,7 +109,7 @@ TEST_F(DiagnosticEventTest, MultipleDebuggers) {
listeners.push_back(listener);

listener->StartListeningForEvents(&debugger->GetBroadcaster(),
Debugger::eBroadcastBitError);
lldb::eBroadcastBitError);
}

Debugger::ReportError("baz");
Expand Down Expand Up @@ -140,9 +138,8 @@ TEST_F(DiagnosticEventTest, WarningOnce) {
ListenerSP listener_sp = Listener::MakeListener("test-listener");

listener_sp->StartListeningForEvents(&broadcaster,
Debugger::eBroadcastBitWarning);
EXPECT_TRUE(
broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitWarning));
lldb::eBroadcastBitWarning);
EXPECT_TRUE(broadcaster.EventTypeHasListeners(lldb::eBroadcastBitWarning));

std::once_flag once;
Debugger::ReportWarning("foo", debugger_sp->GetID(), &once);
Expand Down
8 changes: 4 additions & 4 deletions lldb/unittests/Core/ProgressReportTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down