radare2/test/new/db/cmd/cmd_ahi
Khairul Azhar Kasmiran 781fcccf55
Move CMDS= before EXPECT= in tests (#16417)
* Move CMDS= before EXPECT= in tests

* Revert "Move CMDS= before EXPECT= in tests"

This reverts commit 13a9085a36.

* Move CMDS= before EXPECT= in tests, take 2

* Revert "Move CMDS= before EXPECT= in tests, take 2"

This reverts commit 7c0bf6d8e3.

* Move CMDS= before EXPECT= in tests, take 3

Co-authored-by: pancake <pancake@nopcode.org>
2020-04-05 20:56:06 +08:00

4.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
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 4881ec480600. sub rsp, 0x648
0x00000000 4881ec480600. 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 4881ec480600. 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 4881ec480600. 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 4881ec480600. 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 4881ec480600. 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 4881ec480600. 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.relsub=false
e asm.leahints=false
e asm.arch=x86
e asm.bits=64
e io.va=true
wx c7055f44000000000000
pd 1
e asm.relsub=true; pd 1
ahi 10; pd 1
EOF
EXPECT=<<EOF
true
0x100001000 c7055f440000. mov dword [rip + 0x445f], 0 ; [0x100005469:4]=-1
0x100001000 c7055f440000. mov dword [0x100005469], 0 ; [0x100005469:4]=-1
0x100001000 c7055f440000. 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