Meeting the needs of your business from a distance

Attach Debugger At Process Start

by mark shiffer 29. October 2009 16:21

I am reprinting/paraphrasing this article from Sasha’s blog for future reference. The original article can be found here.

You can ask Windows to launch another process (typically a debugger) when launching a process of your choice … to attach a debugger to the startup sequence of a process that can’t be easily started from within the debugger. For example, if you’re debugging the startup of a Windows service, you can’t start it from the debugger; the same applies to dllhost.exe processes in a COM+ environment; and there are other examples.

All you need to do to configure this feature is the Global Flags application available with the Debugging Tools For Windows package. In the Image File tab, input the executable name (including the extension) and hit Tab to refresh, and then check the Debugger checkbox and input the name of the debugger to launch (e.g., vsjitdebugger.exe). Finally, click Apply—no system restart is required.

There’s no dark debugger magic involved—when Windows launches the ‘target’ process, it checks the registry for the appropriate flag and if it’s present, it will launch the specified process, pass to it the ‘target’ executable name as the first command line parameter, followed by the rest of the original command line arguments.

Tags:

Programming | Research

Comments

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Copyright © 2001-2010 MS Consulting, Inc. All Rights Reserved.