NAME=rcall
FILE=-
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
wx e18f1394 # BL XXX
sd +4
wx 00013fd6 # BLR x8
ao~type[1]
ao@0~type[1]
/at call
?e --
/at ucall
?e --
/at rcall
EOF
EXPECT=<<EOF
rcall
call
0x00000000 4 bl 0x4e3f84
--
--
0x00000004 4 blr x8
EOF
RUN

NAME=noreturn errno
FILE=bins/mach0/BatteryLife.arm_64.1
CMDS=<<EOF
e emu.str=1
s 0x100011130
pd 2~addChild
EOF
EXPECT=<<EOF
EOF
RUN

NAME=adrp string
FILE=bins/mach0/SwiftUITest
CMDS=<<EOF
e emu.str=1
s. 886c
pds 10
EOF
EXPECT=<<EOF
0x100008870 str.Hello_World
EOF
RUN

NAME=symbol with invalid offset
FILE=bins/elf/libarm64.so
CMDS=<<EOF
ii
iE
EOF
EXPECT=<<EOF
[Imports]
nth vaddr      bind   type   lib name
-------------------------------------
3   0x00020060 GLOBAL NOTYPE     _bss_end__
4   0x000006b0 GLOBAL FUNC       realloc
5   0x000006c0 GLOBAL FUNC       __cxa_finalize
7   0x000006d0 GLOBAL FUNC       __stack_chk_fail
8   0x00020058 GLOBAL NOTYPE     __bss_start
9   0x00020060 GLOBAL NOTYPE     __end__
10  0x00020058 GLOBAL NOTYPE     __bss_start__
11  0x00020058 GLOBAL NOTYPE     _edata
12  0x000006e0 GLOBAL FUNC       malloc
13  0x000006f0 GLOBAL FUNC       memcpy
14  0x00020060 GLOBAL NOTYPE     __bss_end__
15  0x00000700 GLOBAL FUNC       memset
16  0x00020060 GLOBAL NOTYPE     _end
17  0x00000710 GLOBAL FUNC       free
18  0x00000720 GLOBAL FUNC       __cxa_atexit

[Exports]

nth paddr       vaddr      bind   type size lib name
----------------------------------------------------
6    0x0000aa20 0x0000aa20 GLOBAL FUNC 1176     Java_o__003dc_e
EOF
RUN

NAME=ao mte irg addg
FILE=bins/mach0/hello-mte
CMDS=<<EOF
ao@0x100007f10
?e --
ao@0x100007f14
EOF
EXPECT=<<EOF
address: 0x100007f10
opcode: irg x8, sp, x8
esilcost: 0
disasm: irg x8, sp, x8
pseudo: irg x8,sp,x8 
mnemonic: irg
mask: ffffffff
prefix: 0
id: 0
bytes: e813c89a
refptr: 0
size: 4
sign: false
type: mov
cycles: 0
family: sec
--
address: 0x100007f14
opcode: addg x9, x8, 0x20, 0x0
esilcost: 0
disasm: addg x9, x8, 0x20, 0x0
pseudo: addg x9,x8,0x20, 0x0 
mnemonic: addg
mask: ffffffff
prefix: 0
id: 0
bytes: 09018291
refptr: 0
size: 4
sign: false
type: add
cycles: 0
family: sec
EOF
RUN

NAME=ao mte big endian
FILE=-
ARGS=-a arm -b 64 -e cfg.bigendian=true
CMDS=<<EOF
wx 91a0090c918201099ac813e8
ao@0
?e ---
ao@4
?e ---
ao@8
EOF
EXPECT=<<EOF
address: 0x0
opcode: addg x12, x8, 0x0, 0x2
esilcost: 0
disasm: addg x12, x8, 0x0, 0x2
pseudo: addg x12,x8,0x0, 0x2 
mnemonic: addg
mask: ffffffff
prefix: 0
id: 0
bytes: 91a0090c
refptr: 0
size: 4
sign: false
type: add
cycles: 0
family: sec
---
address: 0x4
opcode: addg x9, x8, 0x20, 0x0
esilcost: 0
disasm: addg x9, x8, 0x20, 0x0
pseudo: addg x9,x8,0x20, 0x0 
mnemonic: addg
mask: ffffffff
prefix: 0
id: 0
bytes: 91820109
refptr: 0
size: 4
sign: false
type: add
cycles: 0
family: sec
---
address: 0x8
opcode: irg x8, sp, x8
esilcost: 0
disasm: irg x8, sp, x8
pseudo: irg x8,sp,x8 
mnemonic: irg
mask: ffffffff
prefix: 0
id: 0
bytes: 9ac813e8
refptr: 0
size: 4
sign: false
type: mov
cycles: 0
family: sec
EOF
RUN

NAME=Variable analysis with stp/preindexed str
FILE=-
ARGS=-a arm -b 64
CMDS=<<EOF
e analysis.vars.stackname=true
wx f30f1ef8fd7b01a9fd430091fd7b41a9e00313aaf30742f8c0035fd6
aap
aaef
afvx
EOF
EXPECT=<<EOF
afvR
   var_10h  0xc
   var_20h  0x14
    var_8h  0xc
afvW
   var_10h  0x4
   var_20h  0x0
    var_8h  0x4
EOF
RUN
