Skip to content

Commit 11e0a4b

Browse files
authored
Add GNU/Hurd support (#567)
1 parent 9532971 commit 11e0a4b

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/symbolize/gimli.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ cfg_if::cfg_if! {
3535
target_os = "freebsd",
3636
target_os = "fuchsia",
3737
target_os = "haiku",
38+
target_os = "hurd",
3839
target_os = "ios",
3940
target_os = "linux",
4041
target_os = "macos",
@@ -231,6 +232,7 @@ cfg_if::cfg_if! {
231232
target_os = "linux",
232233
target_os = "fuchsia",
233234
target_os = "freebsd",
235+
target_os = "hurd",
234236
target_os = "openbsd",
235237
target_os = "netbsd",
236238
all(target_os = "android", feature = "dl_iterate_phdr"),

src/symbolize/gimli/elf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ const DEBUG_PATH: &[u8] = b"/usr/lib/debug";
308308

309309
fn debug_path_exists() -> bool {
310310
cfg_if::cfg_if! {
311-
if #[cfg(any(target_os = "freebsd", target_os = "linux"))] {
311+
if #[cfg(any(target_os = "freebsd", target_os = "hurd", target_os = "linux"))] {
312312
use core::sync::atomic::{AtomicU8, Ordering};
313313
static DEBUG_PATH_EXISTS: AtomicU8 = AtomicU8::new(0);
314314

src/symbolize/gimli/libs_dl_iterate_phdr.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@ pub(super) fn native_libraries() -> Vec<Library> {
1818
}
1919

2020
fn infer_current_exe(base_addr: usize) -> OsString {
21-
if let Ok(entries) = super::parse_running_mmaps::parse_maps() {
22-
let opt_path = entries
23-
.iter()
24-
.find(|e| e.ip_matches(base_addr) && e.pathname().len() > 0)
25-
.map(|e| e.pathname())
26-
.cloned();
27-
if let Some(path) = opt_path {
28-
return path;
21+
cfg_if::cfg_if! {
22+
if #[cfg(not(target_os = "hurd"))] {
23+
if let Ok(entries) = super::parse_running_mmaps::parse_maps() {
24+
let opt_path = entries
25+
.iter()
26+
.find(|e| e.ip_matches(base_addr) && e.pathname().len() > 0)
27+
.map(|e| e.pathname())
28+
.cloned();
29+
if let Some(path) = opt_path {
30+
return path;
31+
}
32+
}
2933
}
3034
}
3135
env::current_exe().map(|e| e.into()).unwrap_or_default()

0 commit comments

Comments
 (0)