KdpTrap

UINT8 __stdcall KdpTrap(
        _KTRAP_FRAME *TrapFrame,
        _KTRAP_FRAME *ExceptionFrame,
        _EXCEPTION_RECORD *ExceptionRecord,
        _CONTEXT *ContextRecord,
        INT8 PreviousMode,
        UINT8 SecondChance,
        INT64 a7){
  UINT8 v7; 
  bool v9; 
  unsigned __int64 v10; 
  unsigned __int64 Rip; 
  int v12; 
  int v13; 
  int v14; 
  int v15; 
  NTSTATUS v16; 
  unsigned __int64 v17; 
  UINT8 v18; 
  _CONTEXT *ContextRecorda; 
  UINT8 Completion; 

  v7 = 0;
  v9 = ExceptionRecord->ExceptionCode == -2147483645;
  Completion = 0;
  if( !v9 || (v10 = ExceptionRecord->ExceptionInformation[0]) == 0 )
  {
    KdpReport(
      TrapFrame,
      (_KEXCEPTION_FRAME *)ExceptionFrame,
      ExceptionRecord,
      ContextRecord,
      (CHAR)ContextRecorda,
      SecondChance);
    return v18;
  }
  Rip = ContextRecord->_Rip;
  if( v10 <= 5 )
  {
    v12 = v10 - 1;
    if( v12 )
    {
      v13 = v12 - 1;
      if( v13 )
      {
        v14 = v13 - 1;
        if( v14 )
        {
          v15 = v14 - 1;
          if( v15 )
          {
            if( v15 != 1 )
              goto LABEL_15;
            KdpCommandString(
              (_STRING *)ContextRecord->_Rcx,
              (_STRING *)ContextRecord->_Rdx,
              PreviousMode,
              ContextRecord,
              TrapFrame,
              ExceptionFrame);
            goto LABEL_13;
          }
          v7 = 1;
        }
        KdpSymbol(
          (_STRING *)ContextRecord->_Rcx,
          (_KD_SYMBOLS_INFO *)ContextRecord->_Rdx,
          v7,
          PreviousMode,
          ContextRecord,
          TrapFrame,
          ExceptionFrame);
      }
      else
      {
        ContextRecord->_Rax = KdpPrompt(
                                (PSTR)ContextRecord->_Rcx,
                                ContextRecord->_Rdx,
                                (PSTR)ContextRecord->_R8,
                                ContextRecord->_R9,
                                PreviousMode,
                                TrapFrame,
                                ExceptionFrame);
      }
LABEL_13:
      v7 = 1;
      goto LABEL_15;
    }
    LOBYTE(ContextRecorda) = PreviousMode;
    v16 = KdpPrint(
            LODWORD(ContextRecord->_R8),
            LODWORD(ContextRecord->_R9),
            (INT8 *)ContextRecord->_Rcx,
            LOWORD(ContextRecord->_Rdx),
            (INT64)ContextRecorda,
            TrapFrame,
            ExceptionFrame,
            &Completion);
    v7 = Completion;
    ContextRecord->_Rax = v16;
  }
LABEL_15:
  v17 = ContextRecord->_Rip;
  if( v17 == Rip )
    ContextRecord->_Rip = v17 + 1;
  return v7;
}

Referenced by:

KdTrap
KdpStub