Skip to content
Merged
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
13 changes: 7 additions & 6 deletions src/mac/streams/thread_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ impl MinidumpWriter {
dumper: &TaskDumper,
tid: u32,
) -> Result<MDLocationDescriptor, WriterError> {
// As noted in usr/include/mach/thread_info.h, the THREAD_EXTENDED_INFO
// return is exactly the same as proc_pidinfo(..., proc_threadinfo)
impl mach::ThreadInfo for libc::proc_threadinfo {
const FLAVOR: u32 = 5; // THREAD_EXTENDED_INFO
}

let thread_info: libc::proc_threadinfo = dumper.thread_info(tid)?;

let name = std::str::from_utf8(
Expand All @@ -77,3 +71,10 @@ impl MinidumpWriter {
Ok(write_string_to_location(buffer, tname)?)
}
}

/// As noted in `usr/include/mach/thread_info.h`, the `THREAD_EXTENDED_INFO`
/// return is exactly the same as `proc_pidinfo(..., proc_threadinfo)`
impl mach::ThreadInfo for libc::proc_threadinfo {
/// `THREAD_EXTENDED_INFO`
const FLAVOR: u32 = 5;
}
8 changes: 4 additions & 4 deletions src/mac/task_dumper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,6 @@ impl TaskDumper {
/// The syscall to retrieve the location of the loaded images fails, or
/// the syscall to read the loaded images from the process memory fails
pub fn read_images(&self) -> Result<(AllImagesInfo, Vec<ImageInfo>), TaskDumpError> {
impl mach::TaskInfo for mach::task_info::task_dyld_info {
const FLAVOR: u32 = mach::task_info::TASK_DYLD_INFO;
}

// Retrieve the address at which the list of loaded images is located
// within the task
let all_images_addr = {
Expand Down Expand Up @@ -460,3 +456,7 @@ impl TaskDumper {
Ok(pid)
}
}

impl mach::TaskInfo for mach::task_info::task_dyld_info {
const FLAVOR: u32 = mach::task_info::TASK_DYLD_INFO;
}
1 change: 1 addition & 0 deletions tests/mac_minidump_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fn get_crash_reason<'a, T: std::ops::Deref<Target = [u8]> + 'a>(
struct Captured<'md> {
#[allow(dead_code)]
task: u32,
#[allow(dead_code)]
thread: u32,
minidump: Minidump<'md, memmap2::Mmap>,
}
Expand Down
Loading