Пример #1
0
        private void FillFaultingThreadAndModuleInformation(CommandExecutionContext context)
        {
            UnifiedStackTrace stackTrace = new UnifiedStackTrace(_dbgEngTarget.DebuggerInterface, context);

            _triageInformation.TotalThreadCount   = (int)stackTrace.NumThreads;
            _triageInformation.ManagedThreadCount = stackTrace.Threads.Count(t => t.IsManagedThread);

            LastEventInformation lastEventInformation = _dbgEngTarget.GetLastEventInformation();

            if (lastEventInformation == null)
            {
                return;
            }

            ThreadInfo faultingThread = stackTrace.Threads.SingleOrDefault(t => t.OSThreadId == lastEventInformation.OSThreadId);

            if (faultingThread == null)
            {
                return;
            }

            _triageInformation.FaultingThreadOSID      = faultingThread.OSThreadId;
            _triageInformation.IsFaultingThreadManaged = faultingThread.IsManagedThread;
            _triageInformation.EventDescription        = lastEventInformation.EventDescription;

            if (lastEventInformation.ExceptionRecord.HasValue)
            {
                _triageInformation.ExceptionCode = lastEventInformation.ExceptionRecord.Value.ExceptionCode;
            }
            if (faultingThread.IsManagedThread && faultingThread.ManagedThread.CurrentException != null)
            {
                _triageInformation.ManagedExceptionType = faultingThread.ManagedThread.CurrentException.Type.Name;
            }

            var frames = stackTrace.GetStackTrace(faultingThread.Index);

            UnifiedStackFrame faultingFrame = frames.FirstOrDefault(f => f.Module != null && !WellKnownMicrosoftModules.Contains(f.Module));

            if (faultingFrame != null)
            {
                _triageInformation.FaultingModule = faultingFrame.Module;
                _triageInformation.FaultingMethod = faultingFrame.Method;
            }

            if (ShowFaultingStack)
            {
                context.WriteLine("Faulting call stack:");
                stackTrace.PrintStackTrace(context, frames);
            }
        }
Пример #2
0
        public void Execute(CommandExecutionContext context)
        {
            if (OSThreadId == 0)
            {
                OSThreadId = context.CurrentThread.OSThreadId;
            }

            context.WriteLine("{0,-10} {1,-20} {2}", "Type", "IP", "Function");
            using (var target = context.CreateTemporaryDbgEngTarget())
            {
                var stackTracer = new UnifiedStackTrace(target.DebuggerInterface, context);
                stackTracer.PrintStackTrace(context, (from thr in stackTracer.Threads
                                                      where thr.OSThreadId == OSThreadId
                                                      select thr.Index).Single());
            }
        }
Пример #3
0
        public void Execute(CommandExecutionContext context)
        {
            if (OSThreadId == 0)
            {
                OSThreadId = context.CurrentThread.OSThreadId;
            }

            context.WriteLine("{0,-10} {1,-20} {2}", "Type", "IP", "Function");
            using (var target = context.CreateTemporaryDbgEngTarget())
            {
                var stackTracer = new UnifiedStackTrace(target.DebuggerInterface, context);
                stackTracer.PrintStackTrace(context, (from thr in stackTracer.Threads
                                                      where thr.OSThreadId == OSThreadId
                                                      select thr.Index).Single());
            }
        }
Пример #4
0
        private void FillFaultingThreadAndModuleInformation(CommandExecutionContext context)
        {
            UnifiedStackTrace stackTrace = new UnifiedStackTrace(_dbgEngTarget.DebuggerInterface, context);
            _triageInformation.TotalThreadCount = (int)stackTrace.NumThreads;
            _triageInformation.ManagedThreadCount = stackTrace.Threads.Count(t => t.IsManagedThread);

            LastEventInformation lastEventInformation = _dbgEngTarget.GetLastEventInformation();
            if (lastEventInformation == null)
                return;

            ThreadInfo faultingThread = stackTrace.Threads.SingleOrDefault(t => t.OSThreadId == lastEventInformation.OSThreadId);
            if (faultingThread == null)
                return;

            _triageInformation.FaultingThreadOSID = faultingThread.OSThreadId;
            _triageInformation.IsFaultingThreadManaged = faultingThread.IsManagedThread;
            _triageInformation.EventDescription = lastEventInformation.EventDescription;

            if (lastEventInformation.ExceptionRecord.HasValue)
            {
                _triageInformation.ExceptionCode = lastEventInformation.ExceptionRecord.Value.ExceptionCode;
            }
            if (faultingThread.IsManagedThread && faultingThread.ManagedThread.CurrentException != null)
            {
                _triageInformation.ManagedExceptionType = faultingThread.ManagedThread.CurrentException.Type.Name;
            }

            var frames = stackTrace.GetStackTrace(faultingThread.Index);

            UnifiedStackFrame faultingFrame = frames.FirstOrDefault(f => f.Module != null && !WellKnownMicrosoftModules.Contains(f.Module));
            if (faultingFrame != null)
            {
                _triageInformation.FaultingModule = faultingFrame.Module;
                _triageInformation.FaultingMethod = faultingFrame.Method;
            }

            if (ShowFaultingStack)
            {
                context.WriteLine("Faulting call stack:");
                stackTrace.PrintStackTrace(context, frames);
            }
        }