summaryrefslogtreecommitdiffstats
path: root/debian/patches/vendor/u-hurd-backtrace.patch
blob: b4af54f872ce599a32fa5f11dd4eb4c0d2033bd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sat, 7 Oct 2023 01:45:09 +0200
Subject: u-hurd-backtrace

Forwarded: https://github.com/rust-lang/backtrace-rs/pull/567

Subject: Add GNU/Hurd support (rust-lang/backtrace-rs#567)
---
 vendor/backtrace/src/symbolize/gimli.rs              |  2 ++
 vendor/backtrace/src/symbolize/gimli/elf.rs          |  2 +-
 .../src/symbolize/gimli/libs_dl_iterate_phdr.rs      | 20 ++++++++++++--------
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/vendor/backtrace/src/symbolize/gimli.rs b/vendor/backtrace/src/symbolize/gimli.rs
index 7f1c6a5..6a9402c 100644
--- a/vendor/backtrace/src/symbolize/gimli.rs
+++ b/vendor/backtrace/src/symbolize/gimli.rs
@@ -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"),
diff --git a/vendor/backtrace/src/symbolize/gimli/elf.rs b/vendor/backtrace/src/symbolize/gimli/elf.rs
index b0eec07..906a300 100644
--- a/vendor/backtrace/src/symbolize/gimli/elf.rs
+++ b/vendor/backtrace/src/symbolize/gimli/elf.rs
@@ -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);
 
diff --git a/vendor/backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs b/vendor/backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs
index 9f0304c..518512f 100644
--- a/vendor/backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs
+++ b/vendor/backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs
@@ -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()