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

Method PostDebuggerEvent

core/debuggercontroller.cpp:1224–1271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1222
1223
1224void DebuggerController::PostDebuggerEvent(const DebuggerEvent& event)
1225{
1226 std::unique_lock<std::recursive_mutex> callbackLock(m_callbackMutex);
1227 std::list<DebuggerEventCallback> eventCallbacks = m_eventCallbacks;
1228 callbackLock.unlock();
1229
1230 if (event.type == AdapterStoppedEventType)
1231 m_lastAdapterStopEventConsumed = false;
1232
1233 ExecuteOnMainThreadAndWait([&]() {
1234 DebuggerEvent eventToSend = event;
1235 if ((eventToSend.type == TargetStoppedEventType) && !m_initialBreakpointSeen)
1236 {
1237 m_initialBreakpointSeen = true;
1238 eventToSend.data.targetStoppedData.reason = InitialBreakpoint;
1239 }
1240
1241 for (const DebuggerEventCallback& cb : eventCallbacks)
1242 {
1243 if (m_disabledCallbacks.find(cb.index) != m_disabledCallbacks.end())
1244 continue;
1245
1246 cb.function(eventToSend);
1247 }
1248
1249 // If the current event is an AdapterStoppedEvent, and it is not consumed by any callback, then the adapter
1250 // stop is not caused by the debugger core. Notify a target stop reason in this case.
1251 if (event.type == AdapterStoppedEventType && !m_lastAdapterStopEventConsumed)
1252 {
1253 DebuggerEvent stopEvent = event;
1254 stopEvent.type = TargetStoppedEventType;
1255 if (!m_initialBreakpointSeen)
1256 {
1257 m_initialBreakpointSeen = true;
1258 stopEvent.data.targetStoppedData.reason = InitialBreakpoint;
1259 }
1260 for (const DebuggerEventCallback& cb : eventCallbacks)
1261 {
1262 if (m_disabledCallbacks.find(cb.index) != m_disabledCallbacks.end())
1263 continue;
1264
1265 cb.function(stopEvent);
1266 }
1267 }
1268 });
1269
1270 CleanUpDisabledEvent();
1271}
1272
1273
1274void DebuggerController::CleanUpDisabledEvent()

Callers

nothing calls this directly

Calls 1

functionMethod · 0.80

Tested by

no test coverage detected