Add MSG_THREAD_SET_ADDRESS and implement handling.
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
MSG_THREAD_RUN = 'run_',
|
MSG_THREAD_RUN = 'run_',
|
||||||
|
MSG_THREAD_SET_ADDRESS = 'sead',
|
||||||
MSG_THREAD_STOP = 'stop',
|
MSG_THREAD_STOP = 'stop',
|
||||||
MSG_THREAD_STEP_OVER = 'stov',
|
MSG_THREAD_STEP_OVER = 'stov',
|
||||||
MSG_THREAD_STEP_INTO = 'stin',
|
MSG_THREAD_STEP_INTO = 'stin',
|
||||||
|
|||||||
@@ -530,6 +530,7 @@ TeamDebugger::MessageReceived(BMessage* message)
|
|||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case MSG_THREAD_RUN:
|
case MSG_THREAD_RUN:
|
||||||
|
case MSG_THREAD_SET_ADDRESS:
|
||||||
case MSG_THREAD_STOP:
|
case MSG_THREAD_STOP:
|
||||||
case MSG_THREAD_STEP_OVER:
|
case MSG_THREAD_STEP_OVER:
|
||||||
case MSG_THREAD_STEP_INTO:
|
case MSG_THREAD_STEP_INTO:
|
||||||
|
|||||||
@@ -220,6 +220,11 @@ ThreadHandler::HandleThreadAction(uint32 action, target_addr_t address)
|
|||||||
BReference<CpuState> cpuStateReference(cpuState);
|
BReference<CpuState> cpuStateReference(cpuState);
|
||||||
BReference<StackTrace> stackTraceReference(stackTrace);
|
BReference<StackTrace> stackTraceReference(stackTrace);
|
||||||
|
|
||||||
|
if (action == MSG_THREAD_SET_ADDRESS) {
|
||||||
|
_HandleSetAddress(cpuState, address);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// When continuing the thread update thread state before actually issuing
|
// When continuing the thread update thread state before actually issuing
|
||||||
// the command, since we need to unlock.
|
// the command, since we need to unlock.
|
||||||
if (action != MSG_THREAD_STOP) {
|
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
|
void
|
||||||
ThreadHandler::_SetThreadState(uint32 state, CpuState* cpuState,
|
ThreadHandler::_SetThreadState(uint32 state, CpuState* cpuState,
|
||||||
uint32 stoppedReason, const BString& stoppedReasonInfo)
|
uint32 stoppedReason, const BString& stoppedReasonInfo)
|
||||||
|
|||||||
@@ -70,6 +70,9 @@ private:
|
|||||||
const BString& stoppedReasonInfo
|
const BString& stoppedReasonInfo
|
||||||
= BString());
|
= BString());
|
||||||
|
|
||||||
|
bool _HandleSetAddress(CpuState* cpuState,
|
||||||
|
target_addr_t address);
|
||||||
|
|
||||||
void _SetThreadState(uint32 state,
|
void _SetThreadState(uint32 state,
|
||||||
CpuState* cpuState, uint32 stoppedReason,
|
CpuState* cpuState, uint32 stoppedReason,
|
||||||
const BString& stoppedReasonInfo);
|
const BString& stoppedReasonInfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user