mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-27 15:10:53 +00:00
5.7 KiB
5.7 KiB
NAME=ahi s + endian
FILE=-
CMDS=<<EOF
wx b8410d4300
e asm.arch=x86
ahi s
e cfg.bigendian=false
pi 1
e cfg.bigendian=true
pi 1
EOF
EXPECT=<<EOF
mov eax, 'C\x0dA'
mov eax, 'A\x0dC'
EOF
RUN
NAME=ahi s + endian 2
FILE=-
CMDS=<<EOF
wx b841424300
e asm.arch=x86
e asm.bits=32
ahi s
e cfg.bigendian=false
pi 1
e cfg.bigendian=true
pi 1
EOF
EXPECT=<<EOF
mov eax, 'CBA'
mov eax, 'ABC'
EOF
RUN
NAME=1: ahi none
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
pi 1
EOF
EXPECT=<<EOF
sub rsp, 0x648
EOF
RUN
NAME=ahi with colors
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
e scr.color=1
wx 4881ec48060000
pd 1
ahi 10
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 0x648
0x00000000 4881ec4806.. sub rsp, 1608
EOF
RUN
NAME=ahi 0x41 -> 'A'
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
wx 4883f841 # cmp rax, 0x41
pi 1
ahi s
pi 1
EOF
EXPECT=<<EOF
cmp rax, 0x41
cmp rax, 'A'
EOF
RUN
NAME=ahi 0xe -> 1
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
wx 4883f80e # cmp rax, 0xe
pi 1
ahi 2
pi 1
EOF
EXPECT=<<EOF
cmp rax, 0xe
cmp rax, 1110b
EOF
RUN
NAME=ahi 4 -> 1
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
wx 4883f804 # cmp rax, 4
pi 1
ahi 2
pi 1
EOF
EXPECT=<<EOF
cmp rax, 4
cmp rax, 100b
EOF
RUN
NAME=2: ahi none
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 0x648
EOF
RUN
NAME=3: ahi none
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
ahi 16
wx 4881ec48060000
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 0x648
EOF
RUN
NAME=1: ahi 10
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
ahi 10
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 1608
EOF
RUN
NAME=ahi 8
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
ahi 8
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 03110
EOF
RUN
NAME=1: ahi 2
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
ahi 2
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 11001001000b
EOF
RUN
NAME=ahi 2 - pi
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
ahi 2
pi 1
EOF
EXPECT=<<EOF
sub rsp, 11001001000b
EOF
RUN
NAME=2: ahi 2
FILE=malloc://16
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 4883e4f0
ahi 2
pi 1
EOF
EXPECT=<<EOF
and rsp, 1111111111111111111111111111111111111111111111111111111111110000b
EOF
RUN
NAME=2: ahi 10
FILE=malloc://16
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 4883e4f0
ahi 10
pi 1
EOF
EXPECT=<<EOF
and rsp, -16
EOF
RUN
NAME=1: ahi s
FILE=malloc://16
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx b841414141
ahi s
pi 1
EOF
EXPECT=<<EOF
mov eax, 'AAAA'
EOF
RUN
NAME=ah*
FILE=malloc://16
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 4883e4f0
ahi 10 @ 0x00404879
ah*
EOF
EXPECT=<<EOF
ahi 10 @ 0x404879
EOF
RUN
NAME=ah.
FILE=malloc://16
CMDS=<<EOF
ahi 10 @ 0x8
s 0x8
ah.
EOF
EXPECT=<<EOF
0x00000008 => immbase=10
EOF
RUN
NAME=64bit ahi 10
FILE=-
ARGS=-m 0x100001000
CMDS=<<EOF
e io.va
e asm.sub.rel=false
e asm.hint.lea=false
e asm.arch=x86
e asm.bits=64
e io.va=true
wx c7055f44000000000000
pd 1
e asm.sub.rel=true; pd 1
ahi 10; pd 1
EOF
EXPECT=<<EOF
true
0x100001000 c7055f4400.. mov dword [rip + 0x445f], 0 ; [0x100005469:4]=-1
0x100001000 c7055f4400.. mov dword [0x100005469], 0 ; [0x100005469:4]=-1
0x100001000 c7055f4400.. mov dword [4294988905], 0 ; [0x100005469:4]=-1
EOF
RUN
NAME=2: ahi s
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 67c744246864616572
pi 1
ahi1 s
pi 1
EOF
EXPECT=<<EOF
mov dword [esp + 0x68], 0x72656164
mov dword [esp + 0x68], 'read'
EOF
RUN
NAME=ahi s 2
FILE=-
CMDS=<<EOF
wx b868584d56
e asm.arch=x86
e asm.bits=64
ahi s
pi 1
EOF
EXPECT=<<EOF
mov eax, 'VMXh'
EOF
RUN
NAME=ahi s - pd with colors
FILE=-
CMDS=<<EOF
e asm.bytes=false
e asm.comments=false
e asm.bits=64
e asm.arch=x86
wx 67c74424681b5b306d
ahi1 s
e scr.color=0
pd 1
e scr.color=1
pd 1
EOF
EXPECT=<<EOF
0x00000000 mov dword [esp + 0x68], 'm0[\x1b'
0x00000000 mov dword [esp + 0x68], 'm0[\x1b'
EOF
RUN
NAME=ahi nword
FILE=-
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
e asm.bytes=false
wx c7458843c6ff00
pid 1
ahi 10
pid 1
ahi-
ahi1 10
pid 1
EOF
EXPECT=<<EOF
0x00000000 mov dword [rbp - 0x78], 0xffc643
0x00000000 mov dword [rbp - 120], 0xffc643
0x00000000 mov dword [rbp - 0x78], 16762435
EOF
RUN
NAME=ahi 10 and 10u imm (x86_32)
ARGS=-a x86 -b 32
FILE=-
CMDS=<<EOF
e asm.bytes=false
"wa cmp eax, -1"
pd 1
ahi 10
pd 1
ahi 10u
pd 1
EOF
EXPECT=<<EOF
0x00000000 cmp eax, 0xffffffff
0x00000000 cmp eax, -1
0x00000000 cmp eax, 4294967295
EOF
RUN
NAME=ahi 10 and 10u imm (x86_64)
ARGS=-a x86 -b 64
FILE=-
CMDS=<<EOF
e asm.bytes=false
"wa cmp eax, -1"
pd 1
ahi 10
pd 1
ahi 10u
pd 1
?e
ah-
"wa cmp rax, -1"
pd 1
ahi 10
pd 1
ahi 10u
pd 1
EOF
EXPECT=<<EOF
0x00000000 cmp eax, 0xffffffff
0x00000000 cmp eax, -1
0x00000000 cmp eax, 4294967295
0x00000000 cmp rax, 0xffffffffffffffff
0x00000000 cmp rax, -1
0x00000000 cmp rax, 18446744073709551615
EOF
RUN
NAME=ahi 31 small integer
ARGS=-a arm -b 64
FILE=-
CMDS=<<EOF
wx fd430191
pd 1
ahi 31
pd 1
EOF
EXPECT=<<EOF
0x00000000 fd430191 add x29, sp, 0x50
0x00000000 fd430191 add x29, sp, 0x28
EOF
RUN
FILE=-
CMDS=<<EOF
wx b8410d4300
e asm.arch=x86
ahi s
e cfg.bigendian=false
pi 1
e cfg.bigendian=true
pi 1
EOF
EXPECT=<<EOF
mov eax, 'C\x0dA'
mov eax, 'A\x0dC'
EOF
RUN
NAME=ahi s + endian 2
FILE=-
CMDS=<<EOF
wx b841424300
e asm.arch=x86
e asm.bits=32
ahi s
e cfg.bigendian=false
pi 1
e cfg.bigendian=true
pi 1
EOF
EXPECT=<<EOF
mov eax, 'CBA'
mov eax, 'ABC'
EOF
RUN
NAME=1: ahi none
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
pi 1
EOF
EXPECT=<<EOF
sub rsp, 0x648
EOF
RUN
NAME=ahi with colors
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
e scr.color=1
wx 4881ec48060000
pd 1
ahi 10
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 0x648
0x00000000 4881ec4806.. sub rsp, 1608
EOF
RUN
NAME=ahi 0x41 -> 'A'
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
wx 4883f841 # cmp rax, 0x41
pi 1
ahi s
pi 1
EOF
EXPECT=<<EOF
cmp rax, 0x41
cmp rax, 'A'
EOF
RUN
NAME=ahi 0xe -> 1
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
wx 4883f80e # cmp rax, 0xe
pi 1
ahi 2
pi 1
EOF
EXPECT=<<EOF
cmp rax, 0xe
cmp rax, 1110b
EOF
RUN
NAME=ahi 4 -> 1
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
wx 4883f804 # cmp rax, 4
pi 1
ahi 2
pi 1
EOF
EXPECT=<<EOF
cmp rax, 4
cmp rax, 100b
EOF
RUN
NAME=2: ahi none
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 0x648
EOF
RUN
NAME=3: ahi none
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
ahi 16
wx 4881ec48060000
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 0x648
EOF
RUN
NAME=1: ahi 10
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
ahi 10
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 1608
EOF
RUN
NAME=ahi 8
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
ahi 8
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 03110
EOF
RUN
NAME=1: ahi 2
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
ahi 2
pd 1
EOF
EXPECT=<<EOF
0x00000000 4881ec4806.. sub rsp, 11001001000b
EOF
RUN
NAME=ahi 2 - pi
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 4881ec48060000
ahi 2
pi 1
EOF
EXPECT=<<EOF
sub rsp, 11001001000b
EOF
RUN
NAME=2: ahi 2
FILE=malloc://16
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 4883e4f0
ahi 2
pi 1
EOF
EXPECT=<<EOF
and rsp, 1111111111111111111111111111111111111111111111111111111111110000b
EOF
RUN
NAME=2: ahi 10
FILE=malloc://16
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 4883e4f0
ahi 10
pi 1
EOF
EXPECT=<<EOF
and rsp, -16
EOF
RUN
NAME=1: ahi s
FILE=malloc://16
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx b841414141
ahi s
pi 1
EOF
EXPECT=<<EOF
mov eax, 'AAAA'
EOF
RUN
NAME=ah*
FILE=malloc://16
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 4883e4f0
ahi 10 @ 0x00404879
ah*
EOF
EXPECT=<<EOF
ahi 10 @ 0x404879
EOF
RUN
NAME=ah.
FILE=malloc://16
CMDS=<<EOF
ahi 10 @ 0x8
s 0x8
ah.
EOF
EXPECT=<<EOF
0x00000008 => immbase=10
EOF
RUN
NAME=64bit ahi 10
FILE=-
ARGS=-m 0x100001000
CMDS=<<EOF
e io.va
e asm.sub.rel=false
e asm.hint.lea=false
e asm.arch=x86
e asm.bits=64
e io.va=true
wx c7055f44000000000000
pd 1
e asm.sub.rel=true; pd 1
ahi 10; pd 1
EOF
EXPECT=<<EOF
true
0x100001000 c7055f4400.. mov dword [rip + 0x445f], 0 ; [0x100005469:4]=-1
0x100001000 c7055f4400.. mov dword [0x100005469], 0 ; [0x100005469:4]=-1
0x100001000 c7055f4400.. mov dword [4294988905], 0 ; [0x100005469:4]=-1
EOF
RUN
NAME=2: ahi s
FILE=-
CMDS=<<EOF
e asm.bits=64
e asm.arch=x86
wx 67c744246864616572
pi 1
ahi1 s
pi 1
EOF
EXPECT=<<EOF
mov dword [esp + 0x68], 0x72656164
mov dword [esp + 0x68], 'read'
EOF
RUN
NAME=ahi s 2
FILE=-
CMDS=<<EOF
wx b868584d56
e asm.arch=x86
e asm.bits=64
ahi s
pi 1
EOF
EXPECT=<<EOF
mov eax, 'VMXh'
EOF
RUN
NAME=ahi s - pd with colors
FILE=-
CMDS=<<EOF
e asm.bytes=false
e asm.comments=false
e asm.bits=64
e asm.arch=x86
wx 67c74424681b5b306d
ahi1 s
e scr.color=0
pd 1
e scr.color=1
pd 1
EOF
EXPECT=<<EOF
0x00000000 mov dword [esp + 0x68], 'm0[\x1b'
0x00000000 mov dword [esp + 0x68], 'm0[\x1b'
EOF
RUN
NAME=ahi nword
FILE=-
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
e asm.bytes=false
wx c7458843c6ff00
pid 1
ahi 10
pid 1
ahi-
ahi1 10
pid 1
EOF
EXPECT=<<EOF
0x00000000 mov dword [rbp - 0x78], 0xffc643
0x00000000 mov dword [rbp - 120], 0xffc643
0x00000000 mov dword [rbp - 0x78], 16762435
EOF
RUN
NAME=ahi 10 and 10u imm (x86_32)
ARGS=-a x86 -b 32
FILE=-
CMDS=<<EOF
e asm.bytes=false
"wa cmp eax, -1"
pd 1
ahi 10
pd 1
ahi 10u
pd 1
EOF
EXPECT=<<EOF
0x00000000 cmp eax, 0xffffffff
0x00000000 cmp eax, -1
0x00000000 cmp eax, 4294967295
EOF
RUN
NAME=ahi 10 and 10u imm (x86_64)
ARGS=-a x86 -b 64
FILE=-
CMDS=<<EOF
e asm.bytes=false
"wa cmp eax, -1"
pd 1
ahi 10
pd 1
ahi 10u
pd 1
?e
ah-
"wa cmp rax, -1"
pd 1
ahi 10
pd 1
ahi 10u
pd 1
EOF
EXPECT=<<EOF
0x00000000 cmp eax, 0xffffffff
0x00000000 cmp eax, -1
0x00000000 cmp eax, 4294967295
0x00000000 cmp rax, 0xffffffffffffffff
0x00000000 cmp rax, -1
0x00000000 cmp rax, 18446744073709551615
EOF
RUN
NAME=ahi 31 small integer
ARGS=-a arm -b 64
FILE=-
CMDS=<<EOF
wx fd430191
pd 1
ahi 31
pd 1
EOF
EXPECT=<<EOF
0x00000000 fd430191 add x29, sp, 0x50
0x00000000 fd430191 add x29, sp, 0x28
EOF
RUN