在Windbg脚本中分配数据的最简单方法是什么?

时间:2021-09-20 00:29:33

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.

我有一个windbg脚本,我计划分配通过断点运行。在这个脚本中,我想使用.foreach对命令进行标记,但我希望能够分配一个变量来记住下一次围绕for循环的当前标记。

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

例如,像这样的东西(用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?

我无法弄清楚如何分配像$ thistokenisinteresting这样的变量。我使用注册表吗?这不会搞砸我的调试吗?

1 个解决方案

#1


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

我相信$ t0- $ t19是在您的脚本中用作变量的伪寄存器,您可以通过r设置它们。

i.e.,

r $t0 = 0 r $t0 = 1

r $ t0 = 0 r $ t0 = 1

etc.

#1


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

我相信$ t0- $ t19是在您的脚本中用作变量的伪寄存器,您可以通过r设置它们。

i.e.,

r $t0 = 0 r $t0 = 1

r $ t0 = 0 r $ t0 = 1

etc.