diff options
| author | linouxis9 <[email protected]> | 2018-05-07 15:31:54 +0200 |
|---|---|---|
| committer | linouxis9 <[email protected]> | 2018-05-07 15:35:20 +0200 |
| commit | 4901431b02227416b08e5fbc9a7ac3f5ac2f44a7 (patch) | |
| tree | 7fb75cf805b8f0e9b7f169af37c9d2aa0c4aded6 /ctr-std/src/panicking.rs | |
| parent | Merge pull request #66 from FenrirWolf/swkbd (diff) | |
| download | archived-ctru-rs-4901431b02227416b08e5fbc9a7ac3f5ac2f44a7.tar.xz archived-ctru-rs-4901431b02227416b08e5fbc9a7ac3f5ac2f44a7.zip | |
Update for latest nightly 2018-05-06
Diffstat (limited to 'ctr-std/src/panicking.rs')
| -rw-r--r-- | ctr-std/src/panicking.rs | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/ctr-std/src/panicking.rs b/ctr-std/src/panicking.rs index ad0a337..4030562 100644 --- a/ctr-std/src/panicking.rs +++ b/ctr-std/src/panicking.rs @@ -76,7 +76,9 @@ static mut HOOK: Hook = Hook::Default; /// is invoked. As such, the hook will run with both the aborting and unwinding /// runtimes. The default hook prints a message to standard error and generates /// a backtrace if requested, but this behavior can be customized with the -/// `set_hook` and `take_hook` functions. +/// `set_hook` and [`take_hook`] functions. +/// +/// [`take_hook`]: ./fn.take_hook.html /// /// The hook is provided with a `PanicInfo` struct which contains information /// about the origin of the panic, including the payload passed to `panic!` and @@ -121,6 +123,10 @@ pub fn set_hook(hook: Box<Fn(&PanicInfo) + 'static + Sync + Send>) { /// Unregisters the current panic hook, returning it. /// +/// *See also the function [`set_hook`].* +/// +/// [`set_hook`]: ./fn.set_hook.html +/// /// If no custom hook is registered, the default hook will be returned. /// /// # Panics @@ -191,33 +197,9 @@ fn default_hook(info: &PanicInfo) { let thread = thread_info::current_thread(); let name = thread.as_ref().and_then(|t| t.name()).unwrap_or("<unnamed>"); - // 3DS-specific code begins here to display panics via the Error applet - use libctru::{errorInit, errorText, errorDisp, errorConf, ERROR_TEXT_WORD_WRAP, - CFG_LANGUAGE_EN, consoleDebugInit, debugDevice_SVC}; - - let error_text = format!("thread '{}' panicked at '{}', {}", name, msg, location); - - unsafe { - // Prepare error message for display - let mut error_conf: errorConf = mem::uninitialized(); - errorInit(&mut error_conf, - ERROR_TEXT_WORD_WRAP, - CFG_LANGUAGE_EN); - errorText(&mut error_conf, error_text.as_ptr() as *const ::libc::c_char); - - // Display the error - errorDisp(&mut error_conf); - } - - // Let's also write to stderr using the debug console. The output will be - // visible in Citra if a custom logging filter such as `Debug.Emulated:Debug` - // is enabled in the logging section of `~/.config/citra-emu/sdl2-config.ini` - unsafe { - consoleDebugInit(debugDevice_SVC); - } - let write = |err: &mut ::io::Write| { - let _ = write!(err, "{}", error_text); + let _ = writeln!(err, "thread '{}' panicked at '{}', {}", + name, msg, location); #[cfg(feature = "backtrace")] { |