u-hurd-backtrace
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Fri, 6 Oct 2023 23:45:09 +0000 (01:45 +0200)
committerFabian Grünbichler <debian@fabian.gruenbichler.email>
Mon, 24 Jun 2024 06:25:58 +0000 (08:25 +0200)
Forwarded: https://github.com/rust-lang/backtrace-rs/pull/567

Subject: Add GNU/Hurd support (rust-lang/backtrace-rs#567)

Gbp-Pq: Topic vendor
Gbp-Pq: Name u-hurd-backtrace.patch

vendor/backtrace/src/symbolize/gimli.rs
vendor/backtrace/src/symbolize/gimli/elf.rs
vendor/backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs

index 7f1c6a52853221d6c995f1792cd7d3a216dae60a..6a9402c663b7946f595369fe38666f8fefec61a2 100644 (file)
@@ -35,6 +35,7 @@ cfg_if::cfg_if! {
         target_os = "freebsd",
         target_os = "fuchsia",
         target_os = "haiku",
+        target_os = "hurd",
         target_os = "ios",
         target_os = "linux",
         target_os = "macos",
@@ -218,6 +219,7 @@ cfg_if::cfg_if! {
             target_os = "linux",
             target_os = "fuchsia",
             target_os = "freebsd",
+            target_os = "hurd",
             target_os = "openbsd",
             target_os = "netbsd",
             all(target_os = "android", feature = "dl_iterate_phdr"),
index b0eec076248be768f61f6bf8d5db8c959c1a71c8..906a3005489eeefd96e3a3787445602b0c927135 100644 (file)
@@ -308,7 +308,7 @@ const DEBUG_PATH: &[u8] = b"/usr/lib/debug";
 
 fn debug_path_exists() -> bool {
     cfg_if::cfg_if! {
-        if #[cfg(any(target_os = "freebsd", target_os = "linux"))] {
+        if #[cfg(any(target_os = "freebsd", target_os = "hurd", target_os = "linux"))] {
             use core::sync::atomic::{AtomicU8, Ordering};
             static DEBUG_PATH_EXISTS: AtomicU8 = AtomicU8::new(0);
 
index 9f0304ce8f0358064010d6f1190b967a1afd5224..518512fff82feaa7569650e22deb62e123ef14b2 100644 (file)
@@ -18,14 +18,18 @@ 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
-            .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;
+    cfg_if::cfg_if! {
+        if #[cfg(not(target_os = "hurd"))] {
+                if let Ok(entries) = super::parse_running_mmaps::parse_maps() {
+                let opt_path = entries
+                    .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;
+                }
+            }
         }
     }
     env::current_exe().map(|e| e.into()).unwrap_or_default()