aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-08-04 10:02:42 -0500
committerGitHub <noreply@github.com>2016-08-04 10:02:42 -0500
commitaced80b56de7921faec73cc1d0fd92c0dd4aa325 (patch)
treec119912601f08bbc77bf53604bff3d93369d42fb
parent504954890e406b6e735fb17caa8e3454b17b8208 (diff)
parent164a9f626b15d8571af5de3566f102193b9033ee (diff)
downloadservo-aced80b56de7921faec73cc1d0fd92c0dd4aa325.tar.gz
servo-aced80b56de7921faec73cc1d0fd92c0dd4aa325.zip
Auto merge of #12733 - nox:panic-location, r=jdm
Print thread name and file location when panicking <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12733) <!-- Reviewable:end -->
-rw-r--r--components/servo/main.rs9
1 files changed, 8 insertions, 1 deletions
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<Any>",
},
};
- error!("{}", msg);
+ let current_thread = thread::current();
+ let name = current_thread.name().unwrap_or("<unnamed>");
+ if let Some(location) = info.location() {
+ error!("{} (thread {}, at {}:{})", msg, name, location.file(), location.line());
+ } else {
+ error!("{} (thread {})", msg, name);
+ }
}));
setup_logging();