Skip to content

Commit d6ae95b

Browse files
committed
---
yaml --- r: 236575 b: refs/heads/tmp c: 54c0231 h: refs/heads/master i: 236573: 2e4d11e 236571: 6047e9e 236567: 12989c3 236559: bb20390 236543: cbd7f6e v: v3
1 parent 5f53701 commit d6ae95b

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: c7b84909b00dcf5f762778b4aa9783770c69416d
28+
refs/heads/tmp: 54c0231b14a71a46e6607255d509457e0df0b8be
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/libstd/panicking.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ fn log_panic(obj: &(Any+Send), file: &'static str, line: u32,
5252
let prev = LOCAL_STDERR.with(|s| s.borrow_mut().take());
5353
match (prev, err.as_mut()) {
5454
(Some(mut stderr), _) => {
55-
// FIXME: what to do when the thread printing panics?
5655
write(&mut *stderr);
5756
let mut s = Some(stderr);
5857
LOCAL_STDERR.with(|slot| {
@@ -71,6 +70,17 @@ pub fn on_panic(obj: &(Any+Send), file: &'static str, line: u32) {
7170
count
7271
});
7372

73+
// If this is the third nested call, on_panic triggered the last panic,
74+
// otherwise the double-panic check would have aborted the process.
75+
// Even if it is likely that on_panic was unable to log the backtrace,
76+
// abort immediately to avoid infinite recursion, so that attaching a
77+
// debugger provides a useable stacktrace.
78+
if panics >= 3 {
79+
util::dumb_print(format_args!("thread panicked while processing \
80+
panic. aborting."));
81+
unsafe { intrinsics::abort() }
82+
}
83+
7484
// If this is a double panic, make sure that we print a backtrace
7585
// for this panic. Otherwise only print it if logging is enabled.
7686
let log_backtrace = panics >= 2 || backtrace::log_enabled();

0 commit comments

Comments
 (0)