radare2/test/new/db/cmd/feat_variables
Riccardo Schirone c1c54be39e Change macro syntax to use ; instead of ,
This change is to ease the switch to the new parser and make the syntax
more consistent and easy. As things were before this patch, ',' could be
part of an argument of a command, but at the same time it was used as a
separator when defining a new macro. This difference in how `,` is
interpreter, makes parsing commands harder, as grep specifiers,
arguments, etc. should be parsed differently based on whether they are
inside a macro body or not.

By switching to using `;` as separator in the macro body, arguments,
grep specifiers, etc. can be parsed as they would be outside of a macro
body, making the new parser more consistent and easier.
2020-03-11 00:11:01 +01:00

409 lines
4.1 KiB
Plaintext

NAME=hello-arm32
FILE=../bins/elf/analysis/hello-arm32
EXPECT=<<EOF
0x10000
0x90c
EOF
CMDS=<<EOF
?v $M
?v $s
EOF
RUN
NAME=hello-arm32
FILE=../bins/elf/analysis/hello-arm32
EXPECT=<<EOF
0x4000
0x90c
EOF
ARGS=-B 0x4000
CMDS=<<EOF
?v $M
?v $s
EOF
RUN
NAME=$FB (fcn-begin)
FILE=malloc://1024
EXPECT=<<EOF
0x2a
EOF
CMDS=<<EOF
s 42
af
s 44
s $FB
s
EOF
RUN
NAME=$$ (malloc)
FILE=malloc://1024
EXPECT=<<EOF
0x0
0x2a
0x0
EOF
CMDS=<<EOF
?v $$
s 42
?v $$
s-
?v $$
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
EXPECT=<<EOF
0x0
0x2a
0x0
EOF
CMDS=<<EOF
?v $o
s 42
?v $o
s-
?v $o
EOF
RUN
NAME=$s (malloc)
FILE=malloc://1024
EXPECT=<<EOF
0x400
EOF
CMDS=?v $s
RUN
NAME=$j (malloc)
FILE=malloc://1024
EXPECT=<<EOF
0x30
0x1
0xffffffffffffffff
EOF
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
RUN
NAME=$f (malloc)
FILE=malloc://1024
EXPECT=<<EOF
0xffffffffffffffff
0x6
0xffffffffffffffff
EOF
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
RUN
NAME=$m (malloc)
FILE=malloc://1024
EXPECT=<<EOF
0x500
0xffffffffffffffff
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wa mov eax, [0x500]
?v $m
wa mov eax, ebx
?v $m
?e
EOF
RUN
NAME=$l (malloc)
FILE=malloc://1024
EXPECT=<<EOF
0x2
0x5
0x1
EOF
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
RUN
NAME=$e (malloc)
FILE=-
EXPECT=<<EOF
0x0
0x1
0x1
0x0
EOF
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
RUN
NAME=$e (malloc) 2
FILE=malloc://1024
EXPECT=<<EOF
0x20
EOF
CMDS=<<EOF
e asm.bits = 0x20
?v ${asm.bits}
EOF
RUN
NAME=$e (malloc) 3
FILE=malloc://1024
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
CMDS=<<EOF
? 5+3
?v $?
? 0
?v $?
EOF
RUN
NAME=$$ (x86-simple)
FILE=../bins/elf/analysis/x86-simple
EXPECT=<<EOF
0x8048060
0x2a
0x8048060
EOF
CMDS=<<EOF
?v $$
s 42
?v $$
s-
?v $$
EOF
RUN
NAME=$o (x86-simple)
FILE=../bins/elf/analysis/x86-simple
EXPECT=<<EOF
0x60
0x2a
0x60
EOF
CMDS=<<EOF
?v $o
s 42
?v $o
s-
?v $o
EOF
RUN
NAME=$b (x86-simple)
FILE=../bins/elf/analysis/x86-simple
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
CMDS=<<EOF
e asm.bits=32
e asm.arch = x86
e anal.arch = x86
b 123
?v $b
? $b
EOF
RUN
NAME=$s (x86-simple)
FILE=../bins/elf/analysis/x86-simple
EXPECT=<<EOF
0xfc
EOF
CMDS=?v $s
RUN
NAME=?p and ?P
FILE=../bins/elf/analysis/simple.elf
EXPECT=<<EOF
0x00000060
0x08000060
EOF
CMDS=<<EOF
?p 0x08000060
?P 0x00000060
EOF
RUN
NAME=?p and ?P
FILE=../bins/elf/analysis/simple.elf
EXPECT=<<EOF
no map at 0xdeadbeef
no map at 0xdeadbeef
EOF
CMDS=<<EOF
?p 0xdeadbeef
?P 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