windbg

How to get thread stack information on Windows?

僤鯓⒐⒋嵵緔 提交于 2019-11-27 15:07:49
问题 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? 回答1: (Definitions can be found here.) To get stack boundaries: THREAD_BASIC

Set up WinDbg as the default debugger

这一生的挚爱 提交于 2019-11-27 14:57:56
问题 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? 回答1: 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

win32 window in WPF

∥☆過路亽.° 提交于 2019-11-27 11:54:38
问题 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

What to do with “The version of SOS does not match the version of CLR you are debugging” in WinDbg?

狂风中的少年 提交于 2019-11-27 11:26:52
I'm having a problem with some of my apps. It's a wcf-based app running under IIS6 in Windows 2003 Server (x86): In Event Log I get such an error from "W3SVC-WP" source (EventID=2262): ISAPI 'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll' reported itself as unhealthy for the following reason: 'Deadlock detected'. I'm trying figuring out what's going on. I've set up creating dump for Orphan Worker Process as described in this KB . When an deadlock occured a minidump is created. Then I take this minidump to try to understand what's happened. Here's I'm stuck. I run WinDbg x86,

How to write a sample code that will crash and produce dump file?

独自空忆成欢 提交于 2019-11-27 09:56:22
问题 I started learned windbg and I found this good post How to use WinDbg to analyze the crash dump for VC++ application? Now I want to follow the instructions and do it step by step. Here is the problem: I need to write some sample code that can immediately crash, and create some dump files that can be used by windbg. How to write such code? void Example4() { int* i = NULL; *i = 80; } The above code will crash immediately; however, I don't know where to find the dump file? Thank you 回答1:

LOH fragmentation - 2015 update

馋奶兔 提交于 2019-11-27 09:23:05
There is a lot of information available about the .NET LOH and it has been explained in various articles. However, it seems that some articles lack a bit of precision. Outdated information In Brian Rasmussen's answer (2009), program manager at Microsoft , he says the limit is 85000 bytes. He also let's us know that there is an even more curious case of double[] with a size of 1000 elements. The same 85000 limit is stated by Maoni Stephens (MSDN, 2008), member of the CLR team . In the comments, Brian Rasmussen becomes even more exact and let's us know that it can be reproduced with a byte[] of

.loadby not work, but .load works well

柔情痞子 提交于 2019-11-27 08:51:09
问题 When I try to use windbg, .load C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SOS.dll works perfectly to load SOS extension. But when I tried to used the suggested pattern .loadby SOS OR .loadby sos.dll I could only got a error message saying "Syntax error in extension string". I tried to googled this error message, but nothing useful found. Any suggestions ? 回答1: .loadby needs another argument to define where by is. From WinDbg help: .loadby DLLName ModuleName DLLName Specifies the

When is a divide by zero not a divide by zero? A puzzle in the debugger (static variable issues)

北战南征 提交于 2019-11-27 06:39:00
问题 I'm very confused and I think my debugger is lying to me. I have the following loop in my code: MyClass::UploadFile(CString strFile) { ... static DWORD dwLockWaitTime = EngKey::GetDWORD(DNENG_SERVER_UPLOAD_LOCK_WAIT_TIME, DNENG_SERVER_UPLOAD_LOCK_WAIT_TIME_DEFAULT); static DWORD dwLockPollInterval = EngKey::GetDWORD(DNENG_SERVER_UPLOAD_LOCK_POLL_INTERVAL, DNENG_SERVER_UPLOAD_LOCK_POLL_INTERVAL_DEFAULT); LONGLONG llReturnedOffset(0LL); BOOL bLocked(FALSE); for (DWORD sanity = 0; (sanity == 0 |

Using windbg from Visual Studio

早过忘川 提交于 2019-11-27 06:16:47
问题 Is it possible to use windbg commands like !locks and .loadby sos mscorwks from the Visual Studio command window (in a debug session)? I've noticed I can use eg k to print a stack trace, so I was wondering if there is some way to get access to the other commands. 回答1: Yes you can do this. Attach Visual studio 2008 to your process for debugging. Break at some code. Go to immediate window type !load sos Now you are free to use any of the windbg commands like !EEHeap,!DumpHeap There are some

How to get Qt Creator to work with CDB?

痞子三分冷 提交于 2019-11-27 06:07:21
问题 I'm using Qt Creator 2.01 32-bit with Qt 4.7.1 on Windows 7 64-bit. I compiled my Qt library using Microsoft Visual C++ 2010. Now I want to use CDB with Qt Creator (or GDB if that works, or whatever is the best option). What exactly do I need to do to be able to debug with CDB (so I can set break points and see symbols)? Please don't just point me to http://qt-project.org/doc/qtcreator-2.8/creator-debugger-engines.html because I've been there and I'm still missing something. I have Windows