Skip to content

Commit 1d658cf

Browse files
authored
Fixes mac only warnings that clutter output (#152)
1 parent d974a2d commit 1d658cf

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/mac/streams/thread_names.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ impl MinidumpWriter {
4949
dumper: &TaskDumper,
5050
tid: u32,
5151
) -> Result<MDLocationDescriptor, WriterError> {
52-
// As noted in usr/include/mach/thread_info.h, the THREAD_EXTENDED_INFO
53-
// return is exactly the same as proc_pidinfo(..., proc_threadinfo)
54-
impl mach::ThreadInfo for libc::proc_threadinfo {
55-
const FLAVOR: u32 = 5; // THREAD_EXTENDED_INFO
56-
}
57-
5852
let thread_info: libc::proc_threadinfo = dumper.thread_info(tid)?;
5953

6054
let name = std::str::from_utf8(
@@ -77,3 +71,10 @@ impl MinidumpWriter {
7771
Ok(write_string_to_location(buffer, tname)?)
7872
}
7973
}
74+
75+
/// As noted in `usr/include/mach/thread_info.h`, the `THREAD_EXTENDED_INFO`
76+
/// return is exactly the same as `proc_pidinfo(..., proc_threadinfo)`
77+
impl mach::ThreadInfo for libc::proc_threadinfo {
78+
/// `THREAD_EXTENDED_INFO`
79+
const FLAVOR: u32 = 5;
80+
}

src/mac/task_dumper.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,6 @@ impl TaskDumper {
340340
/// The syscall to retrieve the location of the loaded images fails, or
341341
/// the syscall to read the loaded images from the process memory fails
342342
pub fn read_images(&self) -> Result<(AllImagesInfo, Vec<ImageInfo>), TaskDumpError> {
343-
impl mach::TaskInfo for mach::task_info::task_dyld_info {
344-
const FLAVOR: u32 = mach::task_info::TASK_DYLD_INFO;
345-
}
346-
347343
// Retrieve the address at which the list of loaded images is located
348344
// within the task
349345
let all_images_addr = {
@@ -460,3 +456,7 @@ impl TaskDumper {
460456
Ok(pid)
461457
}
462458
}
459+
460+
impl mach::TaskInfo for mach::task_info::task_dyld_info {
461+
const FLAVOR: u32 = mach::task_info::TASK_DYLD_INFO;
462+
}

tests/mac_minidump_writer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ fn get_crash_reason<'a, T: std::ops::Deref<Target = [u8]> + 'a>(
3030
struct Captured<'md> {
3131
#[allow(dead_code)]
3232
task: u32,
33+
#[allow(dead_code)]
3334
thread: u32,
3435
minidump: Minidump<'md, memmap2::Mmap>,
3536
}

0 commit comments

Comments
 (0)