rizin/test/db/cmd/cmd_afn
Anton Kochkov 2f638cad1e Convert f commands to rzshell
* Changed behavior of `f` to only add flag if there is none
* Changed behavior of `f+` to add flag in any case
* Moved listing subcommands from `f` to `fl`
* Moved listing subcommands from `f.` to `f.l`
* Added subcommand `f.l*` to list all local flags in all functions
* Listing flags at the current offset became `fl.`
* Moved `f=` to `fl=`
* Old `fl` (flag length) now became `fL`
* Removed original `fe` commands
* Old `f?` (check if flag exists) now became `fe`
* Removed `fV` commands
* Removed `fn` commands in favor of `fl` and `asm.flags.real=true`
* Removed `fS` commands (`fSo` and `fSn`)
* `fo` became `fortune` and moved from "flags" to "shell" category
* Removed oldshell handlers of the `z` commands
2022-02-03 21:46:42 +08:00

88 lines
1.5 KiB
Text

NAME=afn normal function
FILE==
CMDS=<<EOF
e asm.arch=avr
wa ret
af
afn foobar
afl.
EOF
EXPECT=<<EOF
0x00000000 foobar
EOF
RUN
NAME=afn interrupt handler
FILE==
CMDS=<<EOF
e asm.arch=avr
wa reti
af
afn foobar
afl.
EOF
EXPECT=<<EOF
0x00000000 foobar
EOF
RUN
NAME=afn with flag
FILE=bins/elf/crackme0x05
CMDS=<<EOF
aa
fl @F:functions~483f4,48540
?e --
fl @F:*~483f4,48540
afn mymain @ 0x08048540
afl. @ 0x08048540
"?e The main flag shouldn't be renamed, it comes from bin:"
fl @F:functions~483f4,48540
?e --
fl @F:*~483f4,48540
afn myfunc @ 0x080483f4
afl. @ 0x080483f4
?e Here the flag is owned by the fcn and should be renamed:
fl @F:functions~483f4,48540
?e --
fl @F:*~483f4,48540
f- myfunc
afn createdflag @ 0x080483f4
?e Non-existing flags should be created
fl @F:functions~483f4,48540
?e --
fl @F:*~483f4,48540
EOF
EXPECT=<<EOF
0x080483f4 33 fcn.080483f4
--
0x080483f4 33 fcn.080483f4
0x08048540 92 main
0x08048540 92 sym.main
0x08048540 mymain
The main flag shouldn't be renamed, it comes from bin:
0x080483f4 33 fcn.080483f4
0x08048540 92 mymain
--
0x080483f4 33 fcn.080483f4
0x08048540 92 main
0x08048540 92 sym.main
0x08048540 92 mymain
0x080483f4 myfunc
Here the flag is owned by the fcn and should be renamed:
0x080483f4 33 myfunc
0x08048540 92 mymain
--
0x080483f4 33 myfunc
0x08048540 92 main
0x08048540 92 sym.main
0x08048540 92 mymain
Non-existing flags should be created
0x080483f4 33 createdflag
0x08048540 92 mymain
--
0x080483f4 33 createdflag
0x08048540 92 main
0x08048540 92 sym.main
0x08048540 92 mymain
EOF
RUN