From f74528187bc227d436b4808d8b485752f97042fd Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 16 May 2017 18:46:17 -0500 Subject: [PATCH] servo: Merge #16899 - Revert "Replace intrinsics::abort with process::abort" (from jdm:revertabort); r=emilio This reverts #16680. Calling `process::abort` from the crash handler causes the crash handler to be invoked again recursively. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #16898 Source-Repo: https://github.com/servo/servo Source-Revision: 1312ab2b284c1a988c5029e1ec28ee9f3ea5e912 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 742d1055f4b540cca19040f50941f133a6bf094d --- servo/ports/cef/lib.rs | 1 + servo/ports/cef/stubs.rs | 4 +++- servo/ports/servo/main.rs | 10 +++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/servo/ports/cef/lib.rs b/servo/ports/cef/lib.rs index 809fccc412bc..f953358e4a9b 100644 --- a/servo/ports/cef/lib.rs +++ b/servo/ports/cef/lib.rs @@ -4,6 +4,7 @@ #![allow(non_camel_case_types)] #![feature(box_syntax)] +#![feature(core_intrinsics)] #![feature(link_args)] #[macro_use] diff --git a/servo/ports/cef/stubs.rs b/servo/ports/cef/stubs.rs index df35e050852a..8f4a9b738209 100644 --- a/servo/ports/cef/stubs.rs +++ b/servo/ports/cef/stubs.rs @@ -12,7 +12,9 @@ macro_rules! stub( #[allow(non_snake_case)] pub extern "C" fn $name() { println!("CEF stub function called: {}", stringify!($name)); - ::std::process::abort() + unsafe { + ::std::intrinsics::abort() + } } ) ); diff --git a/servo/ports/servo/main.rs b/servo/ports/servo/main.rs index 6534aed75c02..bec8ffa80894 100644 --- a/servo/ports/servo/main.rs +++ b/servo/ports/servo/main.rs @@ -15,7 +15,7 @@ //! //! [glutin]: https://github.com/tomaka/glutin -#![feature(start)] +#![feature(start, core_intrinsics)] #[cfg(target_os = "android")] extern crate android_injected_glue; @@ -58,7 +58,7 @@ pub mod platform { fn install_crash_handler() { use backtrace::Backtrace; use sig::ffi::Sig; - use std::process::abort; + use std::intrinsics::abort; use std::thread; fn handler(_sig: i32) { @@ -67,7 +67,11 @@ fn install_crash_handler() { .map(|n| format!(" for thread \"{}\"", n)) .unwrap_or("".to_owned()); println!("Stack trace{}\n{:?}", name, Backtrace::new()); - abort(); + unsafe { + // N.B. Using process::abort() here causes the crash handler to be + // triggered recursively. + abort(); + } } signal!(Sig::SEGV, handler); // handle segfaults