Add "Run to cursor" context action.

- UserInterfaceListener/TeamDebugger: Extend ThreadActionRequested()
  to allow passing a target address. Adjust TeamDebugger's
  implementation accordingly.

- ThreadHandler: The MSG_THREAD_RUN action can now optionally take an
  address parameter to run until. If this is specified, set a temporary
  breakpoint for said address before resuming execution.

- SourceView: On right click, present a context menu showing possible
  actions for the current line if we're currently in a stopped thread.
  For the moment, this only yields the "Run to cursor" action, but
  more will be added in the future.
This commit is contained in:
Rene Gollent
2013-05-12 16:03:47 -04:00
parent 7a361a7a19
commit 42d73abab9
9 changed files with 164 additions and 23 deletions
@@ -37,7 +37,8 @@ enum {
STEP_NONE,
STEP_OVER,
STEP_INTO,
STEP_OUT
STEP_OUT,
STEP_UNTIL
};
@@ -124,7 +125,7 @@ ThreadHandler::HandleBreakpointHit(BreakpointHitEvent* event)
// check whether this is a temporary breakpoint we're waiting for
if (fBreakpointAddress != 0 && instructionPointer == fBreakpointAddress
&& fStepMode != STEP_NONE) {
if (_HandleBreakpointHitStep(cpuState))
if (fStepMode != STEP_UNTIL && _HandleBreakpointHitStep(cpuState))
return true;
} else {
// Might be a user breakpoint, but could as well be a temporary
@@ -199,7 +200,7 @@ ThreadHandler::HandleExceptionOccurred(ExceptionOccurredEvent* event)
void
ThreadHandler::HandleThreadAction(uint32 action)
ThreadHandler::HandleThreadAction(uint32 action, target_addr_t address)
{
AutoLocker<Team> locker(fThread->GetTeam());
@@ -230,7 +231,9 @@ ThreadHandler::HandleThreadAction(uint32 action)
switch (action) {
case MSG_THREAD_RUN:
fStepMode = STEP_NONE;
fStepMode = address != 0 ? STEP_UNTIL : STEP_NONE;
if (address != 0)
_InstallTemporaryBreakpoint(address);
_RunThread(0);
return;
case MSG_THREAD_STOP: