MCPcopy Create free account
hub / github.com/Vector35/debugger / StopReason

Method StopReason

core/adapters/dbgengadapter.cpp:1183–1223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1181}
1182
1183DebugStopReason DbgEngAdapter::StopReason()
1184{
1185 const auto exec_status = this->ExecStatus();
1186 if (exec_status == DEBUG_STATUS_BREAK)
1187 {
1188 const auto instruction_ptr = this->ReadRegister(this->GetTargetArchitecture() == "x86" ? "eip" : "rip").m_value;
1189
1190 if (instruction_ptr == DbgEngAdapter::ProcessCallbackInfo.m_lastBreakpoint.m_address)
1191 return DebugStopReason::Breakpoint;
1192
1193 const auto& last_exception = DbgEngAdapter::ProcessCallbackInfo.m_lastException;
1194 if (instruction_ptr == last_exception.ExceptionAddress)
1195 {
1196 switch (last_exception.ExceptionCode)
1197 {
1198 case STATUS_BREAKPOINT:
1199 case STATUS_WX86_BREAKPOINT:
1200 return DebugStopReason::Breakpoint;
1201 case STATUS_SINGLE_STEP:
1202 case STATUS_WX86_SINGLE_STEP:
1203 return DebugStopReason::SingleStep;
1204 case STATUS_ACCESS_VIOLATION:
1205 return DebugStopReason::AccessViolation;
1206 case STATUS_INTEGER_DIVIDE_BY_ZERO:
1207 case STATUS_FLOAT_DIVIDE_BY_ZERO:
1208 return DebugStopReason::Calculation;
1209 default:
1210 return DebugStopReason::UnknownReason;
1211 }
1212 }
1213
1214 if (m_lastOperationIsStepInto)
1215 return DebugStopReason::SingleStep;
1216 }
1217 else if (exec_status == DEBUG_STATUS_NO_DEBUGGEE)
1218 {
1219 return DebugStopReason::ProcessExited;
1220 }
1221
1222 return DebugStopReason::UnknownReason;
1223}
1224
1225unsigned long DbgEngAdapter::ExecStatus()
1226{

Callers

nothing calls this directly

Calls 3

ExecStatusMethod · 0.95
ReadRegisterMethod · 0.95
GetTargetArchitectureMethod · 0.95

Tested by

no test coverage detected