diff --git a/src/apps/debugger/controllers/TeamDebugger.cpp b/src/apps/debugger/controllers/TeamDebugger.cpp index 7885590568..d1a7780264 100644 --- a/src/apps/debugger/controllers/TeamDebugger.cpp +++ b/src/apps/debugger/controllers/TeamDebugger.cpp @@ -1270,6 +1270,18 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) TRACE_EVENTS("B_DEBUGGER_MESSAGE_POST_SYSCALL: syscall: %" B_PRIu32 "\n", postSyscallEvent->GetSyscallInfo().Syscall()); handled = _HandlePostSyscall(postSyscallEvent); + + // if a thread was blocked in a syscall when we requested to + // stop it for debugging, then that request will interrupt + // said call, and the post syscall event will be all we get + // in response. Consequently, we need to treat this case as + // equivalent to having received a thread debugged event. + AutoLocker< ::Team> teamLocker(fTeam); + ::Thread* thread = fTeam->ThreadByID(event->Thread()); + if (handler != NULL && thread != NULL + && thread->StopRequestPending()) { + handled = handler->HandleThreadDebugged(NULL); + } break; } case B_DEBUGGER_MESSAGE_PRE_SYSCALL: diff --git a/src/apps/debugger/controllers/ThreadHandler.cpp b/src/apps/debugger/controllers/ThreadHandler.cpp index 2a84a5b444..b0525ae5a5 100644 --- a/src/apps/debugger/controllers/ThreadHandler.cpp +++ b/src/apps/debugger/controllers/ThreadHandler.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2010-2011, Rene Gollent, rene@gollent.com. + * Copyright 2010-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -243,7 +243,8 @@ ThreadHandler::HandleThreadAction(uint32 action, target_addr_t address) return; case MSG_THREAD_STOP: fStepMode = STEP_NONE; - fDebuggerInterface->StopThread(ThreadID()); + if (fDebuggerInterface->StopThread(ThreadID()) == B_OK) + fThread->SetStopRequestPending(); return; case MSG_THREAD_STEP_OVER: case MSG_THREAD_STEP_INTO: