views:

198

answers:

1

I have a windbg script that I plan on assigned to run via a breakpoint. In this script I want to tokenize a command using .foreach, but I want to be able to assign a variable to remember something about a current token for the next time around the for loop.

For example, something like this (written in psuedo windbg-script-code):

$thistokenisinteresting = false
.foreach (line {k100})
{
    .if ($thistokenisinteresting)
    {
     .printf line
     $thistokenisinteresting = false
    }
    .if ($SPAT("line","*SomeToken*")) 
    {
     $thistokenisinteresting = true
    }
}

I can't figure out how to assign a variable like $thistokenisinteresting . Do I use a register? Won't that screw up my debugging?

A: 

I believe $t0-$t19 are pseudo-registers used as variables in your script, and you can set them via r.

i.e.,

r $t0 = 0 r $t0 = 1

etc.

Michael
sweet! thanks man!
pj4533