NAME=iphone-arm-esil tests
FILE=bins/mach0/FileDP
CMDS=<<EOF
s main
aei
aeim
e asm.emu=true
e asm.bytes=true
e asm.emustr=false
pd 4~!--
EOF
EXPECT=<<EOF
            0x000028ec      b0402de9       push  {r4, r5, r7, lr}      ; sp=0x177ff0
            0x000028f0      08708de2       add   r7, sp, 8             ; r7=0x177ff8
            0x000028f4      05dd4de2       sub   sp, sp, 0x140         ; sp=0x177eb0
            0x000028f8      07d0cde3       bic   sp, sp, 7             ; sp=0x177eb0
EOF
RUN

NAME=iphone-arm-esil pdsf scr.html=true
FILE=bins/mach0/FileDP
CMDS=<<EOF
e scr.html=true
e asm.flags=false
s main
e emu.str=true
af
pdsf
EOF
EXPECT=<<EOF
0x00002900&nbsp;argc<br />0x00002904&nbsp;argv<br />0x00002918&nbsp;"alloc"<br />0x00002920&nbsp;str.alloc<br />0x00002928&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002934&nbsp;"init"<br />0x0000293c&nbsp;str.init<br />0x00002940&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x0000294c&nbsp;"X\x10\x9d\xe5"<br />0x0000295c&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002970&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002998&nbsp;"Usage:&nbsp;FileDP&nbsp;[-f/-d]&nbsp;[Full&nbsp;path&nbsp;to&nbsp;file/directory]&nbsp;"<br />0x0000299c&nbsp;bl&nbsp;sym.imp.puts<br />0x000029c8&nbsp;bl&nbsp;sym.imp.strcmp<br />0x00002a1c&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002a38&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002a64&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002a90&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002aa4&nbsp;bl&nbsp;sym.imp.NSLog<br />0x00002ab0&nbsp;str.File_Not_Found<br />0x00002ab4&nbsp;bl&nbsp;sym.imp.puts<br />0x00002b00&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002b1c&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002b48&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002b64&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002ba4&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002c00&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002c54&nbsp;bl&nbsp;sym.imp.objc_enumerationMutation<br />0x00002ca0&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002cc0&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002cec&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002cfc&nbsp;str.cstr.file_name_is:_____protection_class:<br />0x00002d04&nbsp;bl&nbsp;sym.imp.NSLog<br />0x00002d50&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002d84&nbsp;str.Directory_Not_found<br />0x00002d88&nbsp;bl&nbsp;sym.imp.puts<br />0x00002dac&nbsp;bl&nbsp;sym.imp.objc_msgSend<br />0x00002dcc&nbsp;bx&nbsp;lr
EOF
RUN

NAME=iphone-arm-esil pdsf
FILE=bins/mach0/FileDP
CMDS=<<EOF
e asm.flags=false
s main
e emu.str=true
af
pdsf
EOF
EXPECT=<<EOF
0x00002900 argc
0x00002904 argv
0x00002918 "alloc"
0x00002920 str.alloc
0x00002928 bl sym.imp.objc_msgSend
0x00002934 "init"
0x0000293c str.init
0x00002940 bl sym.imp.objc_msgSend
0x0000294c "X\x10\x9d\xe5"
0x0000295c bl sym.imp.objc_msgSend
0x00002970 bl sym.imp.objc_msgSend
0x00002998 "Usage: FileDP [-f/-d] [Full path to file/directory] "
0x0000299c bl sym.imp.puts
0x000029c8 bl sym.imp.strcmp
0x00002a1c bl sym.imp.objc_msgSend
0x00002a38 bl sym.imp.objc_msgSend
0x00002a64 bl sym.imp.objc_msgSend
0x00002a90 bl sym.imp.objc_msgSend
0x00002aa4 bl sym.imp.NSLog
0x00002ab0 str.File_Not_Found
0x00002ab4 bl sym.imp.puts
0x00002b00 bl sym.imp.objc_msgSend
0x00002b1c bl sym.imp.objc_msgSend
0x00002b48 bl sym.imp.objc_msgSend
0x00002b64 bl sym.imp.objc_msgSend
0x00002ba4 bl sym.imp.objc_msgSend
0x00002c00 bl sym.imp.objc_msgSend
0x00002c54 bl sym.imp.objc_enumerationMutation
0x00002ca0 bl sym.imp.objc_msgSend
0x00002cc0 bl sym.imp.objc_msgSend
0x00002cec bl sym.imp.objc_msgSend
0x00002cfc str.cstr.file_name_is:_____protection_class:
0x00002d04 bl sym.imp.NSLog
0x00002d50 bl sym.imp.objc_msgSend
0x00002d84 str.Directory_Not_found
0x00002d88 bl sym.imp.puts
0x00002dac bl sym.imp.objc_msgSend
0x00002dcc bx lr
EOF
RUN

NAME=thumb emulation arm issue
FILE=bins/mach0/FileDP
CMDS=<<EOF
aes
e asm.bits
EOF
EXPECT=<<EOF
32
EOF
RUN

NAME=string refs: thumb
FILE=bins/mach0/test-thumb
CMDS=<<EOF
af
e asm.emu=true
e emu.str=true
pdf~?str.string
EOF
EXPECT=<<EOF
6
EOF
RUN

NAME=string refs: arm32
FILE=bins/mach0/test-arm32
CMDS=<<EOF
af
e asm.emu=true
e asm.emustr=true
pdf~?str.string
EOF
EXPECT=<<EOF
6
EOF
RUN

NAME=string refs: arm64
FILE=bins/mach0/test-arm64
CMDS=<<EOF
af
e asm.emu=true
e asm.emustr=true
pdf~?str.string
EOF
EXPECT=<<EOF
6
EOF
RUN

NAME=arm32: thumb
FILE=bins/mach0/arm32-ofp.lzh
CMDS=pd 2~?push
EXPECT=<<EOF
1
EOF
RUN

NAME=thumb: arm32
FILE=bins/mach0/arm16-ofp.lzh
CMDS=pd 2~?push
EXPECT=<<EOF
1
EOF
RUN
