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 } ;
94
95
use crate :: env;
95
96
use crate :: ffi:: c_void;
96
97
use crate :: fmt;
97
98
use crate :: sync:: atomic:: { AtomicUsize , Ordering :: SeqCst } ;
98
99
use crate :: sync:: Mutex ;
99
100
use crate :: sys_common:: backtrace:: { lock, output_filename} ;
100
101
use crate :: vec:: Vec ;
101
- use backtrace:: BytesOrWideString ;
102
- use backtrace_rs as backtrace;
103
102
104
103
/// A captured OS thread stack backtrace.
105
104
///
@@ -150,7 +149,7 @@ struct BacktraceFrame {
150
149
}
151
150
152
151
enum RawFrame {
153
- Actual ( backtrace :: Frame ) ,
152
+ Actual ( backtrace_rs :: Frame ) ,
154
153
#[ cfg( test) ]
155
154
Fake ,
156
155
}
@@ -197,7 +196,7 @@ impl fmt::Debug for BacktraceSymbol {
197
196
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
198
197
write ! ( fmt, "{{ " ) ?;
199
198
200
- if let Some ( fn_name) = self . name . as_ref ( ) . map ( |b| backtrace :: SymbolName :: new ( b) ) {
199
+ if let Some ( fn_name) = self . name . as_ref ( ) . map ( |b| backtrace_rs :: SymbolName :: new ( b) ) {
201
200
write ! ( fmt, "fn: \" {:#}\" " , fn_name) ?;
202
201
} else {
203
202
write ! ( fmt, "fn: <unknown>" ) ?;
@@ -223,7 +222,7 @@ impl fmt::Debug for BytesOrWide {
223
222
BytesOrWide :: Bytes ( w) => BytesOrWideString :: Bytes ( w) ,
224
223
BytesOrWide :: Wide ( w) => BytesOrWideString :: Wide ( w) ,
225
224
} ,
226
- backtrace :: PrintFmt :: Short ,
225
+ backtrace_rs :: PrintFmt :: Short ,
227
226
crate :: env:: current_dir ( ) . as_ref ( ) . ok ( ) ,
228
227
)
229
228
}
@@ -305,7 +304,7 @@ impl Backtrace {
305
304
let mut frames = Vec :: new ( ) ;
306
305
let mut actual_start = None ;
307
306
unsafe {
308
- backtrace :: trace_unsynchronized ( |frame| {
307
+ backtrace_rs :: trace_unsynchronized ( |frame| {
309
308
frames. push ( BacktraceFrame {
310
309
frame : RawFrame :: Actual ( frame. clone ( ) ) ,
311
310
symbols : Vec :: new ( ) ,
@@ -356,9 +355,9 @@ impl fmt::Display for Backtrace {
356
355
357
356
let full = fmt. alternate ( ) ;
358
357
let ( frames, style) = if full {
359
- ( & capture. frames [ ..] , backtrace :: PrintFmt :: Full )
358
+ ( & capture. frames [ ..] , backtrace_rs :: PrintFmt :: Full )
360
359
} else {
361
- ( & capture. frames [ capture. actual_start ..] , backtrace :: PrintFmt :: Short )
360
+ ( & capture. frames [ capture. actual_start ..] , backtrace_rs :: PrintFmt :: Short )
362
361
} ;
363
362
364
363
// When printing paths we try to strip the cwd if it exists, otherwise
@@ -370,7 +369,7 @@ impl fmt::Display for Backtrace {
370
369
output_filename ( fmt, path, style, cwd. as_ref ( ) . ok ( ) )
371
370
} ;
372
371
373
- let mut f = backtrace :: BacktraceFmt :: new ( fmt, style, & mut print_path) ;
372
+ let mut f = backtrace_rs :: BacktraceFmt :: new ( fmt, style, & mut print_path) ;
374
373
f. add_context ( ) ?;
375
374
for frame in frames {
376
375
let mut f = f. frame ( ) ;
@@ -380,7 +379,7 @@ impl fmt::Display for Backtrace {
380
379
for symbol in frame. symbols . iter ( ) {
381
380
f. print_raw (
382
381
frame. frame . ip ( ) ,
383
- symbol. name . as_ref ( ) . map ( |b| backtrace :: SymbolName :: new ( b) ) ,
382
+ symbol. name . as_ref ( ) . map ( |b| backtrace_rs :: SymbolName :: new ( b) ) ,
384
383
symbol. filename . as_ref ( ) . map ( |b| match b {
385
384
BytesOrWide :: Bytes ( w) => BytesOrWideString :: Bytes ( w) ,
386
385
BytesOrWide :: Wide ( w) => BytesOrWideString :: Wide ( w) ,
@@ -415,7 +414,7 @@ impl Capture {
415
414
RawFrame :: Fake => unimplemented ! ( ) ,
416
415
} ;
417
416
unsafe {
418
- backtrace :: resolve_frame_unsynchronized ( frame, |symbol| {
417
+ backtrace_rs :: resolve_frame_unsynchronized ( frame, |symbol| {
419
418
symbols. push ( BacktraceSymbol {
420
419
name : symbol. name ( ) . map ( |m| m. as_bytes ( ) . to_vec ( ) ) ,
421
420
filename : symbol. filename_raw ( ) . map ( |b| match b {
0 commit comments