Skip to content

Commit

Permalink
Debugger: Adjust ThreadHandler.
Browse files Browse the repository at this point in the history
- SetBreakpointAndRun() now takes an additional argument indicating if this
  invocation is for a fresh run of a team or not, as continuing the thread's
  execution needs to be done differently in the two cases.
  • Loading branch information
anevilyak committed Jul 26, 2015
1 parent 8f21b17 commit 25c638c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/apps/debugger/controllers/ThreadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,22 @@ ThreadHandler::Init()


status_t
ThreadHandler::SetBreakpointAndRun(target_addr_t address)
ThreadHandler::SetBreakpointAndRun(target_addr_t address, bool initialStart)
{
status_t error = _InstallTemporaryBreakpoint(address);
if (error != B_OK)
return error;

fPreviousInstructionPointer = 0;
resume_thread(ThreadID());
// 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());
// Pretend "step out" mode, so that the temporary breakpoint hit will not
// be ignored.
fStepMode = STEP_OUT;
Expand Down
3 changes: 2 additions & 1 deletion src/apps/debugger/controllers/ThreadHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class ThreadHandler : public BReferenceable, private ImageDebugInfoProvider,
thread_id ThreadID() const { return fThread->ID(); }
Thread* GetThread() const { return fThread; }

status_t SetBreakpointAndRun(target_addr_t address);
status_t SetBreakpointAndRun(target_addr_t address,
bool initialStart = true);
// team lock held

// All Handle*() methods are invoked in team debugger thread,
Expand Down

0 comments on commit 25c638c

Please sign in to comment.