Wednesday, 8 November 2006

Tech Ed - Alternative .NET debugging facilities

Brian Long. Alternative .NET debugging facilities.

.NET supplied console debugger - mdebug. Load switch shows all objects loaded for the application.

.NET supplied Gui debugger - dbgclr. The debug engine used in visual studio. Useful for server or client site debugging.

Extra debugging tools for windows
  • Ntsd - uses existing console.
  • Cdb - launches new console.
  • Kd - kernal level!
  • Windbg - gui. Recommended debugger. Debug menu, event filter, add stop on .NET exceptions.

To fully maximise debuggers Microsoft's Symbol server provides all microsoft's dll's symbol extensions. Symbols are needed so the debugger can step into the call stack operations. To allow debuggers to use the symbols the _NT_SYMBOL_PATH machine environment variable is added with the unc for local symbols or url for symbol server.

Microsoft userdump - good tool for crash dump creation and extraction.

You can write debugger extensions - these must be unmanaged though. So you could write custom extensions specific to your complex application.

Furthermore all debuggers are unmanaged so you must add the SOS (Son Of Strike as originally .NET was going to be called lightening) debugger extension to take advantage of detailed .NET debugging. To add a debugger extension add the _NT_DEBUGGER_EXTENSION_PATH machine environment variable with the unc for SOS dll or you will have type the full path everytime in the debugger.

In task manager add virtual bytes column as use this rather than memory usage as memory usage can be compressed.

No comments: