NAME=use of dmh, then any command which use grep and index
FILE=bins/elf/simple_malloc_x86_64
ARGS=-d
CMDS=<<EOF
db sym.main
dc
dmh > /dev/null
aa > /dev/null
pdf @sym.main~:1
EOF
EXPECT=<<EOF
/ 91: int main (int argc, char **argv, char **envp);
p=3
EOF
RUN

NAME=dmh allocated
FILE=bins/elf/simple_malloc_x86_64
ARGS=-d
CMDS=<<EOF
dcu main
dmh~?allocated
7dso
dmh~?allocated
EOF
EXPECT=<<EOF
1
2
p=3
EOF
RUN

NAME=dmh/dmha with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
#re-map arena and [heap]
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]

dmha~?0x7ffff7f8a000
e dbg.glibc.tcache=0
dmh~?allocated
e dbg.glibc.tcache=1
dmh~?allocated
EOF
EXPECT=<<EOF
1
3
2
EOF
RUN

NAME=dmht with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
#re-map arena and [heap]
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]

e dbg.glibc.tcache=0
dmht~?items[5]
e dbg.glibc.tcache=1
dmht~?items[5]
EOF
EXPECT=<<EOF
0
1
EOF
RUN
