File tree Expand file tree Collapse file tree 4 files changed +37
-27
lines changed
Expand file tree Collapse file tree 4 files changed +37
-27
lines changed Original file line number Diff line number Diff line change 33use libc:: c_void;
44use std:: path:: PathBuf ;
55
6+ pub use crate :: platform:: TraceImpl ;
7+
68pub trait Symbol : Sized {
79 fn name ( & self ) -> Option < Vec < u8 > > ;
810 fn addr ( & self ) -> Option < * mut c_void > ;
@@ -43,25 +45,3 @@ pub trait Trace {
4345 where
4446 Self : Sized ;
4547}
46-
47- #[ cfg( not( all(
48- any( target_arch = "x86_64" , target_arch = "aarch64" ) ,
49- feature = "frame-pointer"
50- ) ) ) ]
51- mod backtrace_rs;
52- #[ cfg( not( all(
53- any( target_arch = "x86_64" , target_arch = "aarch64" ) ,
54- feature = "frame-pointer"
55- ) ) ) ]
56- pub use backtrace_rs:: Trace as TraceImpl ;
57-
58- #[ cfg( all(
59- any( target_arch = "x86_64" , target_arch = "aarch64" ) ,
60- feature = "frame-pointer"
61- ) ) ]
62- pub mod frame_pointer;
63- #[ cfg( all(
64- any( target_arch = "x86_64" , target_arch = "aarch64" ) ,
65- feature = "frame-pointer"
66- ) ) ]
67- pub use frame_pointer:: Trace as TraceImpl ;
Original file line number Diff line number Diff line change 1- impl super :: Frame for backtrace:: Frame {
1+ impl crate :: backtrace :: Frame for backtrace:: Frame {
22 type S = backtrace:: Symbol ;
33
44 fn ip ( & self ) -> usize {
@@ -16,7 +16,7 @@ impl super::Frame for backtrace::Frame {
1616
1717pub struct Trace { }
1818
19- impl super :: Trace for Trace {
19+ impl crate :: backtrace :: Trace for Trace {
2020 type Frame = backtrace:: Frame ;
2121
2222 fn trace < F : FnMut ( & Self :: Frame ) -> bool > ( _: * mut libc:: c_void , cb : F ) {
Original file line number Diff line number Diff line change @@ -3,13 +3,43 @@ mod nix_impl {
33 pub mod addr_validate;
44 pub mod profiler;
55 pub mod timer;
6+
7+ #[ cfg( all(
8+ any( target_arch = "x86_64" , target_arch = "aarch64" ) ,
9+ feature = "frame-pointer" ,
10+ ) ) ]
11+ mod frame_pointer;
12+ #[ cfg( all(
13+ any( target_arch = "x86_64" , target_arch = "aarch64" ) ,
14+ feature = "frame-pointer" ,
15+ ) ) ]
16+ pub use frame_pointer:: Trace as TraceImpl ;
17+
18+ #[ cfg( not( all(
19+ any( target_arch = "x86_64" , target_arch = "aarch64" ) ,
20+ feature = "frame-pointer" ,
21+ ) ) ) ]
22+ #[ path = "../backtrace_rs.rs" ]
23+ mod backtrace_rs;
24+ #[ cfg( not( all(
25+ any( target_arch = "x86_64" , target_arch = "aarch64" ) ,
26+ feature = "frame-pointer" ,
27+ ) ) ) ]
28+ pub use backtrace_rs:: Trace as TraceImpl ;
629}
730
831#[ cfg( target_os = "windows" ) ]
932mod windows_impl {
1033 pub mod addr_validate;
1134 pub mod profiler;
1235 pub mod timer;
36+
37+ #[ cfg( feature = "frame-pointer" ) ]
38+ std:: compile_error!( "frame-pointer feature is currently not supported on windows." ) ;
39+
40+ #[ path = "../backtrace_rs.rs" ]
41+ mod backtrace_rs;
42+ pub use backtrace_rs:: Trace as TraceImpl ;
1343}
1444
1545#[ cfg( any( target_os = "linux" , target_os = "macos" ) ) ]
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use std::ptr::null_mut;
44
55use libc:: c_void;
66
7- use crate :: addr_validate :: validate;
7+ use crate :: validate;
88
99#[ derive( Clone , Debug ) ]
1010pub struct Frame {
@@ -16,7 +16,7 @@ extern "C" {
1616
1717}
1818
19- impl super :: Frame for Frame {
19+ impl crate :: backtrace :: Frame for Frame {
2020 type S = backtrace:: Symbol ;
2121
2222 fn ip ( & self ) -> usize {
@@ -37,7 +37,7 @@ impl super::Frame for Frame {
3737}
3838
3939pub struct Trace { }
40- impl super :: Trace for Trace {
40+ impl crate :: backtrace :: Trace for Trace {
4141 type Frame = Frame ;
4242
4343 fn trace < F : FnMut ( & Self :: Frame ) -> bool > ( ucontext : * mut libc:: c_void , mut cb : F ) {
You can’t perform that action at this time.
0 commit comments