fn main() {
for path in env::args().skip(1) {
let file = fs::File::open(&path).unwrap();
- let mmap = unsafe { memmap::Mmap::map(&file).unwrap() };
+ let mmap = unsafe { memmap2::Mmap::map(&file).unwrap() };
let object = object::File::parse(&*mmap).unwrap();
let endian = if object.is_little_endian() {
gimli::RunTimeEndian::Little
let mut path = path::PathBuf::new();
if let Some(file) = row.file(header) {
path = comp_dir.clone();
- if let Some(dir) = file.directory(header) {
- path.push(dwarf.attr_string(&unit, dir)?.to_string_lossy().as_ref());
+
+ // The directory index 0 is defined to correspond to the compilation unit directory.
+ if file.directory_index() != 0 {
+ if let Some(dir) = file.directory(header) {
+ path.push(
+ dwarf.attr_string(&unit, dir)?.to_string_lossy().as_ref(),
+ );
+ }
}
+
path.push(
dwarf
.attr_string(&unit, file.path_name())?