g variable

i have a global var defined as

DWORD g_MyVar;

how do i set a break point in windbg so that it automatically breaks into
the debugger when the value of this variable reaches 1.

I dont want to modify driver code to do this

i want windbg commands to achieve it.

ap

A P wrote:

i have a global var defined as

DWORD g_MyVar;

how do i set a break point in windbg so that it automatically breaks
into the debugger when the value of this variable reaches 1.

I dont want to modify driver code to do this

i want windbg commands to achieve it.

Assuming you have the symbols, you can break on every change to g_MyVar
like this:

ba w 4 mydriver!g_MyVar

You could then use a macro after the command to check the value for 1
and decide whether to “go” or not, but I use that so rarely that I never
remember the exact commands.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.