radare2/test/db/cmd/cmd_disassembly
2024-02-06 12:40:54 +01:00

329 lines
6.3 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NAME=disasm cmp ascii
FILE=-
CMDS=<<EOF
e asm.arch=x86
wx 3c6f 3d1027
pd 2
EOF
EXPECT=<<EOF
0x00000000 3c6f cmp al, 0x6f ; 'o'
0x00000002 3d10270000 cmp eax, 0x2710 ; '\x10\''
EOF
RUN
NAME=infinite x/i disasm bug
FILE=-
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
x/i 32
?e works
EOF
EXPECT=<<EOF
works
EOF
RUN
NAME=flags subst bug
FILE=-
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e asm.lines=0
e asm.bytes=0
wx eab70394
f sym.imp.objc_msgSend=0xedfa8
pd 1
EOF
EXPECT=<<EOF
0x00000000 bl sym.imp.objc_msgSend
EOF
RUN
NAME=flags subst bug 2
FILE=-
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e asm.lines=0
e asm.cmt.col=30
e asm.bytes=0
e asm.sub.jmp = false
wx eab70394
f sym.imp.objc_msgSend=0xedfa8
pd 1
EOF
EXPECT=<<EOF
0x00000000 bl 0xedfa8 ; sym.imp.objc_msgSend
EOF
RUN
NAME=flags order by space
FILE=bins/elf/hello_world
CMDS=<<EOF
e asm.flags.inline=false
pd 1
EOF
EXPECT=<<EOF
;-- section..text:
;-- entry0:
;-- _start:
0x000006a0 31ed xor ebp, ebp ; [14] -r-x section size 546 named .text
EOF
RUN
NAME=pD@x:90
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits= 32
pD@x:90
EOF
EXPECT=<<EOF
0x00000000 90 nop
EOF
RUN
NAME=pd@x:90
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits= 32
pd@x:90
EOF
EXPECT=<<EOF
0x00000000 90 nop
EOF
RUN
NAME=pd@x:90909090
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits= 32
pd@x:90909090
EOF
EXPECT=<<EOF
0x00000000 90 nop
0x00000001 90 nop
0x00000002 90 nop
0x00000003 90 nop
EOF
RUN
NAME=pd@x:909090
FILE=-
CMDS=<<EOF
e asm.arch = x86
e asm.bits= 32
pd@x:909090
EOF
EXPECT=<<EOF
0x00000000 90 nop
0x00000001 90 nop
0x00000002 90 nop
EOF
RUN
NAME=pd 4;?=
FILE=-
CMDS=<<EOF
wx 00000000000000000000
e asm.arch=x86
e asm.bits=32
pd 4
?=
EOF
EXPECT=<<EOF
0x00000000 0000 add byte [eax], al
0x00000002 0000 add byte [eax], al
0x00000004 0000 add byte [eax], al
0x00000006 0000 add byte [eax], al
0x8
EOF
RUN
NAME=pd 4 > /dev/null; ?=
FILE=-
CMDS=<<EOF
wx 00000000000000000000
e asm.arch=x86
e asm.bits=32
pd 4 > /dev/null
?=
EOF
EXPECT=<<EOF
0x8
EOF
RUN
NAME=wx e9010f;?v $l
FILE=-
CMDS=<<EOF
wx e9010f
e asm.arch=x86
e asm.bits=16
?vi $l
pi 1
ao 1~size[1]
EOF
EXPECT=<<EOF
3
jmp 0xf04
3
EOF
RUN
NAME=dis-16/32/64
FILE=-
CMDS=<<EOF
wx e99300 e869390000 e828350000
e asm.arch=x86
e asm.segoff=1
e asm.bits=16
pi 1
s+3
e asm.segoff=0
e asm.bits=32
pi 1
s+5
e asm.bits=64
pi 1
EOF
EXPECT=<<EOF
jmp 0x96
call 0x3971
call 0x3535
EOF
RUN
NAME=unaligned thumb code
FILE=-
CMDS=<<EOF
wx 00000000
e asm.bits=16
e asm.arch=arm
pi 1 @ 1
EOF
EXPECT=<<EOF
unaligned
EOF
RUN
NAME=unaligned arm code
FILE=-
CMDS=<<EOF
wx 00000000
e asm.bits=32
e asm.arch=arm
pi 1 @ 2
EOF
EXPECT=<<EOF
unaligned
EOF
RUN
NAME=unaligned x86 issue
FILE=-
CMDS=<<EOF
wx 00000000
e asm.arch=arm
e asm.bits=16
pi 2
e asm.arch=x86
pi 1 @ 1
EOF
EXPECT=<<EOF
movs r0, r0
movs r0, r0
add byte [bx + si], al
EOF
RUN
NAME=reflines on last line
FILE=-
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
e scr.utf8=0
e asm.lines.jmp=1
e asm.comments=0
wx 803d1ca0040833740ceb1c83c004a318a0088ffd2a118a00408b1085d275eb
pd 12~?=
pd 13~?=
EOF
EXPECT=<<EOF
3
3
EOF
RUN
NAME=byte spacing and align in disasm
FILE=-
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
e scr.utf8=0
e asm.lines.jmp=1
e asm.comments=0
wx 803d1ca0040833740ceb1c83c004a318a0088ffd2a118a00408b1085d275eb
e asm.bytes.space=0
e asm.bytes.align=0
pd 10
?e --
e asm.bytes.align = true
pd 10
?e --
e asm.bytes.space = true
pd 10
?e --
e asm.bytes.align = true
pd 10
EOF
EXPECT=<<EOF
0x00000000 803d1ca004.. cmp byte [0x804a01c], 0x33
,=< 0x00000007 740c je 0x15
,==< 0x00000009 eb1c jmp 0x27
|| 0x0000000b 83c004 add eax, 4
|| 0x0000000e a318a0088f mov dword [0x8f08a018], eax
|| 0x00000013 fd std
|| 0x00000014 2a11 sub dl, byte [ecx]
| 0x00000016 8a00 mov al, byte [eax]
| 0x00000018 40 inc eax
| 0x00000019 8b10 mov edx, dword [eax]
--
0x00000000 803d1ca004.. cmp byte [0x804a01c], 0x33
,=< 0x00000007 740c je 0x15
,==< 0x00000009 eb1c jmp 0x27
|| 0x0000000b 83c004 add eax, 4
|| 0x0000000e a318a0088f mov dword [0x8f08a018], eax
|| 0x00000013 fd std
|| 0x00000014 2a11 sub dl, byte [ecx]
| 0x00000016 8a00 mov al, byte [eax]
| 0x00000018 40 inc eax
| 0x00000019 8b10 mov edx, dword [eax]
--
0x00000000 80 3d 1c a0 .. cmp byte [0x804a01c], 0x33
,=< 0x00000007 74 0c je 0x15
,==< 0x00000009 eb 1c jmp 0x27
|| 0x0000000b 83 c0 04 add eax, 4
|| 0x0000000e a3 18 a0 08 .. mov dword [0x8f08a018], eax
|| 0x00000013 fd std
|| 0x00000014 2a 11 sub dl, byte [ecx]
| 0x00000016 8a 00 mov al, byte [eax]
| 0x00000018 40 inc eax
| 0x00000019 8b 10 mov edx, dword [eax]
--
0x00000000 80 3d 1c a0 .. cmp byte [0x804a01c], 0x33
,=< 0x00000007 74 0c je 0x15
,==< 0x00000009 eb 1c jmp 0x27
|| 0x0000000b 83 c0 04 add eax, 4
|| 0x0000000e a3 18 a0 08 .. mov dword [0x8f08a018], eax
|| 0x00000013 fd std
|| 0x00000014 2a 11 sub dl, byte [ecx]
| 0x00000016 8a 00 mov al, byte [eax]
| 0x00000018 40 inc eax
| 0x00000019 8b 10 mov edx, dword [eax]
EOF
RUN