Skip to content

Commit a3f923e

Browse files
committed
---
yaml --- r: 236451 b: refs/heads/auto c: 54c0231 h: refs/heads/master i: 236449: 9a0ca9f 236447: 98871f6 v: v3
1 parent d8b6969 commit a3f923e

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
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: c7b84909b00dcf5f762778b4aa9783770c69416d
11+
refs/heads/auto: 54c0231b14a71a46e6607255d509457e0df0b8be
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/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)