servo: Merge #16899 - Revert "Replace intrinsics::abort with process::abort" (from jdm:revertabort); r=emilio
authorJosh Matthews <josh@joshmatthews.net>
Tue, 16 May 2017 18:46:17 -0500
changeset 406743 a2fe86ec3027915657b01c88fc2d656659c57735
parent 406742 2e4d10ec32612d3f04390aaa17fb32adef490926
child 406744 a9ea66b0059b6e3832b6950bcd504210bd124116
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
servo/ports/cef/lib.rs
servo/ports/cef/stubs.rs
servo/ports/servo/main.rs
--- a/servo/ports/cef/lib.rs
+++ b/servo/ports/cef/lib.rs
@@ -1,14 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #![allow(non_camel_case_types)]
 #![feature(box_syntax)]
+#![feature(core_intrinsics)]
 #![feature(link_args)]
 
 #[macro_use]
 extern crate log;
 
 extern crate servo;
 extern crate compositing;
 
--- a/servo/ports/cef/stubs.rs
+++ b/servo/ports/cef/stubs.rs
@@ -7,17 +7,19 @@
 //! crash.
 
 macro_rules! stub(
     ($name:ident) => (
         #[no_mangle]
         #[allow(non_snake_case)]
         pub extern "C" fn $name() {
             println!("CEF stub function called: {}", stringify!($name));
-            ::std::process::abort()
+            unsafe {
+                ::std::intrinsics::abort()
+            }
         }
     )
 );
 
 stub!(cef_add_cross_origin_whitelist_entry);
 stub!(cef_add_web_plugin_directory);
 stub!(cef_add_web_plugin_path);
 stub!(cef_begin_tracing);
--- a/servo/ports/servo/main.rs
+++ b/servo/ports/servo/main.rs
@@ -10,17 +10,17 @@
 //! This browser's implementation of `WindowMethods` is built on top
 //! of [glutin], the cross-platform OpenGL utility and windowing
 //! library.
 //!
 //! For the engine itself look next door in `components/servo/lib.rs`.
 //!
 //! [glutin]: https://github.com/tomaka/glutin
 
-#![feature(start)]
+#![feature(start, core_intrinsics)]
 
 #[cfg(target_os = "android")]
 extern crate android_injected_glue;
 extern crate backtrace;
 // The window backed by glutin
 extern crate glutin_app as app;
 #[macro_use]
 extern crate log;
@@ -53,26 +53,30 @@ pub mod platform {
     #[cfg(not(target_os = "macos"))]
     pub fn deinit() {}
 }
 
 #[cfg(not(target_os = "android"))]
 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) {
         let name = thread::current()
             .name()
             .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
     signal!(Sig::ILL, handler); // handle stack overflow and unsupported CPUs
     signal!(Sig::IOT, handler); // handle double panics
     signal!(Sig::BUS, handler); // handle invalid memory access
 }