PrintStackTrace() public method

public PrintStackTrace ( CommandExecutionContext context, IEnumerable stackTrace ) : void
context CommandExecutionContext
stackTrace IEnumerable
return void
示例#1
0
文件: Triage.cs 项目: tiandian/msos
        private void FillFaultingThreadAndModuleInformation(CommandExecutionContext context)
        {
            UnifiedStackTraces stackTrace = new UnifiedStackTraces(_dbgEngTarget.DebuggerInterface, context);

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

            LastEventInformation lastEventInformation = _dbgEngTarget.GetLastEventInformation();

            if (lastEventInformation == null)
            {
                return;
            }

            ThreadInformation 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 UnifiedStackTraces(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 UnifiedStackTraces(target.DebuggerInterface, context);
                stackTracer.PrintStackTrace(context, (from thr in stackTracer.Threads
                                                      where thr.OSThreadId == OSThreadId
                                                      select thr.Index).Single());
            }
        }
示例#4
0
文件: Triage.cs 项目: goldshtn/msos
        private void FillFaultingThreadAndModuleInformation(CommandExecutionContext context)
        {
            UnifiedStackTraces stackTrace = new UnifiedStackTraces(_dbgEngTarget.DebuggerInterface, context);
            _triageInformation.TotalThreadCount = (int)stackTrace.NumThreads;
            _triageInformation.ManagedThreadCount = stackTrace.Threads.Count(t => t.IsManagedThread);

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

            ThreadInformation 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);
            }
        }