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 <team> actually work instead of just
hanging.
This commit is contained in:
Augustin Cavalier
2025-11-18 18:45:06 -05:00
parent f4415c8657
commit 2661f371fb
3 changed files with 1 additions and 25 deletions
@@ -381,24 +381,6 @@ CliContext::QuitSession(bool killTeam)
}
void
CliContext::WaitForThreadOrUser()
{
// TODO: Deal with SIGINT as well!
AutoLocker<BLocker> 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);
@@ -93,7 +93,6 @@ public:
void QuitSession(bool killTeam);
void WaitForThreadOrUser();
void WaitForEvent(uint32 event);
private:
@@ -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();