123456

 

windbg学习 gc ----j(Execute If-Else)----.if

当一个条件断点的末尾包含一个执行命令时,需要使用gc命令

例如,如果使用g (Go)命令来到达该断点,则恢复为自由执行。但是如果使用单步或跟踪来到达该断点,也会以单步或跟踪的方式来恢复执行


j Expression Command1 ; Command2
j Expression 'Command1' ; 'Command2' 

Expression
要求值的表达式。如果表达式的值是非0值,则执行Command1 。如果表达式的值为0,则执行Command2
Command1
Expression 为非0值(TRUE)时要执行的命令字符串。可以通过在命令字符串两边加上单引号( ' ),并且以分号来分隔各个命令来一次使用多条命令。如果命令字符串是单条命令,单引号是可选的。 
Command2

Expression 值为0(FALSE)时要执行的命令字符串。可以通过在命令字符串两边加上单引号( ' ),并且以分号来分隔各个命令来一次使用多条命令。如果命令字符串是单条命令,单引号是可选的。

cx=fb08
0:000> j (eax!=0) r eax; r bx
bx=0
0:000> j (eax!=0) r eax; r bx; r cx
bx=0
0:000> j (eax!=0) r eax; 'r bx; r cx'
bx=0
cx=fb08
可以看到第二条由于没有单引号,所以后面的被忽略了!


.if关键字的行为和C中的if类似

.if (Condition) { Commands 

.if (
Condition) { Commands } .else { Commands 

.if (
Condition) { Commands } .elsif (Condition) { Commands 

.if (
Condition) { Commands } .elsif (Condition) { Commands } .else { Commands } 

0:000> .if (eax>ebx){r eax}.else{r ebx; r ecx}
ebx=00000000
ecx=001dfad0



posted on 2013-05-29 21:40  hgy413  阅读(525)  评论(0编辑  收藏  举报

导航