Debian Codegraph @

third_party/rust/minidump-writer/src/mac/streams/breakpad_info.rs

raw
1 use super::*;
2 use format::{BreakpadInfoValid, MINIDUMP_BREAKPAD_INFO as BreakpadInfo};
3
4 impl MinidumpWriter {
5 /// Writes the [`BreakpadInfo`] stream.
6 ///
7 /// For MacOS the primary use of this stream is to differentiate between
8 /// the thread that actually raised an exception, and the thread on which
9 /// the exception port was listening, so that the exception port (handler)
10 /// thread can be deprioritized/ignored when analyzing the minidump.
11 pub(crate) fn write_breakpad_info(
12 &mut self,
13 buffer: &mut DumpBuf,
14 _dumper: &TaskDumper,
15 ) -> Result<MDRawDirectory, WriterError> {
16 let bp_section = MemoryWriter::<BreakpadInfo>::alloc_with_val(
17 buffer,
18 BreakpadInfo {
19 validity: BreakpadInfoValid::DumpThreadId.bits()
20 | BreakpadInfoValid::RequestingThreadId.bits(),
21 // The thread where the exception port handled the exception, might
22 // be useful to ignore/deprioritize when processing the minidump
23 dump_thread_id: self.handler_thread,
24 // The actual thread where the exception was thrown
25 requesting_thread_id: self.crash_context.as_ref().map(|cc| cc.thread).unwrap_or(0),
26 },
27 )?;
28
29 Ok(MDRawDirectory {
30 stream_type: MDStreamType::BreakpadInfoStream as u32,
31 location: bp_section.location(),
32 })
33 }
34 }