NAME=dbg.step
FILE=/bin/ls
ARGS=-d
CMDS=<<EOF
.dr*
s rip
f a=rip
wx 90
pi 1 # hack this shouldnt be here
ds
.dr*
?v rip-a
EOF
EXPECT=<<EOF
nop
0x1
EOF
RUN

NAME=dbg.symbols
FILE=/bin/ls
ARGS=-d
CMDS=<<EOF
id~?
dk 9
EOF
EXPECT=<<EOF
0
EOF
RUN

NAME=dso over a breakpoint
FILE=/bin/ls
ARGS=-d
CMDS=<<EOF
dr rax=rip > /dev/null
?vi rax-rip
db rip
dso
dk 9
?vi rax-rip~?^0$
EOF
EXPECT=<<EOF
0
0
EOF
RUN

NAME=ds on jmp reg
FILE=bins/elf/analysis/x86-jmpeax
ARGS=-b 32 -a x86 -d
CMDS=<<EOF
dcu main
5ds
dr eip
EOF
EXPECT=<<EOF
0x080483d0
EOF
RUN

NAME=ds on calls and jumps
FILE=bins/elf/analysis/calls_x64
ARGS=-a x86 -d
CMDS=<<EOF
dcu main
2ds
dr rip
2ds
dr rip
2ds
dr rip
ds
dr rip
2ds
dr rip
2ds
dr rip
ds
dr rip
ds
dr rip
dc
EOF
EXPECT=<<EOF
0x0040052f
0x0040053c
0x00400549
0x0040054f
0x0040055b
0x00400567
0x0040056e
0x00400510
Hello world
EOF
RUN

NAME=dso on call 1
FILE=bins/elf/analysis/calls_x64
ARGS=-a x86 -d
CMDS=<<EOF
dcu main
ds
dr rip
dso
dr rip
EOF
EXPECT=<<EOF
0x00400575
0x0040057c
Hello world
EOF
RUN

NAME=dso on call 2
FILE=bins/elf/analysis/calls_x64
ARGS=-a x86 -d
CMDS=<<EOF
dcu main
3ds
dr rip
dso
dr rip
EOF
EXPECT=<<EOF
0x00400539
0x0040053b
Hello world
EOF
RUN

NAME=dso on call 3
FILE=bins/elf/analysis/calls_x64
ARGS=-a x86 -d
CMDS=<<EOF
dcu main
5ds
dr rip
dso
dr rip
EOF
EXPECT=<<EOF
0x00400546
0x00400548
Hello world
EOF
RUN

NAME=dso on call 4
FILE=bins/elf/analysis/calls_x64
ARGS=-a x86 -d
CMDS=<<EOF
dcu main
6ds
dr rip
dso
dr rip
EOF
EXPECT=<<EOF
0x00400549
0x0040054e
Hello world
EOF
RUN

NAME=dbg.dsu
FILE=bins/elf/analysis/calls_x64
ARGS=-a x86 -d
CMDS=<<EOF
dcu main
dsu 0x400546
dr rip
EOF
EXPECT=<<EOF
0x00400546
EOF
RUN

NAME=dbg.dsui
FILE=bins/elf/analysis/calls_x64
ARGS=-a x86 -d
CMDS=<<EOF
dcu main
dsui mov eax
dr rip
EOF
EXPECT=<<EOF
0x00400524
EOF
RUN

NAME=dbg.dsei
FILE=bins/elf/analysis/calls_x64
ARGS=-a x86 -d
BROKEN=1
CMDS=<<EOF
dcu main
aei
dsue 0,eax,==
dr rip
EOF
EXPECT=<<EOF
0x00400529
Hello world
EOF
RUN

NAME=dbg.dss
FILE=bins/elf/analysis/calls_x64
ARGS=-a x86 -d
CMDS=<<EOF
dcu main
4dss
dr rip
EOF
EXPECT=<<EOF
0x00400582
EOF
RUN

NAME=dbg.dcu can reach main
FILE=bins/elf/analysis/calls_x64
ARGS=-a x86 -d
CMDS=<<EOF
dcu main
?v $$
EOF
EXPECT=<<EOF
0x400574
Hello world
EOF
RUN
