]>
git.proxmox.com Git - rustc.git/blob - src/vendor/backtrace/src/backtrace/unix_backtrace.rs
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.
12 use std
::os
::raw
::{c_void, c_int}
;
19 pub fn ip(&self) -> *mut c_void { self.addr }
20 pub fn symbol_address(&self) -> *mut c_void { self.addr }
24 fn backtrace(buf
: *mut *mut c_void
, sz
: c_int
) -> c_int
;
28 pub fn trace(cb
: &mut FnMut(&super::Frame
) -> bool
) {
29 const SIZE
: usize = 100;
31 let mut buf
: [*mut c_void
; SIZE
];
35 cnt
= backtrace(buf
.as_mut_ptr(), SIZE
as c_int
);
38 for addr
in buf
[..cnt
as usize].iter() {
39 let cx
= super::Frame
{
40 inner
: Frame { addr: *addr }
,