NAME=PE: seh_x64.exe - open
FILE=bins/pe/seh_x64.exe
CMDS=q!
EXPECT=<<EOF
EOF
RUN

# merged: PE: seh_x64.exe - __except with a filter function; PE: seh_x64.exe - Get trycatchs
NAME=PE: seh_x64.exe - Get trycatchs as JSON
FILE=bins/pe/seh_x64.exe
CMDS=<<EOF
iwj~{[0]}
?e --
iwj~{[2]}
?e --
iw*
EOF
EXPECT=<<EOF
{"index":0,"source":5368713232,"from":5368713292,"to":5368713318,"handler":5368713318,"filter":0,"kind":"catch","typeFilter":0}
--
{"index":2,"source":5368713232,"from":5368713348,"to":5368713364,"handler":5368713364,"filter":5368716592,"kind":"filter","typeFilter":0}
--
f try.0.140001010.from=0x14000104c
f try.0.140001010.to=0x140001066
f try.0.140001010.catch=0x140001066
f try.1.140001010.from=0x140001022
f try.1.140001010.to=0x140001076
f try.1.140001010.catch=0x140001076
f try.2.140001010.from=0x140001084
f try.2.140001010.to=0x140001094
f try.2.140001010.filter=0x140001094
f try.3.140001170.from=0x140001192
f try.3.140001170.to=0x1400011c6
f try.3.140001170.filter=0x1400011c6
f try.4.14000132c.from=0x140001355
f try.4.14000132c.to=0x14000145a
f try.4.14000132c.filter=0x14000145a
f try.5.14000132c.from=0x14000148e
f try.5.14000132c.to=0x1400014a0
f try.5.14000132c.filter=0x14000145a
f try.6.1400015d0.from=0x1400015d7
f try.6.1400015d0.to=0x140001661
f try.6.1400015d0.filter=0x140001661
EOF
RUN

NAME=PE: seh_x64.exe - readable exception filter
FILE=bins/pe/seh_x64.exe
CMDS=iw~0x140001084
EXPECT=<<EOF
2 0x140001084-0x140001094 filter -> 0x140001094 (source 0x140001010, filter 0x140001d30)
EOF
RUN

NAME=disasm nested SEH regions and filter handler
FILE=bins/pe/seh_x64.exe
CMDS=<<EOF
pd 3 @ 0x14000104c~try 0x
pd 6 @ 0x140001084~try 0x
EOF
EXPECT=<<EOF
            ; try 0x14000104c-0x140001066 catch -> 0x140001066
            ; try 0x140001022-0x140001076 catch -> 0x140001076
            ; try 0x140001084-0x140001094 filter -> 0x140001094
EOF
RUN

NAME=PE catch and filter handlers use metadata and owning source
FILE=bins/pe/seh_x64.exe
CMDS=<<EOF
e anal.trycatch=false
af @ 0x140001010
afbq @ 0x140001010~?0x140001066,0x140001076,0x140001094
af-*
e anal.trycatch=true
f try.2.140001010.filter=0x140001d30
af @ 0x140001010
afbq @ 0x140001010~?0x140001066,0x140001076,0x140001094
afbq @ 0x140001010~?0x140001d30,0x14000145a
EOF
EXPECT=<<EOF
0
3
0
EOF
RUN
