How to debug a dead-end Windows application on a client machine

I have a multithreaded Windows application that sometimes causes deadlocks. This inevitably happens on the client system, not when testing software. What's the easiest way to get Windows Minidump of the current state of an application? If it can also cause the application to terminate, the user can restart it and continue using the system, which will be great.

0


source to share


3 answers


In Vista, you can create a dump file directly from the Task Manager. Right click on a process in the processes tab and select "create dump file".



Before Vista, I prefer the ntsd route because, although not exactly user-friendly, it works without the user installing any other software, and the instructions are actually pretty easy to follow.

+1


source


See the Microsoft support article How to Use ADPlus to Troubleshoot Hangs and Crashes and the helpful blog post Debugging Production Applications Using ADPlus .



Both of these articles are about "ADPlus", a VBScript tool that comes with Windows debugging tools that can be used to generate minipackages from the desktop (which can later be loaded with WinDbg on your development machine). ADPlus has many features and many options, so finding the best use case for your environment may take some reading, experimentation and practice.

+2


source


I know how to achieve this. It's just that my technique is a little awkward. All Windows 2000 and later systems have a basic command line debugger as part of their standard NTSD installation. What I am currently doing is running:

ntsd -pn MyApp.exe

      

When the debugger console appears, I can enter the following into the debugger console:

.dump c:\my-deadlock.mdmp
.kill

      

What I'm looking for is something that is a little cleaner and easier to insert an email to clients just for startup. I saw that it is mentioned somewhere (which Google cannot find at the moment) that you can use drwtsn32.exe to extract the crash dump and terminate the application.

Edit: It is possible to simplify the command somewhat:

ntsd -pn MyApp.exe -c ".dump c:\my-deadlock.mdmp; .kill"

The command .detach

can be given if the process has not been permanently suspended (for example, a long network timeout) and you want the process to continue.

+1


source







All Articles