radare2/test/db/cmd/cmd_pd_bugs

290 lines
4.4 KiB
Plaintext

NAME=pd call sym bug
FILE=bins/mach0/hello-objc-arm
CMDS=<<EOF
e asm.lines.jmp=0
e asm.bytes=0
e asm.comments=0
s sym.static_int_Test::callMeNot__
pd 20~?NSLog
af
pd 20~?NSLog
EOF
EXPECT=<<EOF
1
1
EOF
RUN
NAME=pd arm cortex 0
FILE=-
ARGS=-a arm -b 16
CMDS=wx 80f30988; pi 1
EXPECT=<<EOF
invalid
EOF
RUN
NAME=pd arm cortex 1
FILE=-
ARGS=-a arm -b 16 -e asm.cpu=cortex
CMDS=wx 80f30988;pi 1
EXPECT=<<EOF
msr psp, r0
EOF
RUN
NAME=pd arm cortex 2
FILE=-
ARGS=-a arm -b 16
CMDS=e asm.cpu=cortex;wx 80f30988;pi 1
EXPECT=<<EOF
msr psp, r0
EOF
RUN
NAME=pd call sym bug
FILE=bins/mach0/hello-objc-arm
CMDS=<<EOF
e asm.lines.jmp=0
e asm.bytes=0
e asm.comments=0
s sym.static_int_Test::callMeNot
# s+2
pi 2
EOF
EXPECT=<<EOF
push {r7, lr}
mov r7, sp
EOF
RUN
NAME=call fcn eip 32bit
FILE=bins/elf/analysis/ls-alxchk
CMDS=<<EOF
s 0x5e50
e asm.bits=32
af; afn eip
pd 1 @ 0x5f16~:0
e asm.lines.jmp=0
e asm.bytes=0
e asm.comments=0
EOF
EXPECT=<<EOF
0x00005f16 e835ffffff call fcn.00005e50
EOF
RUN
NAME=call fcn eip 64bit
FILE=bins/elf/analysis/ls-alxchk
BROKEN=1
CMDS=<<EOF
s 0x5e50
e asm.bits=64
af; afn eip
pd 1 @ 0x5f16~:0
e asm.lines.jmp=0
e asm.bytes=0
e asm.comments=0
EOF
EXPECT=<<EOF
| 0x00005f16 e835ffffff call fcn.eip
EOF
RUN
NAME=call fcn rip 64bit
FILE=bins/elf/analysis/ls-alxchk
CMDS=<<EOF
s 0x5e50
e asm.bits=64
af; afn rip
pd 1 @ 0x5f16~:0
e asm.lines.jmp=0
e asm.bytes=0
e asm.comments=0
EOF
EXPECT=<<EOF
0x00005f16 e835ffffff call fcn.00005e50
EOF
RUN
NAME=lea edx bug segfault for x86 32bit #5710@radare2
FILE=malloc://128
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
e asm.lines.jmp=false
e asm.comments=false
pD@x:8d15d0830408
EOF
EXPECT=<<EOF
0x00000000 8d15d0830408 lea edx, [0x80483d0]
EOF
RUN
NAME=p8@x
FILE=malloc://128
CMDS=<<EOF
e asm.comments=false
p8@x:8d15d0830408
EOF
EXPECT=<<EOF
8d15d0830408
EOF
RUN
NAME=px@x
FILE=malloc://128
CMDS=<<EOF
e asm.comments=false
e hex.header=false
px@x:8d15d0830408
EOF
EXPECT=<<EOF
0x00000000 8d15 d083 0408 ......
EOF
RUN
NAME=size of function in elf x64 stub
FILE=bins/other/radiff2/hellocxx-osx-fat-intel_1
ARGS=-ax86 -b64
CMDS=<<EOF
s 0x100000dae
af
afi~^size[1]
EOF
EXPECT=<<EOF
6
EOF
RUN
NAME=crackme test
FILE=bins/elf/crackme
CMDS=<<EOF
pd 2
pi 2
EOF
EXPECT=<<EOF
;-- section..text:
;-- .text:
;-- entry0:
;-- _start:
0x004005c0 31ed xor ebp, ebp ; [14] -r-x section size 584 named .text
0x004005c2 4989d1 mov r9, rdx
xor ebp, ebp
mov r9, rdx
EOF
RUN
NAME=indent asm.lines.fcn=0, asm.lines.jmp=1 for issue 9316
FILE=-
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
af+ 0 test
e asm.lines.fcn=0
e asm.lines.jmp=1
pd 2
EOF
EXPECT=<<EOF
0: test ();
0x00000000 0000 add byte [rax], al
0x00000002 0000 add byte [rax], al
EOF
RUN
NAME=indent asm.lines.fcn=1, asm.lines.jmp=0 for issue 9316
FILE=-
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
af+ 0 test
e asm.lines.fcn=1
e asm.lines.jmp=0
pd 2
EOF
EXPECT=<<EOF
/ 0: test ();
0x00000000 0000 add byte [rax], al
0x00000002 0000 add byte [rax], al
EOF
RUN
NAME=asm.flgoff indent
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e asm.flags.offset=1
s sym.check
pd 1
EOF
EXPECT=<<EOF
0x080484c8 ;-- check:
0x080484c8 55 push ebp
EOF
RUN
NAME=invalid pid and pdi
FILE=bins/mach0/ls-osx-x86_64
# BROKEN=1
CMDS=<<EOF
pdi 270~invalid
?e ----
pid 270~invalid
pd 1
EOF
EXPECT=<<EOF
----
;-- main:
;-- entry0:
;-- func.1000013d8:
0x1000013d8 55 push rbp
EOF
RUN
NAME=asm.tabs.once
FILE=bins/mach0/ls-osx-x86_64
CMDS=<<EOF
e asm.tabs=8
e asm.tabs.once=true
e asm.bytes=false
e asm.lines=false
pd 5
pdJ 3~{}
EOF
EXPECT=<<EOF
;-- main:
;-- entry0:
;-- func.1000013d8:
0x1000013d8 push rbp
0x1000013d9 mov rbp, rsp
0x1000013dc push r15
0x1000013de push r14
0x1000013e0 push r13
[
{
"offset": 4294972376,
"text": ";-- main:"
},
{
"offset": 4294972376,
"text": ";-- entry0:"
},
{
"offset": 4294972376,
"text": ";-- func.1000013d8:"
},
{
"offset": 4294972376,
"text": "0x1000013d8 push rbp"
},
{
"offset": 4294972377,
"text": "0x1000013d9 mov rbp, rsp"
},
{
"offset": 4294972380,
"text": "0x1000013dc push r15"
}
]
EOF
RUN