File tree 3 files changed +10
-14
lines changed
3 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ mod imp {
42
42
use crate :: io;
43
43
use crate :: mem;
44
44
use crate :: ptr;
45
+ use crate :: thread;
45
46
46
47
use libc:: MAP_FAILED ;
47
48
use libc:: { mmap, munmap} ;
@@ -95,15 +96,16 @@ mod imp {
95
96
info : * mut libc:: siginfo_t ,
96
97
_data : * mut libc:: c_void ,
97
98
) {
98
- use crate :: sys_common:: util:: report_overflow;
99
-
100
99
let guard = thread_info:: stack_guard ( ) . unwrap_or ( 0 ..0 ) ;
101
100
let addr = siginfo_si_addr ( info) ;
102
101
103
102
// If the faulting address is within the guard page, then we print a
104
103
// message saying so and abort.
105
104
if guard. start <= addr && addr < guard. end {
106
- report_overflow ( ) ;
105
+ rterr ! (
106
+ "\n thread '{}' has overflowed its stack\n " ,
107
+ thread:: current( ) . name( ) . unwrap_or( "<unknown>" )
108
+ ) ;
107
109
rtabort ! ( "stack overflow" ) ;
108
110
} else {
109
111
// Unregister ourselves by reverting back to the default behavior.
Original file line number Diff line number Diff line change 1
1
#![ cfg_attr( test, allow( dead_code) ) ]
2
2
3
3
use crate :: sys:: c;
4
- use crate :: sys_common :: util :: report_overflow ;
4
+ use crate :: thread ;
5
5
6
6
pub struct Handler ;
7
7
@@ -24,7 +24,10 @@ extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POINTERS) -
24
24
let code = rec. ExceptionCode ;
25
25
26
26
if code == c:: EXCEPTION_STACK_OVERFLOW {
27
- report_overflow ( ) ;
27
+ rterr ! (
28
+ "\n thread '{}' has overflowed its stack\n " ,
29
+ thread:: current( ) . name( ) . unwrap_or( "<unknown>" )
30
+ ) ;
28
31
}
29
32
c:: EXCEPTION_CONTINUE_SEARCH
30
33
}
Original file line number Diff line number Diff line change 1
1
use crate :: fmt;
2
2
use crate :: io:: prelude:: * ;
3
3
use crate :: sys:: stdio:: panic_output;
4
- use crate :: thread;
5
4
6
5
pub fn dumb_print ( args : fmt:: Arguments < ' _ > ) {
7
6
if let Some ( mut out) = panic_output ( ) {
8
7
let _ = out. write_fmt ( args) ;
9
8
}
10
9
}
11
-
12
- #[ allow( dead_code) ] // stack overflow detection not enabled on all platforms
13
- pub unsafe fn report_overflow ( ) {
14
- dumb_print ( format_args ! (
15
- "\n thread '{}' has overflowed its stack\n " ,
16
- thread:: current( ) . name( ) . unwrap_or( "<unknown>" )
17
- ) ) ;
18
- }
You can’t perform that action at this time.
0 commit comments