radare2/test/new/db/cmd/feat_variables
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

409 lines
4.1 KiB
Plaintext

NAME=hello-arm32
FILE=../bins/elf/analysis/hello-arm32
CMDS=<<EOF
?v $M
?v $s
EOF
EXPECT=<<EOF
0x10000
0x90c
EOF
RUN
NAME=hello-arm32
FILE=../bins/elf/analysis/hello-arm32
ARGS=-B 0x4000
CMDS=<<EOF
?v $M
?v $s
EOF
EXPECT=<<EOF
0x4000
0x90c
EOF
RUN
NAME=$FB (fcn-begin)
FILE=malloc://1024
CMDS=<<EOF
s 42
af
s 44
s $FB
s
EOF
EXPECT=<<EOF
0x2a
EOF
RUN
NAME=$$ (malloc)
FILE=malloc://1024
CMDS=<<EOF
?v $$
s 42
?v $$
s-
?v $$
EOF
EXPECT=<<EOF
0x0
0x2a
0x0
EOF
RUN
NAME=$$$ (malloc)
FILE=-
CMDS=<<EOF
?v $$ @ 0x300
?v $$$ @ 0x300
s 0x123
?v $$ @ 0x300
?v $$$ @ 0x300
?e
(test; ?v $$$)
.(test)
.(test) @ 0x300
s
(test2; .(test) @ 0x400)
.(test2)
s
.(test2) @ 0x300
s
EOF
EXPECT=<<EOF
0x300
0x0
0x300
0x123
0x123
0x123
0x123
0x123
0x123
0x123
0x123
EOF
RUN
NAME=nested $$
FILE=-
CMDS=<<EOF
(nested_seek; ?v $$)
.(nested_seek) @ 0x500
(nested_seek2; ?v $$; .(nested_seek) @ 0x600; ?v $$)
.(nested_seek2) @ 0x700
EOF
EXPECT=<<EOF
0x500
0x700
0x600
0x700
EOF
RUN
NAME=no seek change on pdf @ addr (#10007)
FILE=../bins/elf/redpill
CMDS=<<EOF
e asm.bytes=false
af @ 0x1a71
s entry0
s
pdf @ 0x1a71 > /dev/null
s # should be the same as before
EOF
EXPECT=<<EOF
0xf40
0xf40
EOF
RUN
NAME=$o (malloc)
FILE=malloc://1024
CMDS=<<EOF
?v $o
s 42
?v $o
s-
?v $o
EOF
EXPECT=<<EOF
0x0
0x2a
0x0
EOF
RUN
NAME=$s (malloc)
FILE=malloc://1024
CMDS=?v $s
EXPECT=<<EOF
0x400
EOF
RUN
NAME=$j (malloc)
FILE=malloc://1024
CMDS=<<EOF
e asm.bits=32
e asm.arch = x86
e anal.arch = x86
wa jmp 0x30
?v $j
wa jz 0x01
?v $j
wa xor eax, eax
?v $j
?e
EOF
EXPECT=<<EOF
0x30
0x1
0xffffffffffffffff
EOF
RUN
NAME=$f (malloc)
FILE=malloc://1024
CMDS=<<EOF
e asm.bits=32
e asm.arch = x86
e anal.arch = x86
wx eb2e
?v $f
wx 0f84fbffffff
?v $f
wx 31c0
?v $f
EOF
EXPECT=<<EOF
0xffffffffffffffff
0x6
0xffffffffffffffff
EOF
RUN
NAME=$m (malloc)
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wa mov eax, [0x500]
?v $m
wa mov eax, ebx
?v $m
?e
EOF
EXPECT=<<EOF
0x500
0xffffffffffffffff
EOF
RUN
NAME=$l (malloc)
FILE=malloc://1024
CMDS=<<EOF
e asm.bits=32
e asm.arch = x86
e anal.arch = x86
wa xor eax, eax
?v $l
wa mov esp, 0x1
?v $l
wx c3
?v $l
EOF
EXPECT=<<EOF
0x2
0x5
0x1
EOF
RUN
NAME=$e (malloc)
FILE=-
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wa inc eax
?v $e
wa jmp 0x01
?v $e
wa ret
?v $e
wa call 0x01
?v $e
EOF
EXPECT=<<EOF
0x0
0x1
0x1
0x0
EOF
RUN
NAME=$e (malloc) 2
FILE=malloc://1024
CMDS=<<EOF
e asm.bits = 0x20
?v ${asm.bits}
EOF
EXPECT=<<EOF
0x20
EOF
RUN
NAME=$e (malloc) 3
FILE=malloc://1024
CMDS=<<EOF
? 5+3
?v $?
? 0
?v $?
EOF
EXPECT=<<EOF
int32 8
uint32 8
hex 0x8
octal 010
unit 8
segment 0000:0008
string "\b"
fvalue: 8.0
float: 0.000000f
double: 0.000000
binary 0b00001000
trits 0t22
0x8
int32 0
uint32 0
hex 0x0
octal 00
unit 0
segment 0000:0000
string "\0"
fvalue: 0.0
float: 0.000000f
double: 0.000000
binary 0b00000000
trits 0t0
0x0
EOF
RUN
NAME=$$ (x86-simple)
FILE=../bins/elf/analysis/x86-simple
CMDS=<<EOF
?v $$
s 42
?v $$
s-
?v $$
EOF
EXPECT=<<EOF
0x8048060
0x2a
0x8048060
EOF
RUN
NAME=$o (x86-simple)
FILE=../bins/elf/analysis/x86-simple
CMDS=<<EOF
?v $o
s 42
?v $o
s-
?v $o
EOF
EXPECT=<<EOF
0x60
0x2a
0x60
EOF
RUN
NAME=$b (x86-simple)
FILE=../bins/elf/analysis/x86-simple
CMDS=<<EOF
e asm.bits=32
e asm.arch = x86
e anal.arch = x86
b 123
?v $b
? $b
EOF
EXPECT=<<EOF
0x7b
int32 123
uint32 123
hex 0x7b
octal 0173
unit 123
segment 0000:007b
string "{"
fvalue: 123.0
float: 0.000000f
double: 0.000000
binary 0b01111011
trits 0t11120
EOF
RUN
NAME=$s (x86-simple)
FILE=../bins/elf/analysis/x86-simple
CMDS=?v $s
EXPECT=<<EOF
0xfc
EOF
RUN
NAME=?p and ?P
FILE=../bins/elf/analysis/simple.elf
CMDS=<<EOF
?p 0x08000060
?P 0x00000060
EOF
EXPECT=<<EOF
0x00000060
0x08000060
EOF
RUN
NAME=?p and ?P
FILE=../bins/elf/analysis/simple.elf
CMDS=<<EOF
?p 0xdeadbeef
?P 0xdeadbeef
EOF
EXPECT=<<EOF
no map at 0xdeadbeef
no map at 0xdeadbeef
EOF
RUN
NAME=$s{flag} and $SS (sections context)
FILE=../bins/elf/before-after-main
CMDS=<<EOF
iSS~LOAD1
iS~.preinit_array
?e
s segment.LOAD1
?vi $s{segment.LOAD1}
?vi $s{section..preinit_array}
?vi $SS
EOF
EXPECT=<<EOF
3 0x00000ed4 0x14c 0x08049ed4 0x150 -rw- LOAD1
18 0x00000ed4 0x8 0x08049ed4 0x8 -rw- .preinit_array
336
8
8
EOF
RUN