* RzBin/ELF: avoid the creation of useless flags at 0 Use UT64_MAX as an error value for addresses like symbols, imports, sections, etc., and do not create flags for those because they are not meaningful. This is useful for imports that do not have an address in the virtual/file space and for non-alloc sections (e.g. .comment).
233 lines
3.5 KiB
Text
233 lines
3.5 KiB
Text
NAME=pd call sym bug
|
|
FILE=bins/mach0/hello-objc-arm
|
|
CMDS=<<EOF
|
|
e asm.lines.bb=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
|
|
EXPECT_ERR=
|
|
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
|
|
EXPECT_ERR=
|
|
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
|
|
EXPECT_ERR=
|
|
RUN
|
|
|
|
NAME=pd call sym bug
|
|
FILE=bins/mach0/hello-objc-arm
|
|
CMDS=<<EOF
|
|
e asm.lines.bb=0
|
|
e asm.bytes=0
|
|
e asm.comments=0
|
|
s sym.static_int_Test::callMeNot
|
|
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.bytes=true
|
|
e asm.bits=32
|
|
af; afn eip
|
|
pd 1 @ 0x5f16~:0
|
|
e asm.lines.bb=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.bytes=true
|
|
e asm.bits=64
|
|
af; afn eip
|
|
pd 1 @ 0x5f16~:0
|
|
e asm.lines.bb=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
|
|
e asm.bytes=true
|
|
af; afn rip
|
|
pd 1 @ 0x5f16~:0
|
|
e asm.lines.bb=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@rizin
|
|
FILE=malloc://128
|
|
CMDS=<<EOF
|
|
e asm.arch=x86
|
|
e asm.bytes=true
|
|
e asm.bits=32
|
|
e asm.lines.bb=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/rz-diff/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
|
|
e asm.bytes=true
|
|
pd 2
|
|
pi 2
|
|
EOF
|
|
EXPECT=<<EOF
|
|
;-- entry0:
|
|
;-- section..text:
|
|
;-- .text:
|
|
;-- _start:
|
|
0x004005c0 31ed xor ebp, ebp ; [13] -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.bb=1 for issue 9316
|
|
FILE==
|
|
CMDS=<<EOF
|
|
e asm.bytes=true
|
|
e asm.arch=x86
|
|
e asm.bits=64
|
|
af+ test @ 0
|
|
e asm.lines.fcn=0
|
|
e asm.lines.bb=1
|
|
pd 2
|
|
EOF
|
|
EXPECT=<<EOF
|
|
test ();
|
|
0x00000000 0000 add byte [rax], al
|
|
0x00000002 0000 add byte [rax], al
|
|
EOF
|
|
RUN
|
|
|
|
NAME=indent asm.lines.fcn=1, asm.lines.bb=0 for issue 9316
|
|
FILE==
|
|
CMDS=<<EOF
|
|
e asm.arch=x86
|
|
e asm.bytes=true
|
|
e asm.bits=64
|
|
af+ test @ 0
|
|
e asm.lines.fcn=1
|
|
e asm.lines.bb=0
|
|
pd 2
|
|
EOF
|
|
EXPECT=<<EOF
|
|
/ 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.bytes=true
|
|
e asm.flags.offset=1
|
|
s sym.check
|
|
pd 1
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x080484c8 ;-- check:
|
|
0x080484c8 55 push ebp
|
|
EOF
|
|
RUN
|