From 2661f371fb31307a29b96701a47939dbf5ff6727 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 18 Nov 2025 18:45:06 -0500 Subject: [PATCH] Debugger: Don't wait for threads or user in the CLI input loop. It seems to be unecessary and just hangs the CLI most of the time if there's no thread about to stop. Makes Debugger --team actually work instead of just hanging. --- .../user_interface/cli/CliContext.cpp | 20 +------------------ .../debugger/user_interface/cli/CliContext.h | 1 - .../cli/CommandLineUserInterface.cpp | 5 ----- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/src/apps/debugger/user_interface/cli/CliContext.cpp b/src/apps/debugger/user_interface/cli/CliContext.cpp index ee14a12326..b9da3658c1 100644 --- a/src/apps/debugger/user_interface/cli/CliContext.cpp +++ b/src/apps/debugger/user_interface/cli/CliContext.cpp @@ -381,24 +381,6 @@ CliContext::QuitSession(bool killTeam) } -void -CliContext::WaitForThreadOrUser() -{ -// TODO: Deal with SIGINT as well! - - AutoLocker locker(fLock); - - while (fStoppedThread == NULL) { - _WaitForEvent(MSG_THREAD_STATE_CHANGED); - if (fTerminating) - break; - } - - if (fCurrentThread == NULL) - SetCurrentThread(fStoppedThread); -} - - void CliContext::WaitForEvent(uint32 event) { @@ -442,7 +424,7 @@ CliContext::MessageReceived(BMessage* message) break; } case MSG_THREAD_STACK_TRACE_CHANGED: - if (threadID == fCurrentThread->ID()) { + if (fCurrentThread != NULL && threadID == fCurrentThread->ID()) { AutoLocker< ::Team> locker(fTeam); ::Thread* thread = fTeam->ThreadByID(threadID); diff --git a/src/apps/debugger/user_interface/cli/CliContext.h b/src/apps/debugger/user_interface/cli/CliContext.h index 0b6c698a15..4b7f2301f8 100644 --- a/src/apps/debugger/user_interface/cli/CliContext.h +++ b/src/apps/debugger/user_interface/cli/CliContext.h @@ -93,7 +93,6 @@ public: void QuitSession(bool killTeam); - void WaitForThreadOrUser(); void WaitForEvent(uint32 event); private: diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp index 7849f37286..2692419b3c 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp @@ -253,11 +253,6 @@ CommandLineUserInterface::_InputLoop() thread_id currentThread = -1; while (!fTerminating) { - // Wait for a thread or Ctrl-C. - fContext->WaitForThreadOrUser(); - if (fContext->IsTerminating()) - break; - // Print the active thread, if it changed. if (fContext->CurrentThreadID() != currentThread) { fContext->PrintCurrentThread();