radare2/test/db/esil/flag_tests

161 lines
2.6 KiB
Plaintext

NAME=64bit Integer comparison [-1 == 1 (op1 < op2)]
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits = 64
"ae 1,-1,==,63,$o,of,:=,63,$s,sf,:=,64,$b,cf,:=,$z,zf,:="
"aer?cf"
"aer?sf"
"aer?of"
"aer?zf"
EOF
EXPECT=<<EOF
0x00000000
0x00000001
0x00000000
0x00000000
EOF
RUN
NAME=64bit Integer comparison [1 == -1 (op1 > op2)]
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits = 64
"ae -1,1,==,63,$o,of,:=,63,$s,sf,:=,64,$b,cf,:=,$z,zf,:="
"aer?cf"
"aer?sf"
"aer?of"
"aer?zf"
EOF
EXPECT=<<EOF
0x00000001
0x00000000
0x00000000
0x00000000
EOF
RUN
NAME=32bit Integer addition with overflow [0x80000000 + 0x80000000]
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits = 64
"ae 0x80000000,eax,:=,0x80000000,ebx,:=,eax,ebx,+=,31,$o,of,:=,31,$s,sf,:=,31,$c,cf,:=,$z,zf,:="
"aer?cf"
"aer?sf"
"aer?of"
"aer?zf"
EOF
EXPECT=<<EOF
0x00000001
0x00000000
0x00000001
0x00000001
EOF
RUN
NAME=32bit Integer Addition [0x90000000 + 0x70000000]
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits = 64
"ae 0x70000000,eax,:=,0x90000000,ebx,:=,eax,ebx,+=,31,$o,of,:=,31,$s,sf,:=,31,$c,cf,:=,$z,zf,:="
"aer?cf"
"aer?sf"
"aer?of"
"aer?zf"
EOF
EXPECT=<<EOF
0x00000001
0x00000000
0x00000000
0x00000001
EOF
RUN
NAME=32bit Integer Addition [0x70000000 + 0x90000000]
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits = 64
"ae 0x90000000,eax,:=,0x70000000,ebx,:=,eax,ebx,+=,31,$o,of,:=,31,$s,sf,:=,31,$c,cf,:=,$z,zf,:="
"aer?cf"
"aer?sf"
"aer?of"
"aer?zf"
EOF
EXPECT=<<EOF
0x00000001
0x00000000
0x00000000
0x00000001
EOF
RUN
NAME=signed compare check. a > b [2 > 1]
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits = 64
"ae 2,eax,=,1,ebx,=,ebx,eax,>,31,$o,of,:=,31,$s,sf,:=,31,$c,cf,:=,$z,zf,:=,sf,of,^,zf,|,!,==,$z,NUM"
EOF
EXPECT=<<EOF
0x1
EOF
RUN
NAME=signed compare check. a < b [2 < 1]
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits = 64
"ae 2,eax,:=,1,ebx,:=,ebx,eax,==,ebx,eax,<,31,$o,of,:=,31,$s,sf,:=,31,$c,cf,:=,$z,zf,:=,sf,of,!=,==,$z,NUM"
EOF
EXPECT=<<EOF
0x1
EOF
RUN
NAME=unsigned compare check. a < b [-1 < 1]
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits = 64
"ae -1,eax,:=,1,ebx,:=,ebx,eax,==,ebx,eax,<,31,$o,of,:=,31,$s,sf,:=,31,$c,cf,:=,$z,zf,:=,cf,zf,|,!,==,$z,NUM"
EOF
EXPECT=<<EOF
0
EOF
RUN
NAME=unsigned compare check. a > b [-1 > 1]
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits = 64
"ae -1,eax,=,1,ebx,=,ebx,eax,>,31,$o,of,:=,31,$s,sf,:=,31,$c,cf,:=,$z,zf,:=,cf,==,$z,NUM"
EOF
EXPECT=<<EOF
0
EOF
RUN
NAME=signed division traps
FILE=-
CMDS=<<EOF
"ae 32,0,/"
"ae 0,32,/"
"ae -1,0x8000000000000000,~/"
"ae -1,0x8000000000000000,~%"
EOF
EXPECT=<<EOF
0
EOF
EXPECT_ERR=<<EOF
ESIL TRAP type 3 code 0x00000000 divbyzero
ESIL TRAP type 3 code 0x00000000 divbyzero
ESIL TRAP type 3 code 0x00000000 divbyzero
EOF
RUN