1 // Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! Symbolication strategy using `dladdr`
13 //! The `dladdr` API is available on most Unix implementations but it's quite
14 //! basic, not handling inline frame information at all. Since it's so prevalent
15 //! though we have an option to use it!
17 use core
::ffi
::c_void
;
18 use crate::types
::BytesOrWideString
;
19 use crate::symbolize
::{dladdr, SymbolName, ResolveWhat}
;
21 pub struct Symbol(dladdr
::Symbol
);
24 pub fn name(&self) -> Option
<SymbolName
> {
28 pub fn addr(&self) -> Option
<*mut c_void
> {
32 pub fn filename_raw(&self) -> Option
<BytesOrWideString
> {
36 #[cfg(feature = "std")]
37 pub fn filename(&self) -> Option
<&::std
::path
::Path
> {
41 pub fn lineno(&self) -> Option
<u32> {
46 pub unsafe fn resolve(what
: ResolveWhat
, cb
: &mut FnMut(&super::Symbol
)) {
47 dladdr
::resolve(what
.address_or_ip(), &mut |sym
| {