diff --git a/src/mac/streams/thread_names.rs b/src/mac/streams/thread_names.rs index 016dd48e..1e02336d 100644 --- a/src/mac/streams/thread_names.rs +++ b/src/mac/streams/thread_names.rs @@ -49,12 +49,6 @@ impl MinidumpWriter { dumper: &TaskDumper, tid: u32, ) -> Result { - // 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( @@ -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; +} diff --git a/src/mac/task_dumper.rs b/src/mac/task_dumper.rs index 013d432d..eeda3632 100644 --- a/src/mac/task_dumper.rs +++ b/src/mac/task_dumper.rs @@ -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), 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 = { @@ -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; +} diff --git a/tests/mac_minidump_writer.rs b/tests/mac_minidump_writer.rs index d62a18d2..dcc4aa3e 100644 --- a/tests/mac_minidump_writer.rs +++ b/tests/mac_minidump_writer.rs @@ -30,6 +30,7 @@ fn get_crash_reason<'a, T: std::ops::Deref + 'a>( struct Captured<'md> { #[allow(dead_code)] task: u32, + #[allow(dead_code)] thread: u32, minidump: Minidump<'md, memmap2::Mmap>, }