WinDbg

You are currently browsing articles tagged WinDbg.

WinDbg有一个挺有意思的功能,叫做”Trace and Watch Data” — “wt”命令。WinDbg的help文件解释道:

The wt command runs through the whole function and then displays statistics, when you execute this command at the beginning of a function call.

也就是, 当你在debugging的时候,你step到一个function的开头(比如通过break point停在一个function开头),这时候你想获得关于这个function执行时候的详细信息,就在command窗口,输入wt,这时候debugger就会替你执行整个function到它return的地方,并提供给你这次执行的详细信息。比如下图,就是我用WinDbg attach到一个正在执行的notepad后,某次执行”wt”时得到的结果:

WinDbg, wt命令

可以看到,这个function执行的详细信息被显示出来。比如function在stack的call depth,以及每个被call的function的执行的指令数目, 被执行的system call等等。这个是动态执行的trace,是根据当时的具体输入来的,所以不会cover所有code。另外,因为inline function在这里不被显示为一个function call,所以你还可以知道那些function被编译器inline了,那些没有。

感觉这是一条很有用也很强大的命令,在performance tuning的时候能提供很多有用的信息。我这里描述的是最简单也是最常用的用法。更具体的用法,请查阅WinDbg的帮助文件。

Tags:

« Older entries



Syndication

  • |  (comments)
  • Subscribe in Bloglines
  • Add to Google
如以上的Feed无法订阅,请使用feedsky提供的feed:

Calendar

    July 2008
    M T W T F S S
    « May    
     123456
    78910111213
    14151617181920
    21222324252627
    28293031  

Archives

Categories

random posts:

recent comments:

Technorati

Meta

Other