NAME=1: io.baddr
FILE=bins/elf/analysis/pie
CMDS=?v entry0
EXPECT=<<EOF
0x450
EOF
RUN

NAME=2: io.baddr
FILE=bins/elf/analysis/pie
ARGS=-B 0xf00000
CMDS=?v entry0
EXPECT=<<EOF
0xf00450
EOF
RUN

NAME=3: io.baddr
FILE=bins/elf/analysis/pie
CMDS=!rz-bin -B 0xf00000 -re ${RZ_FILE} | grep 0x
EXPECT=<<EOF
"f entry0 1 0x00f00450"
"f entry0_haddr 1 0x00000018"
EOF
RUN

NAME=io.baddr entry0 data
FILE=bins/elf/analysis/pie
CMDS=<<EOF
ie~paddr[3]
ie~vaddr[1]
p8 10 @ 0x00000450
EOF
EXPECT=<<EOF
0x00000450
0x00000450
31ed5e89e183e4f05054
EOF
RUN

NAME=io.baddr -B entry0 data
FILE=bins/elf/analysis/pie
ARGS=-B 0x100000
CMDS=p8 10 @ 0x00100450
EXPECT=<<EOF
31ed5e89e183e4f05054
EOF
RUN

NAME=io.baddr -x86_32 entry0 data
FILE=bins/mach0/fatmach0-3true
ARGS=-a x86 -b 32
CMDS=<<EOF
ie~paddr[3]
ie~vaddr[1]
p8 10 @ 0x00001f44
p8 10 @ 0x00005f44
EOF
EXPECT=<<EOF
0x00005f44
0x00001f44
6a0089e583e4f083ec10
6a0089e583e4f083ec10
EOF
RUN

NAME=4: io.baddr
FILE=bins/elf/analysis/pie
ARGS=-B 0xf00000
CMDS=<<EOF
!rz-bin -B 0xf00000 -re ${RZ_FILE} | grep 0x
p8 10 @ 0x00f00450
EOF
EXPECT=<<EOF
"f entry0 1 0x00f00450"
"f entry0_haddr 1 0x00000018"
31ed5e89e183e4f05054
EOF
RUN

NAME=e bin.baddr
FILE=bins/elf/analysis/hello-linux-x86_64
CMDS=?v `e bin.baddr`
EXPECT=<<EOF
0x400000
EOF
RUN

NAME=e bin.baddr changed
FILE=bins/elf/analysis/hello-linux-x86_64
ARGS=-B 0xf00000
CMDS=?v `e bin.baddr`
EXPECT=<<EOF
0xf00000
EOF
RUN

NAME=bin.baddr and anal
FILE=bins/elf/analysis/pie
ARGS=-B 0xf00000
CMDS=<<EOF
aaa
afl~$
EOF
EXPECT=<<EOF
0x00f003ec    3 35           sym._init
0x00f00420    1 6            sym.imp.__cxa_finalize
0x00f00430    1 6            loc.imp.__gmon_start
0x00f00440    1 6            sym.imp.__libc_start_main
0x00f00450    1 49           entry0
0x00f00482    1 4            fcn.00f00482
0x00f00490    1 4            sym.__x86.get_pc_thunk.bx
0x00f004a0    4 61           sym.deregister_tm_clones
0x00f004e0    4 71           sym.register_tm_clones
0x00f00530    5 71           sym.__do_global_dtors_aux
0x00f00580    4 69   -> 60   entry.init0
0x00f005c5    1 4            main
0x00f005d0    4 97           sym.__libc_csu_init
0x00f00640    1 2            sym.__libc_csu_fini
0x00f00644    1 20           sym._fini
EOF
RUN
