From 164a9f626b15d8571af5de3566f102193b9033ee Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 4 Aug 2016 16:53:53 +0200 Subject: [PATCH] Print thread name and file location when panicking --- components/servo/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/servo/main.rs b/components/servo/main.rs index 64112fde54b..7da24dd1dc2 100644 --- a/components/servo/main.rs +++ b/components/servo/main.rs @@ -41,6 +41,7 @@ use servo::util::servo_version; use std::panic; use std::process; use std::rc::Rc; +use std::thread; pub mod platform { #[cfg(target_os = "macos")] @@ -107,7 +108,13 @@ fn main() { None => "Box", }, }; - error!("{}", msg); + let current_thread = thread::current(); + let name = current_thread.name().unwrap_or(""); + if let Some(location) = info.location() { + error!("{} (thread {}, at {}:{})", msg, name, location.file(), location.line()); + } else { + error!("{} (thread {})", msg, name); + } })); setup_logging();