use std::env;
use std::fs::File;
use std::mem;
-use std::os::raw::c_void;
-use std::path::{Path, PathBuf};
+use libc::c_void;
+use std::path::PathBuf;
use std::u32;
+use std::prelude::v1::*;
use SymbolName;
+use types::BytesOrWideString;
const MAPPINGS_CACHE_SIZE: usize = 4;
-type Dwarf<'map> = addr2line::Context<gimli::EndianBuf<'map, gimli::RunTimeEndian>>;
+type Dwarf = addr2line::Context<gimli::EndianRcSlice<gimli::RunTimeEndian>>;
type Symbols<'map> = object::SymbolMap<'map>;
struct Mapping {
+ dwarf: Dwarf,
// 'static lifetime is a lie to hack around lack of support for self-referential structs.
- dwarf: Dwarf<'static>,
symbols: Symbols<'static>,
_map: Mmap,
}
let dwarf = addr2line::Context::new(&object).ok()?;
let symbols = object.symbol_map();
// Convert to 'static lifetimes.
- unsafe { (mem::transmute(dwarf), mem::transmute(symbols)) }
+ (dwarf, unsafe { mem::transmute(symbols) })
};
Some(Mapping {
dwarf,
pub struct Symbol {
addr: usize,
- file: Option<PathBuf>,
+ file: Option<String>,
line: Option<u64>,
name: Option<String>,
}
impl Symbol {
fn new(addr: usize,
- file: Option<PathBuf>,
+ file: Option<String>,
line: Option<u64>,
name: Option<String>)
-> Symbol {
Some(self.addr as *mut c_void)
}
- pub fn filename(&self) -> Option<&Path> {
- self.file.as_ref().map(|f| f.as_ref())
+ pub fn filename_raw(&self) -> Option<BytesOrWideString> {
+ self.file.as_ref().map(|f| BytesOrWideString::Bytes(f.as_bytes()))
}
pub fn lineno(&self) -> Option<u32> {