WinDBG设置debug msg 输出信息级别

在Vista之后,debug信息可以用DbgPrintEx或KdPrintEx有条件地输出。(之前的2003 server或xp等,则是无条件输出,需要自己封装,设定debug信息级别)

DbgPrintEx在WinDBG中的信息级别按照如下方式定义:

If Level is equal to a number between 0 and 31, inclusive, it is interpreted as a bit shift. The importance bit field is set to the value 1 << Level. Thus choosing a value between 0 and 31 for Level results in a bit field with exactly one bit set. If Level is 0, the bit field is equivalent to 0x00000001;if Level is 31, the bit field is equivalent to 0x80000000. If Level is a number between 32 and 0xFFFFFFFF inclusive, the importance bit field is set to the value of Level itself. 

而常用的Level则有:
#define   DPFLTR_ERROR_LEVEL     0
#define   DPFLTR_WARNING_LEVEL   1
#define   DPFLTR_TRACE_LEVEL     2
#define   DPFLTR_INFO_LEVEL      3
#define   DPFLTR_MASK    0x8000000

在WinDBG中可以动态修改Debug信息的输出级别,方式如下:
      kd> ed Kd_IHVVIDEO_Mask 0x8 
即在WinDBG的命令模式下设置Kd_XXX_Mask,如上条命令中IHVVIDEO表示设置显卡driver的mask。
注意这里设定的mask还需要ORed WIN2000 system-wide mask(0x1)。

Debug信息的过滤方式:
1> 如果level小于等于31,判断(1<<level & Kd_IHVVIDEO_Mask)是否为0,不为0则输出
2> 如果level大于31,则直接判断(level & Kd_IHVVIDEO_Mask),从而决定是否输出

BTW:在WinDBG v6.6中似乎不行,但WinDBG v6.7中该方法可行

转载于:https://www.cnblogs.com/dust/archive/2008/09/23/1297080.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值