Add MSG_THREAD_SET_ADDRESS and implement handling.

This commit is contained in:
Rene Gollent
2013-05-16 22:22:47 -04:00
parent fe3e87c2a8
commit 93b54e54a4
4 changed files with 30 additions and 0 deletions
@@ -220,6 +220,11 @@ ThreadHandler::HandleThreadAction(uint32 action, target_addr_t address)
BReference<CpuState> cpuStateReference(cpuState);
BReference<StackTrace> stackTraceReference(stackTrace);
if (action == MSG_THREAD_SET_ADDRESS) {
_HandleSetAddress(cpuState, address);
return;
}
// When continuing the thread update thread state before actually issuing
// the command, since we need to unlock.
if (action != MSG_THREAD_STOP) {
@@ -412,6 +417,26 @@ ThreadHandler::_HandleThreadStopped(CpuState* cpuState, uint32 stoppedReason,
}
bool
ThreadHandler::_HandleSetAddress(CpuState* state, target_addr_t address)
{
CpuState* newState = NULL;
if (state->Clone(newState) != B_OK)
return false;
BReference<CpuState> stateReference(newState, true);
newState->SetInstructionPointer(address);
if (fDebuggerInterface->SetCpuState(fThread->ID(), newState) != B_OK)
return false;
AutoLocker<Team> locker(fThread->GetTeam());
fThread->SetStackTrace(NULL);
fThread->SetCpuState(newState);
return true;
}
void
ThreadHandler::_SetThreadState(uint32 state, CpuState* cpuState,
uint32 stoppedReason, const BString& stoppedReasonInfo)