91
91
// `Backtrace`, but that's a relatively small price to pay relative to capturing
92
92
// a backtrace or actually symbolizing it.
93
93
94
- use crate :: backtrace_rs:: { self , BytesOrWideString } ;
95
94
use crate :: env;
96
95
use crate :: ffi:: c_void;
97
96
use crate :: fmt;
98
97
use crate :: sync:: atomic:: { AtomicUsize , Ordering :: SeqCst } ;
99
98
use crate :: sync:: Mutex ;
100
99
use crate :: sys_common:: backtrace:: { lock, output_filename} ;
101
100
use crate :: vec:: Vec ;
101
+ use backtrace:: BytesOrWideString ;
102
+ use backtrace_rs as backtrace;
102
103
103
104
/// A captured OS thread stack backtrace.
104
105
///
@@ -149,7 +150,7 @@ struct BacktraceFrame {
149
150
}
150
151
151
152
enum RawFrame {
152
- Actual ( backtrace_rs :: Frame ) ,
153
+ Actual ( backtrace :: Frame ) ,
153
154
#[ cfg( test) ]
154
155
Fake ,
155
156
}
@@ -196,7 +197,7 @@ impl fmt::Debug for BacktraceSymbol {
196
197
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
197
198
write ! ( fmt, "{{ " ) ?;
198
199
199
- if let Some ( fn_name) = self . name . as_ref ( ) . map ( |b| backtrace_rs :: SymbolName :: new ( b) ) {
200
+ if let Some ( fn_name) = self . name . as_ref ( ) . map ( |b| backtrace :: SymbolName :: new ( b) ) {
200
201
write ! ( fmt, "fn: \" {:#}\" " , fn_name) ?;
201
202
} else {
202
203
write ! ( fmt, "fn: <unknown>" ) ?;
@@ -222,7 +223,7 @@ impl fmt::Debug for BytesOrWide {
222
223
BytesOrWide :: Bytes ( w) => BytesOrWideString :: Bytes ( w) ,
223
224
BytesOrWide :: Wide ( w) => BytesOrWideString :: Wide ( w) ,
224
225
} ,
225
- backtrace_rs :: PrintFmt :: Short ,
226
+ backtrace :: PrintFmt :: Short ,
226
227
crate :: env:: current_dir ( ) . as_ref ( ) . ok ( ) ,
227
228
)
228
229
}
@@ -298,7 +299,7 @@ impl Backtrace {
298
299
let mut frames = Vec :: new ( ) ;
299
300
let mut actual_start = None ;
300
301
unsafe {
301
- backtrace_rs :: trace_unsynchronized ( |frame| {
302
+ backtrace :: trace_unsynchronized ( |frame| {
302
303
frames. push ( BacktraceFrame {
303
304
frame : RawFrame :: Actual ( frame. clone ( ) ) ,
304
305
symbols : Vec :: new ( ) ,
@@ -349,9 +350,9 @@ impl fmt::Display for Backtrace {
349
350
350
351
let full = fmt. alternate ( ) ;
351
352
let ( frames, style) = if full {
352
- ( & capture. frames [ ..] , backtrace_rs :: PrintFmt :: Full )
353
+ ( & capture. frames [ ..] , backtrace :: PrintFmt :: Full )
353
354
} else {
354
- ( & capture. frames [ capture. actual_start ..] , backtrace_rs :: PrintFmt :: Short )
355
+ ( & capture. frames [ capture. actual_start ..] , backtrace :: PrintFmt :: Short )
355
356
} ;
356
357
357
358
// When printing paths we try to strip the cwd if it exists, otherwise
@@ -363,7 +364,7 @@ impl fmt::Display for Backtrace {
363
364
output_filename ( fmt, path, style, cwd. as_ref ( ) . ok ( ) )
364
365
} ;
365
366
366
- let mut f = backtrace_rs :: BacktraceFmt :: new ( fmt, style, & mut print_path) ;
367
+ let mut f = backtrace :: BacktraceFmt :: new ( fmt, style, & mut print_path) ;
367
368
f. add_context ( ) ?;
368
369
for frame in frames {
369
370
let mut f = f. frame ( ) ;
@@ -373,7 +374,7 @@ impl fmt::Display for Backtrace {
373
374
for symbol in frame. symbols . iter ( ) {
374
375
f. print_raw (
375
376
frame. frame . ip ( ) ,
376
- symbol. name . as_ref ( ) . map ( |b| backtrace_rs :: SymbolName :: new ( b) ) ,
377
+ symbol. name . as_ref ( ) . map ( |b| backtrace :: SymbolName :: new ( b) ) ,
377
378
symbol. filename . as_ref ( ) . map ( |b| match b {
378
379
BytesOrWide :: Bytes ( w) => BytesOrWideString :: Bytes ( w) ,
379
380
BytesOrWide :: Wide ( w) => BytesOrWideString :: Wide ( w) ,
@@ -408,7 +409,7 @@ impl Capture {
408
409
RawFrame :: Fake => unimplemented ! ( ) ,
409
410
} ;
410
411
unsafe {
411
- backtrace_rs :: resolve_frame_unsynchronized ( frame, |symbol| {
412
+ backtrace :: resolve_frame_unsynchronized ( frame, |symbol| {
412
413
symbols. push ( BacktraceSymbol {
413
414
name : symbol. name ( ) . map ( |m| m. as_bytes ( ) . to_vec ( ) ) ,
414
415
filename : symbol. filename_raw ( ) . map ( |b| match b {
0 commit comments