(
exc_info: *mut windows_sys::Win32::System::Diagnostics::Debug::EXCEPTION_POINTERS,
)
| 609 | |
| 610 | #[cfg(windows)] |
| 611 | unsafe extern "system" fn faulthandler_exc_handler( |
| 612 | exc_info: *mut windows_sys::Win32::System::Diagnostics::Debug::EXCEPTION_POINTERS, |
| 613 | ) -> i32 { |
| 614 | const EXCEPTION_CONTINUE_SEARCH: i32 = 0; |
| 615 | |
| 616 | if !FATAL_ERROR.enabled.load(Ordering::Relaxed) { |
| 617 | return EXCEPTION_CONTINUE_SEARCH; |
| 618 | } |
| 619 | |
| 620 | let record = unsafe { &*(*exc_info).ExceptionRecord }; |
| 621 | let code = record.ExceptionCode as u32; |
| 622 | |
| 623 | if faulthandler_ignore_exception(code) { |
| 624 | return EXCEPTION_CONTINUE_SEARCH; |
| 625 | } |
| 626 | |
| 627 | let fd = FATAL_ERROR.fd.load(Ordering::Relaxed); |
| 628 | |
| 629 | puts(fd, "Windows fatal exception: "); |
| 630 | match code { |
| 631 | 0xC0000005 => puts(fd, "access violation"), |
| 632 | 0xC000008C => puts(fd, "float divide by zero"), |
| 633 | 0xC0000091 => puts(fd, "float overflow"), |
| 634 | 0xC0000094 => puts(fd, "int divide by zero"), |
| 635 | 0xC0000095 => puts(fd, "integer overflow"), |
| 636 | 0xC0000006 => puts(fd, "page error"), |
| 637 | 0xC00000FD => puts(fd, "stack overflow"), |
| 638 | 0xC000001D => puts(fd, "illegal instruction"), |
| 639 | _ => { |
| 640 | puts(fd, "code "); |
| 641 | dump_hexadecimal(fd, code as u64, 8); |
| 642 | } |
| 643 | } |
| 644 | puts(fd, "\n\n"); |
| 645 | |
| 646 | // Disable SIGSEGV handler for access violations to avoid double output |
| 647 | if code == 0xC0000005 { |
| 648 | unsafe { |
| 649 | for handler in FAULTHANDLER_HANDLERS.iter_mut() { |
| 650 | if handler.signum == libc::SIGSEGV { |
| 651 | faulthandler_disable_fatal_handler(handler); |
| 652 | break; |
| 653 | } |
| 654 | } |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | let all_threads = FATAL_ERROR.all_threads.load(Ordering::Relaxed); |
| 659 | faulthandler_dump_traceback(fd, all_threads); |
| 660 | |
| 661 | EXCEPTION_CONTINUE_SEARCH |
| 662 | } |
| 663 | |
| 664 | // faulthandler_enable |
| 665 | #[cfg(unix)] |
nothing calls this directly
no test coverage detected