windbg

How to get thread stack information on Windows?

你离开我真会死。 提交于 2019-11-28 23:53:30
I enumerate all threads in a process through the CreateToolhelp32Snapshot function. I would like to get some basic stack information for each thread. More specifically I would like to get stack bottom address and if possible I would like to get current stack top address. Basically this is the information displayed with the ~*k command in WinDbg. So how can I obtain the stack information from the thread's ID or HANDLE? (Definitions can be found here .) To get stack boundaries: THREAD_BASIC_INFORMATION basicInfo; NT_TIB tib; // Get TEB address NtQueryInformationThread(YOUR_THREAD_HANDLE,

Set up WinDbg as the default debugger

本小妞迷上赌 提交于 2019-11-28 23:39:08
Whenever my application throws an unhandled exception, I would like WinDbg to catch that exception on my debugging machine rather than Dr. Watson , etc. How can this be configured? Run windbg -I to install it at the default post mortem debugger. As Kurt points out below WinDbg comes in both 32 and 64 bit versions. Executing windbg -I sets up the post mortem debugger for the processes corresponding to the bitness of the debugger. You can install both versions of WinDbg side-by-side if you need to have both the 32 and 64 bit versions available. From the help file: -I[S] Installs WinDbg as the

使用WinDbg调试入门(内核模式)

孤街醉人 提交于 2019-11-28 22:09:13
windbg是一个内核模式和用户模式调试器,包含在Windows调试工具中。 这里我们提供了一些实践练习,可以帮助您开始使用windbg作为内核模式调试器。 设置内核模式调试 内核模式调试环境通常有两台计算机:主机和目标计算机。调试器在主机上运行,正在调试的代码在目标计算机上运行。主机和目标通过调试电缆连接。Windows调试程序支持以下类型的电缆进行调试: Ethernet USB 2.0 USB 3.0 1394 Serial (also called null modem) 如果目标计算机运行的是Windows8或更高版本,则可以使用任何类型的调试电缆,包括以太网。 此图说明通过以太网电缆连接调试的主机和目标计算机。 如果目标计算机运行的Windows版本早于Windows 8,则不能使用以太网进行调试;必须使用USB、1394或串行。 此图说明了通过USB、1394或串行调试电缆连接的主机和目标计算机。 建立内核模式调试会话 在设置好主机和目标计算机并用调试电缆将它们连接起来之后,您可以按照用于设置的同一主题中的说明建立内核模式调试会话。 例如,如果您决定设置主机和目标计算机以通过以太网进行调试,参考《 通过网线手动设置内核模式调试 》。 同样,如果您决定设置主机和目标计算机以通过USB 2.0进行调试,您可以找到建立内核模式调试会话的说明,参考《 通过USB 2

Help catching StackOverflowException with WinDbg and ADPlus

有些话、适合烂在心里 提交于 2019-11-28 20:37:58
Short Version I want an ADPlus script that will do a full memory dump on the first-chance StackOverflowException, before anything is cleaned up, and ignore all other exception types. Log Version After a release of new ASP.NET code, we started getting intermittent StackOverflowExceptions. We've looked for infinite recursions and all the usual suspects in the revisions added since the last known good install, and can't find anything. The website will run for up to an hour, and then crash down. We've used WinDbg and SOS and attempted to get crash logs using ADPlus, using this command: adplus

Kernel trace Windows 7 WinDbg

断了今生、忘了曾经 提交于 2019-11-28 19:41:17
I'm getting no debug information when debugging en_windows_7_checked_build_dvd_x86_398742. I can't see even my own trace info (ATLTRACE). In opposite, Windows XP Checked works like a charm. I get "Bad QueryIdType:5" msg on debug session start with Windows 7. Kernel debug is set up properly obviously. Please help... I was able to fix it from within windbg, on windows 7 32 bit: ed Kd_DEFAULT_Mask 8 According to the msdn article, you can also use the registry, but you must reboot for it to take effect. Create a DWORD key under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager

WinDbg的环境变量

橙三吉。 提交于 2019-11-28 19:17:47
有很多的环境变量,主要分为常规环境变量和内核模式环境变量。下面分别列出。 常规环境变量 下表列出了可在用户模式和内核模式调试的环境变量。 变量 含义 _NT_DEBUGGER_EXTENSION_PATH = Path 指定调试器将先搜索扩展 Dll 的路径。 路径 可以包含驱动器号后, 接一个冒号 ( : )。 用分号分隔多个目录 ( ; )。 有关详细信息,请参阅 加载的调试器扩展 Dll 。 _NT_EXECUTABLE_IMAGE_PATH = Path 指定包含二进制可执行文件的路径。 路径 可以包含驱动器号后, 接一个冒号 ( : )。 用分号分隔多个目录 ( ; )。 _NT_SOURCE_PATH = Path 指定包含目标的源代码文件的路径。 路径 可以包含驱动器号后, 接一个冒号 ( : )。 用分号分隔多个目录 ( ; )。 有关详细信息,以及更改此路径的其他方法,请参阅 源路径 。 _NT_SYMBOL_PATH = Path 指定包含符号文件的目录树的根。 路径 可以包含驱动器号后, 接一个冒号 ( : )。 用分号分隔多个目录 ( ; )。 有关详细信息,以及更改此路径的其他方法,请参阅 符号路径 。 _NT_ALT_SYMBOL_PATH = Path 指定搜索之前 _NT_SYMBOL_PATH 替代符号路径。 这可用于保留符号文件的专用版本。 路径

win32 window in WPF

删除回忆录丶 提交于 2019-11-28 18:50:56
Recently our application encountered a strange problem. The application has a win32 window in the WPF window, when resize the WPF window, the problem occurred. StackTrace: Exception object: 0000000002ab2c78 Exception type: System.OutOfMemoryException InnerException: <none> StackTrace (generated): SP IP Function 0048D94C 689FB82F PresentationCore_ni!System.Windows.Media.Composition.DUCE+Channel.SyncFlush()+0x80323f 0048D98C 681FEE37 PresentationCore_ni!System.Windows.Media.Composition.DUCE+CompositionTarget.UpdateWindowSettings(ResourceHandle, RECT, System.Windows.Media.Color, Single, System

WinDbg 调试工具的使用

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 18:33:14
概述 项目接近尾声了,可是在运行时会有memory leak(内存泄露) bug.产品在运行一天后,内存增长致1.4G,而我们产品的初始内存才有70M,问题很严重,决定采用WinDbg工具来分析代码问题有原因到底在哪里. WinDbg是微软发布的一款相当优秀的源码级(source-level)调试工具,可以用于Kernel模式调试和用户模式调试,还可以调试Dump文件。 WinDbg下载: Install Debugging Tools for Windows 32-bit Version http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx Install Debugging Tools for Windows 64-bit Versions http://www.microsoft.com/whdc/devtools/debugging/install64bit.mspx 配置 在安装完WinDbg后,需要在我们开发电脑上配置两个环境变量值,_NT_ALT_SYMBOL_PATH(调试的bin目录) 和_NT_SYMBOL_PATH(symcache目录),如下图 _NT_ALT_SYMBOL_PATH(调试的bin目录): _NT_SYMBOL_PATH(symcache目录) 还要再配置下这个:

使用WinDbg内核调试

好久不见. 提交于 2019-11-28 18:32:55
看雪学院,笨笨翻译《 使用WinDbg内核调试 》。很有用的资料,由于太长,加上很多图片,偷懒,留个链接在这里。这里简要做一些我测试时候的笔记: 首先你要配置好测试环境:参考 VMware+Windgb+Win7 内核驱动调试 在你的主机上配置Symbols 配置sympath,C:\Users\Admin\Desktop\first\objchk_win7_x86\i386是你编译好的sys目录: SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols;C:\Users\Admin\Desktop\first\objchk_win7_x86\i386 配置Source search path假设文件放在C:\Users\Admin\Desktop\first]: C:\Users\Admin\Desktop\first 然后在命令行中输入:.reload 打开源文件:Ctrl+O 接着检查是否已经加载sys.dbg,命令为: kd> !lmi ndislwf Loaded Module Info: [nt] Module: ntoskrnl Base Address: 80a02000 Symbol Type: PDB – Symbols loaded successfully from symbol server. d

使用Windbg和SoS扩展调试分析.NET程序

不问归期 提交于 2019-11-28 18:32:17
在博客堂的 不是我舍不得 - High CPU in GC(都是+=惹的祸,为啥不用StringBuilder呢?) 、 不是我舍不得 - .NET里面的Out Of Memory 看到很多人在问如何分析dump,所以就写下了这篇短文,抛砖引玉。 一、安装 DebuggingToolsforWindows: 从以下 Microsoft 网站下载 DebuggingToolsforWindows: http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx ,微软经常更新DebuggingToolsforWindows工具的,所以我们下载一个最新版本的,把DebuggingToolsforWindows 安装到 C:\Debuggers 文件夹,从命令行中运行工具需要一个简短的路径,这样更加容易使用。 二、为 WinDbg 中设置符号路径: 1.打开 WinDbg。 2.在 文件 菜单上, 单击 符号文件路径 。 3.在 符号路径 对话框中, 键入以下符号路径: srv*c:\symbols*http://msdl.microsoft.com/download/symbols 4.关闭 WinDbg, 然后键入 是 Yes ,以保存基本区信息。 三、SOS 扩展 SOS.dll 中提供的 Son of Strike