예제 #1
0
void EventHook::onFunctionSuspend(const ActRec* ar, bool suspendingResumed) {
  // TODO(#2329497) can't CheckSurprise() yet, unwinder frees suspended locals
  ssize_t flags = GetConditionFlags();
  onFunctionExit(ar, nullptr, nullptr, flags);

  // Async profiler
  if ((flags & RequestInjectionData::AsyncEventHookFlag) &&
      ar->func()->isAsyncFunction()) {
    assert(ar->resumed());
    auto afwh = frame_afwh(ar);
    auto session = AsioSession::Get();
    // Blocking await @ eager execution => AsyncFunctionWaitHandle created.
    if (!suspendingResumed && session->hasOnResumableCreateCallback()) {
      session->onResumableCreate(afwh, afwh->getChild());
    }
    // Blocking await @ resumed execution => AsyncFunctionWaitHandle awaiting.
    if (suspendingResumed && session->hasOnResumableAwaitCallback()) {
      session->onResumableAwait(afwh, afwh->getChild());
    }
  }
}
예제 #2
0
void EventHook::onFunctionUnwind(const ActRec* ar, const Fault& fault) {
  // TODO(#2329497) can't CheckSurprise() yet, unwinder unable to replace fault
  ssize_t flags = GetConditionFlags();
  onFunctionExit(ar, nullptr, &fault, flags);
}