Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions src/bin/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ mod linux {
.unwrap();

let stack_res = MinidumpWriter::copy_from_process(
&dumper.process_inspector,
dumper.process_inspector.as_ref(),
stack_var,
std::mem::size_of::<usize>(),
)?;

test!(stack_res == expected_stack, "stack var not correct");

let heap_res = MinidumpWriter::copy_from_process(
&dumper.process_inspector,
dumper.process_inspector.as_ref(),
heap_var,
std::mem::size_of::<usize>(),
)?;
Expand Down
8 changes: 4 additions & 4 deletions src/linux/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct DynVaddresses {
}

fn has_android_packed_relocations(
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
load_bias: usize,
vaddrs: DynVaddresses,
) -> Result<()> {
Expand All @@ -71,7 +71,7 @@ fn has_android_packed_relocations(
}

fn get_effective_load_bias(
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
ehdr: &elf_header::Header,
address: usize,
) -> usize {
Expand All @@ -91,7 +91,7 @@ fn get_effective_load_bias(
}

fn parse_loaded_elf_program_headers(
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
ehdr: &elf_header::Header,
address: usize,
) -> DynVaddresses {
Expand Down Expand Up @@ -131,7 +131,7 @@ fn parse_loaded_elf_program_headers(
}

pub fn late_process_mappings(
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
mappings: &mut [MappingInfo],
) -> Result<()> {
// Only consider exec mappings that indicate a file path was mapped, and
Expand Down
2 changes: 1 addition & 1 deletion src/linux/auxv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub struct AuxvDumpInfo {
impl AuxvDumpInfo {
pub fn try_filling_missing_info(
&mut self,
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
pid: Pid,
mut soft_errors: impl WriteErrorList<AuxvError>,
) -> Result<(), AuxvError> {
Expand Down
2 changes: 1 addition & 1 deletion src/linux/dso_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub struct RDebug {
}

pub fn write_dso_debug_stream(
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
buffer: &mut Buffer,
auxv: &AuxvDumpInfo,
) -> Result<MDRawDirectory> {
Expand Down
2 changes: 1 addition & 1 deletion src/linux/dumper_cpu_info/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn parse_features(_val: &str) -> u32 {
}

pub fn write_cpu_information(
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
sys_info: &mut MDRawSystemInfo,
) -> Result<()> {
// The CPUID value is broken up in several entries in /proc/cpuinfo.
Expand Down
2 changes: 1 addition & 1 deletion src/linux/dumper_cpu_info/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl CpuInfoEntry {
}

pub fn write_cpu_information(
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
sys_info: &mut MDRawSystemInfo,
) -> Result<()> {
let vendor_id_name = "vendor_id";
Expand Down
8 changes: 4 additions & 4 deletions src/linux/maps_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn sanitize_path(pathname: OsString) -> OsString {
impl MappingInfo {
/// Get the mappings for the given process.
pub fn for_pid(
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
pid: i32,
linux_gate_loc: Option<AuxvType>,
) -> Result<Vec<Self>> {
Expand Down Expand Up @@ -298,7 +298,7 @@ impl MappingInfo {

/// Find the shared object name (SONAME) by examining the ELF information
/// for the mapping.
fn so_name(&self, process_inspector: &ProcessInspector) -> Result<String> {
fn so_name(&self, process_inspector: &dyn ProcessInspector) -> Result<String> {
let path = Path::new(self.name.as_deref().unwrap_or_default());
super::module_reader::read_soname_from_file(process_inspector, path, self.offset)
.map_err(MapsReaderError::ReadSoNameFromFileFailed)
Expand All @@ -311,7 +311,7 @@ impl MappingInfo {

pub fn get_mapping_effective_path_name_and_version(
&self,
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
soname: Option<String>,
) -> Result<(PathBuf, String, Option<SoVersion>)> {
let mut file_path = PathBuf::from(self.name.clone().unwrap_or_default());
Expand Down Expand Up @@ -731,7 +731,7 @@ a4840000-a4873000 rw-p 09021000 08:12 393449 /data/app/org.mozilla.firefox-1
let process_inspector = process_inspection::local(0);

let (file_path, file_name, _version) = mappings[0]
.get_mapping_effective_path_name_and_version(&process_inspector, None)
.get_mapping_effective_path_name_and_version(process_inspector.as_ref(), None)
.expect("Couldn't get effective name for mapping");
assert_eq!(file_name, "libmozgtk.so");
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion src/linux/minidump_writer/app_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ impl MinidumpWriter {
pub fn write_app_memory(&mut self, buffer: &mut DumpBuf) -> Result<(), CopyFromProcessError> {
for app_memory in &self.app_memory {
let data_copy = Self::copy_from_process(
&self.process_inspector,
self.process_inspector.as_ref(),
app_memory.ptr,
app_memory.length,
)?;
Expand Down
6 changes: 3 additions & 3 deletions src/linux/minidump_writer/handle_data_stream.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
super::*,
crate::{linux::process_inspection, mem_writer::MemoryWriter},
crate::{linux::process_inspection::ProcessInspector, mem_writer::MemoryWriter},
std::{
ffi::OsStr,
mem,
Expand All @@ -9,7 +9,7 @@ use {
};

fn descriptor_from_path(
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
buffer: &mut DumpBuf,
path: &Path,
) -> Option<MDRawHandleDescriptor> {
Expand Down Expand Up @@ -73,7 +73,7 @@ impl MinidumpWriter {
.filter_map(|filename| filename.ok())
.filter_map(|filename| {
let path = proc_fd_path.join(filename);
descriptor_from_path(&self.process_inspector, buffer, &path)
descriptor_from_path(self.process_inspector.as_ref(), buffer, &path)
})
.collect();
let number_of_descriptors = descriptors.len() as u32;
Expand Down
8 changes: 4 additions & 4 deletions src/linux/minidump_writer/mappings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl MinidumpWriter {

log::debug!("failed to get build id from process memory ({e}), attempting to retrieve from {}", path.display());

module_reader::read_build_id_from_file(&self.process_inspector, path.as_ref()).map_err(errors::WriterError::ModuleReaderError)
module_reader::read_build_id_from_file(self.process_inspector.as_ref(), path.as_ref()).map_err(errors::WriterError::ModuleReaderError)
})
.unwrap_or_else(|e| {
log::warn!("failed to get build id for mapping: {e}");
Expand All @@ -61,7 +61,7 @@ impl MinidumpWriter {
let soname = self.soname_from_process_memory_for_index(map_idx).ok();

let module = fill_raw_module(
&self.process_inspector,
self.process_inspector.as_ref(),
buffer,
&self.mappings[map_idx],
&identifier,
Expand All @@ -74,7 +74,7 @@ impl MinidumpWriter {
for user in &self.user_mapping_list {
// GUID was provided by caller.
let module = fill_raw_module(
&self.process_inspector,
self.process_inspector.as_ref(),
buffer,
&user.mapping,
&user.identifier,
Expand All @@ -99,7 +99,7 @@ impl MinidumpWriter {
}
}
fn fill_raw_module(
process_inspector: &ProcessInspector,
process_inspector: &dyn ProcessInspector,
buffer: &mut DumpBuf,
mapping: &MappingInfo,
identifier: &[u8],
Expand Down
Loading
Loading