diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..cc393889 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,11 @@ +# If you have a global config to use LLD on your machine, you might need to enable +# this config to produce binaries that pass tests +# [target.'cfg(all(target_os = "linux", target_arch = "x86_64"))'] +# rustflags = [ +# "-C", +# "link-arg=-fuse-ld=lld", +# # LLD by default uses xxhash for build ids now, which breaks tests that assume +# # GUIDS or longer +# "-C", +# "link-arg=-Wl,--build-id=sha1", +# ] diff --git a/Cargo.toml b/Cargo.toml index cbe887c4..889d8d9a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ byteorder = "1.4" cfg-if = "1.0" crash-context = "0.6" memoffset = "0.9" -minidump-common = "0.19" +minidump-common = "0.19.1" scroll = "0.11" tempfile = "3.8" thiserror = "1.0" diff --git a/src/linux/minidump_writer.rs b/src/linux/minidump_writer.rs index 7be6cef9..da395b53 100644 --- a/src/linux/minidump_writer.rs +++ b/src/linux/minidump_writer.rs @@ -189,7 +189,7 @@ impl MinidumpWriter { ) -> Result<()> { // A minidump file contains a number of tagged streams. This is the number // of streams which we write. - let num_writers = 16u32; + let num_writers = 17u32; let mut header_section = MemoryWriter::::alloc(buffer)?; @@ -323,6 +323,17 @@ impl MinidumpWriter { // Write section to file dir_section.write_to_file(buffer, Some(dirent))?; + let dirent = match self.write_file(buffer, &format!("/proc/{}/limits", self.blamed_thread)) + { + Ok(location) => MDRawDirectory { + stream_type: MDStreamType::MozLinuxLimits as u32, + location, + }, + Err(_) => Default::default(), + }; + // Write section to file + dir_section.write_to_file(buffer, Some(dirent))?; + let dirent = thread_names_stream::write(buffer, dumper)?; // Write section to file dir_section.write_to_file(buffer, Some(dirent))?; diff --git a/tests/linux_minidump_writer.rs b/tests/linux_minidump_writer.rs index 8552003e..d9864bae 100644 --- a/tests/linux_minidump_writer.rs +++ b/tests/linux_minidump_writer.rs @@ -224,6 +224,9 @@ contextual_tests! { let _ = dump .get_raw_stream(LinuxDsoDebug as u32) .expect("Couldn't find LinuxDsoDebug"); + let _ = dump + .get_raw_stream(MozLinuxLimits as u32) + .expect("Couldn't find MozLinuxLimits"); } fn test_write_with_additional_memory(context: Context) {