Skip to content

Commit e174189

Browse files
Try not parsing the entire map
1 parent cb775f1 commit e174189

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/symbolize/gimli/parse_running_mmaps_unix.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -91,32 +91,32 @@ impl FromStr for MapsEntry {
9191
let mut parts = s
9292
.split_ascii_whitespace();
9393
let range_str = parts.next().ok_or(missing_field)?;
94-
let perms_str = parts.next().ok_or(missing_field)?;
95-
let offset_str = parts.next().ok_or(missing_field)?;
96-
let dev_str = parts.next().ok_or(missing_field)?;
97-
let inode_str = parts.next().ok_or(missing_field)?;
98-
let pathname_str = parts.next().unwrap_or(""); // pathname may be omitted.
94+
// let perms_str = parts.next().ok_or(missing_field)?;
95+
// let offset_str = parts.next().ok_or(missing_field)?;
96+
// let dev_str = parts.next().ok_or(missing_field)?;
97+
// let inode_str = parts.next().ok_or(missing_field)?;
98+
let pathname_str = parts.skip(4).next().unwrap_or(""); // pathname may be omitted.
9999

100100
let hex = |s| usize::from_str_radix(s, 16).map_err(|_| parse_err);
101101
let address = if let Some((start, limit)) = range_str.split_once('-') {
102102
(hex(start)?, hex(limit)?)
103103
} else {
104104
return Err(parse_err);
105105
};
106-
let _perms = if let &[r, w, x, p, ..] = perms_str.as_bytes() {
107-
// If a system in the future adds a 5th field to the permission list,
108-
// there's no reason to assume previous fields were invalidated.
109-
[r, w, x, p]
110-
} else {
111-
return Err(parse_err);
112-
};
113-
let _offset = hex(offset_str)?;
114-
let _dev = if let Some((major, minor)) = dev_str.split_once(':') {
115-
(hex(major)?, hex(minor)?)
116-
} else {
117-
return Err(parse_err);
118-
};
119-
let _inode = hex(inode_str)?;
106+
// let _perms = if let &[r, w, x, p, ..] = perms_str.as_bytes() {
107+
// // If a system in the future adds a 5th field to the permission list,
108+
// // there's no reason to assume previous fields were invalidated.
109+
// [r, w, x, p]
110+
// } else {
111+
// return Err(parse_err);
112+
// };
113+
// let _offset = hex(offset_str)?;
114+
// let _dev = if let Some((major, minor)) = dev_str.split_once(':') {
115+
// (hex(major)?, hex(minor)?)
116+
// } else {
117+
// return Err(parse_err);
118+
// };
119+
// let _inode = hex(inode_str)?;
120120
let pathname = pathname_str.into();
121121

122122
Ok(MapsEntry {

0 commit comments

Comments
 (0)