Skip to content

Commit

Permalink
Refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
WINSDK committed Apr 21, 2024
1 parent 63fb2b9 commit fb600cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions debugvault/src/dwarf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ impl Dwarf {
Ok(Dwarf { file_attrs })
}

#[allow(dead_code)]
pub fn load(path: &Path) -> Result<Self> {
let file = std::fs::File::open(path)?;
let mmap = unsafe { memmap2::Mmap::map(&file)? };
let obj = object::File::parse(&*mmap)?;
Self::parse(&obj)
}

#[allow(dead_code)]
pub fn merge(&mut self, other: Self) {
self.file_attrs.extend(other.file_attrs);
}
Expand Down
7 changes: 4 additions & 3 deletions debugvault/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use processor_shared::{AddressMap, Addressed};
use radix_trie::{Trie, TrieCommon};
use std::path::Path;
use std::sync::Arc;
use std::{fmt, process::Command};
use std::fmt;
use tokenizing::Token;

mod common;
Expand Down Expand Up @@ -131,6 +131,7 @@ pub struct Index {
impl Index {
pub fn parse<'data>(
obj: &object::File<'data>,
#[allow(unused_variables)]
path: &Path,
mut syms: AddressMap<RawSymbol<'data>>,
) -> Result<Self, Error> {
Expand All @@ -139,7 +140,7 @@ impl Index {
let dwarf = match obj {
#[cfg(target_os = "macos")]
object::File::MachO32(_) | object::File::MachO64(_) => macho_dwarf(obj, path),
_ => dwarf::Dwarf::parse(obj),
_ => Dwarf::parse(obj),
};

match dwarf {
Expand Down Expand Up @@ -332,7 +333,7 @@ pub fn macho_dwarf(obj: &object::File, path: &Path) -> Result<Dwarf, dwarf::Erro

if dsymutil_path.exists() {
log::PROGRESS.set("Running dsymutil.", 1);
let exit_status = Command::new(dsymutil_path)
let exit_status = std::process::Command::new(dsymutil_path)
.arg("--linker=parallel")
.arg(path)
.spawn()?
Expand Down

0 comments on commit fb600cb

Please sign in to comment.