Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Fallback to dladdr-based resolve_symbol if backtrace failed."
This reverts commit 7169fe5.
  • Loading branch information
alexcrichton committed Nov 4, 2017
commit 11419494c1d11d46c9ee23d9148979b5033fc65b
8 changes: 8 additions & 0 deletions src/libstd/sys/unix/backtrace/printing/dladdr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ pub fn resolve_symname<F>(frame: Frame,
}
}

pub fn foreach_symbol_fileline<F>(_symbol_addr: Frame,
_f: F,
_: &BacktraceContext) -> io::Result<bool>
where F: FnMut(&[u8], libc::c_int) -> io::Result<()>
{
Ok(false)
}

#[repr(C)]
struct Dl_info {
dli_fname: *const libc::c_char,
Expand Down
35 changes: 6 additions & 29 deletions src/libstd/sys/unix/backtrace/printing/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2017 The Rust Project Developers. See the COPYRIGHT
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand All @@ -8,36 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

mod dladdr;

use sys::backtrace::BacktraceContext;
use sys_common::backtrace::Frame;
use io;

#[cfg(target_os = "emscripten")]
pub use self::dladdr::resolve_symname;
pub use self::imp::{foreach_symbol_fileline, resolve_symname};

#[cfg(target_os = "emscripten")]
pub fn foreach_symbol_fileline<F>(_: Frame, _: F, _: &BacktraceContext) -> io::Result<bool>
where
F: FnMut(&[u8], ::libc::c_int) -> io::Result<()>
{
Ok(false)
}

#[cfg(not(target_os = "emscripten"))]
pub use sys_common::gnu::libbacktrace::foreach_symbol_fileline;
#[path = "dladdr.rs"]
mod imp;

#[cfg(not(target_os = "emscripten"))]
pub fn resolve_symname<F>(frame: Frame, callback: F, bc: &BacktraceContext) -> io::Result<()>
where
F: FnOnce(Option<&str>) -> io::Result<()>
{
::sys_common::gnu::libbacktrace::resolve_symname(frame, |symname| {
if symname.is_some() {
callback(symname)
} else {
dladdr::resolve_symname(frame, callback, bc)
}
}, bc)
mod imp {
pub use sys_common::gnu::libbacktrace::{foreach_symbol_fileline, resolve_symname};
}