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

Send SIGCONT unconditionally #110

Merged
merged 4 commits into from
Mar 21, 2024
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @Jake-Shadle
* @Jake-Shadle @gabrielesvelto
14 changes: 3 additions & 11 deletions src/linux/maps_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,7 @@ impl MappingInfo {

#[inline]
fn so_version(&self) -> Option<SoVersion> {
let Some(name) = self.name.as_deref() else {
return None;
};

SoVersion::parse(name)
SoVersion::parse(self.name.as_deref()?)
}

pub fn get_mapping_effective_path_name_and_version(
Expand Down Expand Up @@ -422,16 +418,12 @@ pub struct SoVersion {
impl SoVersion {
/// Attempts to retrieve the .so version of the elf path via its filename
fn parse(so_path: &OsStr) -> Option<Self> {
let Some(filename) = std::path::Path::new(so_path).file_name() else {
return None;
};
let filename = std::path::Path::new(so_path).file_name()?;

// Avoid an allocation unless the string contains non-utf8
let filename = filename.to_string_lossy();

let Some((_, version)) = filename.split_once(".so.") else {
return None;
};
let (_, version) = filename.split_once(".so.")?;

let mut sov = Self {
major: 0,
Expand Down
8 changes: 1 addition & 7 deletions src/linux/ptrace_dumper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub struct Thread {
#[derive(Debug)]
pub struct PtraceDumper {
pub pid: Pid,
process_stopped: bool,
threads_suspended: bool,
pub threads: Vec<Thread>,
pub auxv: HashMap<AuxvType, AuxvType>,
Expand Down Expand Up @@ -99,7 +98,6 @@ impl PtraceDumper {
pub fn new(pid: Pid, stop_timeout: Duration) -> Result<Self, InitError> {
let mut dumper = PtraceDumper {
pid,
process_stopped: false,
threads_suspended: false,
threads: Vec::new(),
auxv: HashMap::new(),
Expand Down Expand Up @@ -255,7 +253,6 @@ impl PtraceDumper {

loop {
if let Ok(ProcState::Stopped) = Stat::from_file(&proc_file)?.state() {
self.process_stopped = true;
return Ok(());
}

Expand All @@ -270,10 +267,7 @@ impl PtraceDumper {
///
/// Unlike `stop_process`, this function does not wait for the process to continue.
fn continue_process(&mut self) -> Result<(), ContinueProcessError> {
if self.process_stopped {
signal::kill(nix::unistd::Pid::from_raw(self.pid), Some(signal::SIGCONT))?;
}
self.process_stopped = false;
signal::kill(nix::unistd::Pid::from_raw(self.pid), Some(signal::SIGCONT))?;
Ok(())
}

Expand Down
Loading