Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect number of process FDs and /proc/self/limits #90

Merged
merged 6 commits into from
Nov 6, 2023
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
11 changes: 11 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -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",
# ]
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 12 additions & 1 deletion src/linux/minidump_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<MDRawHeader>::alloc(buffer)?;

Expand Down Expand Up @@ -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))?;
Expand Down
3 changes: 3 additions & 0 deletions tests/linux_minidump_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down