| 447 | |
| 448 | |
| 449 | void DbgEngAdapter::EngineLoop() |
| 450 | { |
| 451 | auto settings = Settings::Instance(); |
| 452 | bool outputStateOnStop = settings->Get<bool>("debugger.dbgEngOutputStateOnStop"); |
| 453 | |
| 454 | m_lastExecutionStatus = DEBUG_STATUS_NO_DEBUGGEE; |
| 455 | bool finished = false; |
| 456 | while (true) |
| 457 | { |
| 458 | if (finished) |
| 459 | break; |
| 460 | |
| 461 | //Wait(); |
| 462 | unsigned long execution_status {}; |
| 463 | while (true) |
| 464 | { |
| 465 | if (this->m_debugControl->GetExecutionStatus(&execution_status) != S_OK) |
| 466 | {} |
| 467 | |
| 468 | if (execution_status == DEBUG_STATUS_BREAK) |
| 469 | { |
| 470 | if (m_lastExecutionStatus != DEBUG_STATUS_BREAK) |
| 471 | { |
| 472 | if (outputStateOnStop) |
| 473 | { |
| 474 | // m_debugRegisters->OutputRegisters(DEBUG_OUTCTL_THIS_CLIENT, DEBUG_REGISTERS_DEFAULT); |
| 475 | m_debugControl->OutputCurrentState(DEBUG_OUTCTL_THIS_CLIENT, DEBUG_CURRENT_DEFAULT); |
| 476 | } |
| 477 | DebuggerEvent event; |
| 478 | event.type = AdapterStoppedEventType; |
| 479 | event.data.targetStoppedData.reason = StopReason(); |
| 480 | PostDebuggerEvent(event); |
| 481 | } |
| 482 | |
| 483 | // This is NOT actually dispatching callback, since the callbacks are already dispatched in |
| 484 | // WaitForEvent(). The real purpose of this call is to wait until the UI/API initiates another control |
| 485 | // operation, which then calls ExitDispatch(), which causes the DispatchCallbacks() to return. |
| 486 | m_debugClient->DispatchCallbacks(INFINITE); |
| 487 | } |
| 488 | // TODO: add step branch and step backs |
| 489 | else if ((execution_status == DEBUG_STATUS_GO) || (execution_status == DEBUG_STATUS_STEP_INTO) |
| 490 | || (execution_status == DEBUG_STATUS_STEP_OVER) || (execution_status == DEBUG_STATUS_GO_HANDLED) |
| 491 | || (execution_status == DEBUG_STATUS_STEP_BRANCH) |
| 492 | || (execution_status == DEBUG_STATUS_GO_NOT_HANDLED) || (execution_status == DEBUG_STATUS_REVERSE_GO) |
| 493 | || (execution_status == DEBUG_STATUS_REVERSE_STEP_OVER) |
| 494 | || (execution_status == DEBUG_STATUS_REVERSE_STEP_INTO) |
| 495 | || (execution_status == DEBUG_STATUS_REVERSE_STEP_BRANCH)) |
| 496 | { |
| 497 | DebuggerEvent dbgevt; |
| 498 | if ((execution_status == DEBUG_STATUS_GO) || (execution_status == DEBUG_STATUS_REVERSE_GO) |
| 499 | || ((execution_status == DEBUG_STATUS_GO_HANDLED)) |
| 500 | || (execution_status == DEBUG_STATUS_GO_NOT_HANDLED)) |
| 501 | { |
| 502 | dbgevt.type = ResumeEventType; |
| 503 | PostDebuggerEvent(dbgevt); |
| 504 | } |
| 505 | else if ((execution_status == DEBUG_STATUS_STEP_INTO) || (execution_status == DEBUG_STATUS_STEP_OVER) |
| 506 | || (execution_status == DEBUG_STATUS_STEP_BRANCH) |
nothing calls this directly
no test coverage detected