开发者

Scripting WinDBG to take a callstack every time it breaks and then move on (unhandled ex, or the debugee saying debug.break())

We're running an application, happens to be web server we've written, and we're saying some nasty issues only in production, so for about 12 hours we're going to put this under WinDBG and take callstacks every time it breaks.

Sometimes it'll 开发者_C百科break because of an unhandled exception, and sometimes we'll hit an assert, at which point our code says if running under a debugger, break.

Is it possible to hook into WinDBG in such a way that as soon it breaks, it takes a callstack, and moves on immediately?


Attaching a debugger to a production box can be disastrous, (a) performance (b) unexpected breaks into the debugger

As a safety, definately make sure you disable all exceptions you don't care about or will not want to break into the debugger.

sxd *

Then, choose the ones you'd like to handle in some fashion (take callstack, and move on)

sxe -c "kb;g" bpe
sxe -c "kb;g" asrt
sxe -c "kb;g" eh

The first one is a break point exception handler, assert failure, and C++ EH exception.

There's a huge list of what your debugger supports, for example if you load SOS.dll (the CLR extension to WinDBG) then you'll be able to

sxe -c "kb;g" clr

For authoritative information on types of exception/events you can potentially filter on, see the WinDbg help (search for sxe)


Try

sxe -c "kb;g" -h wkd

and

sxe -c "kb;g" -h eh

Search Controlling Exceptions and Events in windbg's Help document for more related information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜