bp20 somewhere “.bpsync 1; .if (poi(ebp+0xc) == @$t1) {r @$t1 = poi(ebp+0x8); r @$t2 = @$t2 + 1;.printf /on "A is %x. B is %x.", @$t1, poi(ebp+0x10);.if (@$t2 == 3) {ba r1 poi(ebp+0x8);kP;.echo;g} else {.echo;g}} .elsif (@$t0 >= 3) {bc 20;g} .else {g}”
I have this simple script. but the nested .if token seems to be not working, the expression evaluator tell me
‘^ Extra character error in ‘r @$t1 = poi(ebp+0x8); r @$t2 = @$t2 + 1;.printf /on "A is %p. B is %x.’’
Without the nested .if, everything is ok.
I can’t find in-depth help about nested conditional token of Windbg script expression.
In order to help yourself out, I suggest breaking this up from being one
line and putting it into a script file. For example, it’s much more readable
as this:
.bpsync 1
.if (poi(ebp+0xc) == @$t1)
{
r @$t1 = poi(ebp+0x8)
r @$t2 = @$t2 + 1
.printf /od “A is %x. B is %x.\n”, @$t1, poi(ebp+0x10)
.if (@$t2 == 3)
{
ba r1 poi(ebp+0x8)
kP
.echo Foo
g
}
.else
{
.echo Oof
g
}
}
.elsif (@$t0 >= 3)
{
bc 20
}
.else
{
g
}
Save that into a text file and then execute:
$><c:> In the debugger and see if it works better for you. If not it’s at least a bit more penetrable.
wrote in message news:xxxxx@windbg… > bp20 somewhere “.bpsync 1; .if (poi(ebp+0xc) == @$t1) {r @$t1 = > poi(ebp+0x8); r @$t2 = @$t2 + 1;.printf /on "A is %x. B is %x.", @$t1, > poi(ebp+0x10);.if (@$t2 == 3) {ba r1 poi(ebp+0x8);kP;.echo;g} else > {.echo;g}} .elsif (@$t0 >= 3) {bc 20;g} .else {g}” > > I have this simple script. but the nested .if token seems to be not > working, the expression evaluator tell me > ‘^ Extra character error in ‘r @$t1 = poi(ebp+0x8); r @$t2 = @$t2 + > 1;.printf /on "A is %p. B is %x.’’ > > Without the nested .if, everything is ok. > I can’t find in-depth help about nested conditional token of Windbg script > expression. ></c:>
oh, thank you…
I might be too tired to notice that “.”
Another question:
How to use environment variable in Windbg commands?
For example, I’d like to shorten the path of .logopen command, I found that enclose variable name in % simply don’t work.
!envvar command just display its value. Any ideas?
wrote in message news:xxxxx@windbg… > oh, thank you… > I might be too tired to notice that “.” > > Another question: > How to use environment variable in Windbg commands? > For example, I’d like to shorten the path of .logopen command, I found > that enclose variable name in % simply don’t work. > > !envvar command just display its value. Any ideas? >
> How to use environment variable in Windbg commands?
You can set an alias equal to an environment variable with as /e:
0: kd> as /e MyEnvVar HOMEPATH
0: kd> .echo ${MyEnvVar}
\Users\scott
0: kd> .logopen c:${MyEnvVar}\log.txt
Opened log file ‘c:\Users\scott\log.txt’
This obviously uses the environment variables from the machine running
WinDBG.
Another command I’ve never seen. I’m beginning to think that every
arbitrary 2- and 3-letter sequence represents a command or operator in
Windbg. It’s getting to be like Unix.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Actually, if you look closely, some of the initial windbg syntax dates back to the debug.com days.
S
-----Original Message-----
From: xxxxx@gmail.com Sent: Wednesday, May 26, 2010 11:23 To: Kernel Debugging Interest List Subject: RE:[windbg] How to nest .if token?
No, there’s nothing arbitrary about windbg syntax - it’s clearly the work of some twisted sadist.