1 From 884ef7c843be906d62e4240c2a0e885dcd5a5726 Mon Sep 17 00:00:00 2001
2 From: Jan Tojnar <jtojnar@gmail.com>
3 Date: Sat, 24 Dec 2022 20:30:22 +0100
4 Subject: [PATCH 4/4] libbacktrace: Support NIX_DEBUG_INFO_DIRS environment
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 Let’s make debug data lookup work on NixOS just like in gdb.
12 elf.c | 11 +++++++++--
13 1 file changed, 9 insertions(+), 2 deletions(-)
15 diff --git a/elf.c b/elf.c
16 index ccffa95..e86950d 100644
19 @@ -6946,11 +6946,18 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
21 if (buildid_data != NULL)
23 + const char *debug_directories_immutable;
24 + const char *nix_debug = getenv ("NIX_DEBUG_INFO_DIRS");
25 + if (nix_debug != NULL)
26 + debug_directories_immutable = nix_debug;
28 + debug_directories_immutable = SYSTEM_DEBUG_DIR;
31 - char debug_directories[strlen(SYSTEM_DEBUG_DIR) + 1];
32 + char debug_directories[strlen(debug_directories_immutable) + 1];
35 - strcpy(debug_directories, SYSTEM_DEBUG_DIR);
36 + strcpy(debug_directories, debug_directories_immutable);
38 debug_dir = strtok (debug_directories, ":");
39 while (debug_dir != NULL)