message: Added TrapInformation in UD payload decoding for Windows too
diff: @@ -460,13 +460,60 @@ cfg_if::cfg_if! {
  EXCEPTION_STACK_OVERFLOW => Some(sp),
  _ => None,
  };
  -
  + let trap_code = match record.ExceptionCode {
  + // check if it was cased by a UD and if the Trap info is a payload to it
  + EXCEPTION_ILLEGAL_INSTRUCTION => {
  + let mut val: u8 = 0;
  + if cfg!(target_arch = "x86_64") {
  + let addr = pc as usize;
  + val = if read_unaligned(addr as *mut u8)&0xf0 == 0x40
  + && read_unaligned((addr+1) as *mut u8) == 0x0f
  + && read_unaligned((addr+2) as *mut u8) == 0xb9 {
  + read_unaligned((addr+3) as *mut u8)
  + } else if read_unaligned(addr as *mut u8) == 0x0f
  + && read_unaligned((addr+1) as *mut u8) == 0xb9 {
  + read_unaligned((addr+2) as *mut u8)
  + } else {
  + 0
  + }
  + }
  + if cfg!(target_arch = "aarch64") {
  + let addr = pc as usize;
  + val = if read_unaligned(addr as *mut u32)&0xffff0000 == 0 {
  + read_unaligned(addr as *mut u8)
  + } else {
  + 0
  + }
  + }
  + if val&MAGIC == MAGIC {
  + match val&0x0f {
  + 0 => Some(TrapCode::StackOverflow),
  + 1 => Some(TrapCode::HeapAccessOutOfBounds),
  + 2 => Some(TrapCode::HeapMisaligned),
  + 3 => Some(TrapCode::TableAccessOutOfBounds),
  + 4 => Some(TrapCode::OutOfBounds),
  + 5 => Some(TrapCode::IndirectCallToNull),
  + 6 => Some(TrapCode::BadSignature),
  + 7 => Some(TrapCode::IntegerOverflow),
  + 8 => Some(TrapCode::IntegerDivisionByZero),
  + 9 => Some(TrapCode::BadConversionToInteger),
  + 10 => Some(TrapCode::UnreachableCodeReached),
  + 11 => Some(TrapCode::UnalignedAtomic),
  + _ => None,
  + }
  + } else {
  + None
  + }
  + }
  + _ => None,
  + };
  // This is basically the same as the unix version above, only with a
  // few parameters tweaked here and there.
  let handled = TrapHandlerContext::handle_trap(
  pc,
  sp,
  maybe_fault_address,
  + trapcode,
  |regs| update_context(context, regs),
  |handler| handler(exception_info),
  );
  