Search code examples
batch-filecrash-dumpsvisual-studio-debuggingadplus

How to script ADPlus for ease of customer use for diagnosing crashes and hangs


We're a great fan of using ADPlus in the Debugging Tools for Windows for customers who are experiencing crashes or hangs. However, the big problem we have is trying to explain what the customers need to type in order to run it. We would send them a script, but it seems that the precise incantation depends on whether the user is on 32 or 64-bit and precisely which version of the debugging tools they downloaded.

Our convoluted instructions at the moment go something like this:

  • Find where the debugging tools installed -- it may be c:\program files (x86)\Debugging Tools for windows (x86) or c:\program files\Debugging tools for windows (x86) or some other variant
  • If you're running a 64-bit app then you'll need c:\program files\Debugging tools for windows (x64) instead
  • Find out what your user directory is, it may c:\users\jim or z:\documents and settings\jim
  • Start a command prompt and type:

    <whatever path you had above>\adplus -hang -pn myprocess.exe -o <your user dir>\crash_dumps

Obviously this has plenty of scope for going wrong, and isn't the best user experience, so I'd like to be able to send the user a batch file or other script that will detect:

  • Location of the Debugging Tools
  • User's home directory

So, is there a way of finding out where the debugging tools are installed? If the location exists in a registry, can that be easily extracted in a batch file? Can the user's home directory also be found from a batch script? My system (Win7-64) has an environment variable HOMEPATH. Can I assume that exists?


Solution

  • In answer to my own question: it looks like the simpler approach is just to run ProcDump instead, as that has a hang mode, and can be unzipped and run from any location:

    procdump -h -accepteula %HOMEPATH%\Desktop\crashreport.dmp myprocess.exe