const (
UNW_FLAG_EHANDLER = 1 << 3
UNW_FLAG_UHANDLER = 2 << 3
- UNW_FLAG_CHAININFO = 3 << 3
- unwStaticDataSize = 8
+ UNW_FLAG_CHAININFO = 4 << 3
+ unwStaticDataSize = 4 // Bytes of unwind data before the variable length part.
+ unwCodeSize = 2 // Bytes per unwind code.
)
// processSEH walks all pdata relocations looking for exception handler function symbols.
// Nothing to do.
return 0
}
- codes := data[3]
+ codes := data[2]
if codes%2 != 0 {
// There are always an even number of unwind codes, even if the last one is unused.
codes += 1
}
// The exception handler relocation is the first relocation after the unwind codes,
// unless it is chained, but we will handle this case later.
- targetOff := add + unwStaticDataSize*(1+int64(codes))
+ targetOff := add + unwStaticDataSize + unwCodeSize*int64(codes)
xrels := ldr.Relocs(xsym)
xrelsCount := xrels.Count()
idx := sort.Search(xrelsCount, func(i int) bool {