KdpSetCommonState

VOID __stdcall KdpSetCommonState(
        UINT64 NewState,
        _CONTEXT *ContextRecord,
        _DBGKD_ANY_WAIT_STATE_CHANGE *WaitStateChange){
  unsigned __int16 v4; 
  unsigned int ActiveProcessorCount; 
  unsigned int Processor; 
  char *Rip; 
  __int64 v9; 
  UINT64 Flags; 
  UINT64 Flagsa; 
  UINT64 TotalSize; 

  LODWORD(TotalSize) = 0;
  v4 = KeProcessorLevel;
  WaitStateChange->NewState = NewState;
  WaitStateChange->ProcessorLevel = v4;
  WaitStateChange->Processor = KeGetPcr()->Prcb.Number;
  ActiveProcessorCount = KeQueryActiveProcessorCountEx(0xFFFFu);
  Processor = WaitStateChange->Processor;
  WaitStateChange->NumberProcessors = ActiveProcessorCount;
  if( ActiveProcessorCount <= Processor )
    WaitStateChange->NumberProcessors = Processor + 1;
  WaitStateChange->Thread = (unsigned __int64)KeGetCurrentThread();
  Rip = (char *)ContextRecord->_Rip;
  WaitStateChange->ProgramCounter = (unsigned __int64)Rip;
  *(_OWORD *)&WaitStateChange->ControlReport.Dr6 = 0i64;
  *(_OWORD *)&WaitStateChange->AnyControlReport.PpcControlReport.InstructionStream[12] = 0i64;
  LODWORD(Flags) = 4;
  *(_OWORD *)&WaitStateChange->AnyControlReport.PpcControlReport.Lr = 0i64;
  KdpCopyMemoryChunks(
    (UINT64)Rip,
    &WaitStateChange->AnyControlReport.PpcControlReport.Ctr,
    0x10ui64,
    0i64,
    Flags,
    &TotalSize);
  v9 = (unsigned int)TotalSize;
  WaitStateChange->AnyControlReport.Amd64ControlReport.InstructionCount = TotalSize;
  if( KdpDeleteBreakpointRange(Rip, &Rip[v9 - 1]) )
  {
    LODWORD(Flagsa) = 4;
    KdpCopyMemoryChunks(
      (UINT64)Rip,
      &WaitStateChange->AnyControlReport.PpcControlReport.Ctr,
      (unsigned int)v9,
      0i64,
      Flagsa,
      &TotalSize);
  }
}

Referenced by:

KdpReportCommandStringStateChange
KdpReportExceptionStateChange
KdpReportLoadSymbolsStateChange