| 369 | } |
| 370 | |
| 371 | void cmDebuggerAdapter::OnBeginFunctionCall(cmMakefile* mf, |
| 372 | std::string const& sourcePath, |
| 373 | cmListFileFunction const& lff) |
| 374 | { |
| 375 | std::unique_lock<std::mutex> lock(Mutex); |
| 376 | DefaultThread->PushStackFrame(mf, sourcePath, lff); |
| 377 | |
| 378 | if (lff.Line() == 0) { |
| 379 | // File just loaded, continue to first valid function call. |
| 380 | return; |
| 381 | } |
| 382 | |
| 383 | auto hits = BreakpointManager->GetBreakpoints(sourcePath, lff.Line()); |
| 384 | lock.unlock(); |
| 385 | |
| 386 | bool waitSem = false; |
| 387 | dap::StoppedEvent stoppedEvent; |
| 388 | stoppedEvent.allThreadsStopped = true; |
| 389 | stoppedEvent.threadId = DefaultThread->GetId(); |
| 390 | if (!hits.empty()) { |
| 391 | ClearStepRequests(); |
| 392 | waitSem = true; |
| 393 | |
| 394 | dap::array<dap::integer> hitBreakpoints; |
| 395 | hitBreakpoints.resize(hits.size()); |
| 396 | std::transform(hits.begin(), hits.end(), hitBreakpoints.begin(), |
| 397 | [&](int64_t id) { return dap::integer(id); }); |
| 398 | stoppedEvent.reason = "breakpoint"; |
| 399 | stoppedEvent.hitBreakpointIds = hitBreakpoints; |
| 400 | } |
| 401 | |
| 402 | if (long(DefaultThread->GetStackFrameSize()) <= NextStepFrom.load() || |
| 403 | StepInRequest.load() || |
| 404 | long(DefaultThread->GetStackFrameSize()) <= StepOutDepth.load()) { |
| 405 | ClearStepRequests(); |
| 406 | waitSem = true; |
| 407 | |
| 408 | stoppedEvent.reason = "step"; |
| 409 | } |
| 410 | |
| 411 | if (PauseRequest.load()) { |
| 412 | ClearStepRequests(); |
| 413 | waitSem = true; |
| 414 | |
| 415 | stoppedEvent.reason = "pause"; |
| 416 | } |
| 417 | |
| 418 | if (waitSem) { |
| 419 | Session->send(stoppedEvent); |
| 420 | ContinueSem->Wait(); |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | void cmDebuggerAdapter::OnEndFunctionCall() |
| 425 | { |
no test coverage detected