From 5e95945071412193742fae1bb8023f6d4806e735 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 29 Jul 2015 22:31:08 -0400 Subject: [PATCH] Debugger: Cleanup. ThreadHandler: - Simplify SetBreakpointAndRun() to always use the debugger interface to continue execution, since the latter is now intelligent enough to determine how to handle that in all cases. Adjust callers accordingly. --- src/apps/debugger/controllers/TeamDebugger.cpp | 2 +- src/apps/debugger/controllers/ThreadHandler.cpp | 13 +++---------- src/apps/debugger/controllers/ThreadHandler.h | 3 +-- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/apps/debugger/controllers/TeamDebugger.cpp b/src/apps/debugger/controllers/TeamDebugger.cpp index 5bea9ee558..352b7d11f0 100644 --- a/src/apps/debugger/controllers/TeamDebugger.cpp +++ b/src/apps/debugger/controllers/TeamDebugger.cpp @@ -1962,7 +1962,7 @@ TeamDebugger::_HandleImageDebugInfoChanged(image_id imageID) SymbolInfo symbolInfo; if (fDebuggerInterface->GetSymbolInfo(fTeam->ID(), image->ID(), "main", B_SYMBOL_TYPE_TEXT, symbolInfo) == B_OK) { - handler->SetBreakpointAndRun(symbolInfo.Address(), false); + handler->SetBreakpointAndRun(symbolInfo.Address()); } } else { locker.Unlock(); diff --git a/src/apps/debugger/controllers/ThreadHandler.cpp b/src/apps/debugger/controllers/ThreadHandler.cpp index 361f6575c5..999a6b0d12 100644 --- a/src/apps/debugger/controllers/ThreadHandler.cpp +++ b/src/apps/debugger/controllers/ThreadHandler.cpp @@ -119,22 +119,15 @@ ThreadHandler::Init() status_t -ThreadHandler::SetBreakpointAndRun(target_addr_t address, bool initialStart) +ThreadHandler::SetBreakpointAndRun(target_addr_t address) { status_t error = _InstallTemporaryBreakpoint(address); if (error != B_OK) return error; fPreviousInstructionPointer = 0; - // when the program is first run, the initial thread is not yet under - // the control of the debug nub, so it needs to be resumed rather than - // continued. - if (initialStart) { - resume_thread(ThreadID()); - // TODO: This should probably better be a DebuggerInterface method, - // but this method is used only when debugging a local team anyway. - } else - fDebuggerInterface->ContinueThread(ThreadID()); + fDebuggerInterface->ContinueThread(ThreadID()); + // Pretend "step out" mode, so that the temporary breakpoint hit will not // be ignored. fStepMode = STEP_OUT; diff --git a/src/apps/debugger/controllers/ThreadHandler.h b/src/apps/debugger/controllers/ThreadHandler.h index b0b4cdd7c1..432eac1e9f 100644 --- a/src/apps/debugger/controllers/ThreadHandler.h +++ b/src/apps/debugger/controllers/ThreadHandler.h @@ -39,8 +39,7 @@ public: thread_id ThreadID() const { return fThread->ID(); } Thread* GetThread() const { return fThread; } - status_t SetBreakpointAndRun(target_addr_t address, - bool initialStart = true); + status_t SetBreakpointAndRun(target_addr_t address); // team lock held // All Handle*() methods are invoked in team debugger thread,