]> git.lizzy.rs Git - rust.git/commitdiff
Add rust_fail. #11219
authorBrian Anderson <banderson@mozilla.com>
Tue, 31 Dec 2013 02:43:03 +0000 (18:43 -0800)
committerBrian Anderson <banderson@mozilla.com>
Tue, 31 Dec 2013 02:44:57 +0000 (18:44 -0800)
src/libstd/rt/unwind.rs

index 9706dbae4c61b8f095735090fa5a3d78bc69dae6..358df7260f4af6b500782855ae85fe0d3f3aa0cc 100644 (file)
@@ -180,22 +180,29 @@ pub fn begin_unwind(&mut self, cause: ~Any) -> ! {
         self.unwinding = true;
         self.cause = Some(cause);
 
-        unsafe {
-            let exception = ~uw::_Unwind_Exception {
-                exception_class: rust_exception_class(),
-                exception_cleanup: exception_cleanup,
-                private_1: 0,
-                private_2: 0
-            };
-            let error = uw::_Unwind_RaiseException(cast::transmute(exception));
-            rtabort!("Could not unwind stack, error = {}", error as int)
-        }
+        rust_fail();
 
-        extern "C" fn exception_cleanup(_unwind_code: uw::_Unwind_Reason_Code,
-                                        exception: *uw::_Unwind_Exception) {
-            rtdebug!("exception_cleanup()");
+        // An uninlined, unmangled function upon which to slap yer breakpoints
+        #[inline(never)]
+        #[no_mangle]
+        fn rust_fail() -> ! {
             unsafe {
-                let _: ~uw::_Unwind_Exception = cast::transmute(exception);
+                let exception = ~uw::_Unwind_Exception {
+                    exception_class: rust_exception_class(),
+                    exception_cleanup: exception_cleanup,
+                    private_1: 0,
+                    private_2: 0
+                };
+                let error = uw::_Unwind_RaiseException(cast::transmute(exception));
+                rtabort!("Could not unwind stack, error = {}", error as int)
+            }
+
+            extern "C" fn exception_cleanup(_unwind_code: uw::_Unwind_Reason_Code,
+                                            exception: *uw::_Unwind_Exception) {
+                rtdebug!("exception_cleanup()");
+                unsafe {
+                    let _: ~uw::_Unwind_Exception = cast::transmute(exception);
+                }
             }
         }
     }