NAME=String udis86
FILE=bins/elf/analysis/main
CMDS=<<EOF
e asm.arch=x86.udis
e asm.arch=x86
e asm.bits=32
e scr.columns = 90
aa
pd 1 @ 0x0040050a
EOF
EXPECT=<<EOF
|           0x0040050a      bfc4054000     mov edi, str.Hello_World    ; 0x4005c4 ; "Hello World"
EOF
RUN


NAME="16bit segment bounds"
FILE=malloc://1024k
CMDS=<<EOF
e asm.arch=x86.udis
e asm.bits=16
e analysis.hasnext=0
wx e9c300 @ f000:ffaa
s f000:ffaa
pi 1
EOF
EXPECT=<<EOF
jmp 0xf0070
EOF
RUN

NAME="udis1"
CMDS=<<EOF
e asm.arch=x86.udis
e asm.bits=32
e analysis.hasnext=0
b 0x4e
wx 743684c0741284d2b8010000007509f3c30f1f8000000000488b4e40488b07488b1648394f407f187c1e4889d64889c7e933e1ffff0f1f0084d274c60f1f4000b8ffffffffc36690b801000000c3
af
pif~?
afi $$~size[1]
EOF
EXPECT=<<EOF
32
78
EOF
RUN

NAME="udis2"
CMDS=<<EOF
e asm.arch=x86.udis
e asm.bits=32
e analysis.hasnext=0
b 0x4e
wx 743684c0741284d2b8010000007509f3c30f1f8000000000488b4e40488b07488b1648394f407f187c1e4889d64889c7e933e1ffff0f1f0084d274c60f1f4000b8ffffffffc36690b801000000c3
af
pdr~true?
EOF
EXPECT=<<EOF
8
EOF
RUN

NAME="udis3"
CMDS=<<EOF
e asm.arch=x86.udis
e asm.bits=32
e analysis.hasnext=0
b 0x4e
wx 5589e583ec2083f8000f8507000000b800000000eb05b80100000083c4205dc3
af
pdr~true?
pdr~false?
EOF
EXPECT=<<EOF
3
1
EOF
RUN

NAME="axt udis86"
FILE=bins/elf/analysis/main
CMDS=<<EOF
e asm.arch=x86.udis
e analysis.arch=x86.udis
e scr.color=false
e scr.wheel=false
aa
axt @ str.Hello_World
EOF
EXPECT=<<EOF
sym.main 0x40050a [data] mov edi, str.Hello_World
EOF
RUN

NAME="axt udis86: IOLI0"
FILE=bins/elf/ioli/crackme0x00
CMDS=<<EOF
e asm.arch=x86.udis
e analysis.arch=x86.udis
e scr.color=false
e scr.wheel=false
aa
axt @ str.Password:
EOF
EXPECT=<<EOF
main 0x804843c [data] mov dword [esp], str.Password:
EOF
RUN

NAME="axf string ref udis86"
BROKEN=1
FILE=bins/elf/ioli/crackme0x03
CMDS=<<EOF
e asm.arch=x86.udis
e analysis.arch=x86.udis
e scr.color=false
e scr.wheel=false
aa
axt str.Sdvvzrug_RN
axf 0x804848a
EOF
EXPECT=<<EOF
sym.test 0x804848a [data] mov dword [esp], str.Sdvvzrug_RN
d 0x804848a mov dword [esp], str.Sdvvzrug_RN
EOF
RUN
