Skip to content

Commit

Permalink
Revert "Use a superpub field in MapsEntry"
Browse files Browse the repository at this point in the history
This reverts commit 06ccd70.
  • Loading branch information
workingjubilee committed Jul 7, 2023
1 parent 06ccd70 commit 6c7e3ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/symbolize/gimli/libs_dl_iterate_phdr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ pub(super) fn native_libraries() -> Vec<Library> {
fn infer_current_exe(base_addr: usize) -> OsString {
if let Ok(entries) = super::parse_running_mmaps::parse_maps() {
let opt_path = entries
.into_iter()
.find(|e| e.ip_matches(base_addr) && !e.pathname.is_empty())
.map(|e| e.pathname);
.iter()
.find(|e| e.ip_matches(base_addr) && e.pathname().len() > 0)
.map(|e| e.pathname())
.cloned();
if let Some(path) = opt_path {
return path;
}
Expand Down
7 changes: 6 additions & 1 deletion src/symbolize/gimli/parse_running_mmaps_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub(super) struct MapsEntry {
/// in general the pathname may be ambiguous. (I.e. you cannot tell if the
/// denoted filename actually ended with the text "(deleted)", or if that
/// was added by the maps rendering.
pub(super) pathname: OsString,
pathname: OsString,
}

pub(super) fn parse_maps() -> Result<Vec<MapsEntry>, &'static str> {
Expand All @@ -70,6 +70,11 @@ pub(super) fn parse_maps() -> Result<Vec<MapsEntry>, &'static str> {
}

impl MapsEntry {
#[inline]
pub(super) fn pathname(&self) -> &OsString {
&self.pathname
}

#[inline]
pub(super) fn ip_matches(&self, ip: usize) -> bool {
self.address.0 <= ip && ip < self.address.1
Expand Down

0 comments on commit 6c7e3ac

Please sign in to comment.