private DataTarget CreateDbgEngDataTargetImpl() { if (String.IsNullOrEmpty(DumpFile)) { throw new InvalidOperationException("DbgEng targets can be created only for dump files at this point."); } var target = DataTarget.LoadCrashDump(DumpFile, CrashDumpReader.DbgEng); target.AppendSymbolPath(SymbolPath); var outputCallbacks = new OutputCallbacks(this); msos_IDebugClient5 client = (msos_IDebugClient5)target.DebuggerInterface; HR.Verify(client.SetOutputCallbacksWide(outputCallbacks)); return(target); }
private void ProcessStackWalk(uint osThreadId) { IXCLRDataProcess ixclrDataProcess = _context.Runtime.DacInterface; object tmp; HR.Verify(ixclrDataProcess.GetTaskByOSThreadID(osThreadId, out tmp)); IXCLRDataTask task = (IXCLRDataTask)tmp; HR.Verify(task.CreateStackWalk(0xf /*all flags*/, out tmp)); IXCLRDataStackWalk stackWalk = (IXCLRDataStackWalk)tmp; while (HR.S_OK == stackWalk.Next()) { ProcessFrame(stackWalk); } }
private ulong GetStacksSize(DataTarget target) { // Find all the TEBs and then sum StackBase - StackLimit for all of them. // This gives us the committed size for each thread, but we don't have the // reserved size (which is the actual address space consumed). Theoretically, // we could get it from enumerating the memory region adjacent to the committed // pages and the guard page that follows. Also, for WoW64 threads, we are only // reporting the x86 stack (the x64 stack doesn't live in the 4GB address space // anyway, so it's not that relevant). IDebugSystemObjects sysObjects = (IDebugSystemObjects)target.DebuggerInterface; uint numThreads; HR.Verify(sysObjects.GetNumberThreads(out numThreads)); ulong totalCommit = 0; for (uint i = 0; i < numThreads; ++i) { HR.Verify(sysObjects.SetCurrentThreadId(i)); ulong tebAddress; HR.Verify(sysObjects.GetCurrentThreadTeb(out tebAddress)); int read; byte[] teb = new byte[IntPtr.Size * 3]; // ExceptionList, StackBase, StackLimit if (target.ReadProcessMemory(tebAddress, teb, teb.Length, out read) && read == teb.Length) { ulong stackBase = AddressFromBytes(teb, IntPtr.Size); ulong stackLimit = AddressFromBytes(teb, IntPtr.Size * 2); totalCommit = stackBase - stackLimit; } } return(totalCommit); }
private DataTarget CreateDbgEngDataTargetImpl() { if (String.IsNullOrEmpty(DumpFile)) { throw new InvalidOperationException("DbgEng targets can be created only for dump files at this point."); } var target = DataTarget.LoadCrashDump(DumpFile, CrashDumpReader.DbgEng); target.SymbolLocator.SymbolPath = SymbolPath; ((IDebugSymbols)target.DebuggerInterface).SetSymbolPath(SymbolPath); if (DisplayDiagnosticInformation) { ((IDebugControl)target.DebuggerInterface).Execute(DEBUG_OUTCTL.NOT_LOGGED, "!sym noisy", DEBUG_EXECUTE.NOT_LOGGED); } ((IDebugControl)target.DebuggerInterface).Execute(DEBUG_OUTCTL.NOT_LOGGED, ".reload", DEBUG_EXECUTE.NOT_LOGGED); var outputCallbacks = new OutputCallbacks(this); IDebugClient5 client = (IDebugClient5)target.DebuggerInterface; HR.Verify(client.SetOutputCallbacksWide(outputCallbacks)); return(target); }