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

Method StopReason

core/adapters/lldbadapter.cpp:998–1057  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

996
997
998DebugStopReason LldbAdapter::StopReason()
999{
1000 StateType state = m_process.GetState();
1001 if (state == lldb::eStateExited)
1002 {
1003 LogWarn("target exited");
1004 return DebugStopReason::ProcessExited;
1005 }
1006
1007 if (state == lldb::eStateStopped)
1008 {
1009 // Check all threads to find a valid stop reason
1010 DebugStopReason reason = UnknownReason;
1011 size_t numThreads = m_process.GetNumThreads();
1012 for (size_t i = 0; i < numThreads; i++)
1013 {
1014 SBThread thread = m_process.GetThreadAtIndex(i);
1015 lldb::StopReason threadReason = thread.GetStopReason();
1016 if (threadReason == lldb::eStopReasonBreakpoint)
1017 {
1018 reason = DebugStopReason::Breakpoint;
1019 }
1020 else if (threadReason == lldb::eStopReasonSignal)
1021 {
1022 size_t dataCount = thread.GetStopReasonDataCount();
1023 if (dataCount > 0)
1024 {
1025 uint64_t signal = thread.GetStopReasonDataAtIndex(0);
1026 reason = GetStopReasonFromLinuxSignal(signal);
1027 }
1028 }
1029 else if (threadReason == lldb::eStopReasonException)
1030 {
1031 char buffer[1024];
1032 thread.GetStopDescription(buffer, 1024);
1033 std::string exceptionString(buffer);
1034 std::string triple = m_target.GetTriple();
1035 if (triple.find("windows") != std::string::npos)
1036 {
1037 reason = GetWindowsStopReasonFromExceptionDescription(exceptionString);
1038 }
1039 else
1040 {
1041 reason = GetUnixStopReasonFromExceptionDescription(exceptionString);
1042 }
1043 }
1044 else if (threadReason == lldb::eStopReasonPlanComplete)
1045 {
1046 // The last planned operation completed, nothing unexpected happened
1047 // Directly return DebugStopReason::SingleStep here. Because stepping (into/over) is the only way
1048 // that a lldb::eStopReasonPlanComplete could be triggered. The situation might change in the future
1049 reason = DebugStopReason::SingleStep;
1050 }
1051
1052 if (reason != DebugStopReason::UnknownReason)
1053 return reason;
1054 }
1055 }

Callers

nothing calls this directly

Tested by

no test coverage detected