at 18.03-beta 2.6 kB view raw
1Look up .build-id files relative to the directories in the 2colon-separated environment variable NIX_DEBUG_INFO_DIRS, in addition 3to the existing debug-file-directory setting. 4 5diff -ru --exclude '*gcore' --exclude '*pdtrace' gdb-8.0-orig/gdb/build-id.c gdb-8.0/gdb/build-id.c 6--- gdb-8.0-orig/gdb/build-id.c 2017-06-04 17:51:26.000000000 +0200 7+++ gdb-8.0/gdb/build-id.c 2017-07-28 13:18:10.797375927 +0200 8@@ -67,8 +67,8 @@ 9 10 /* See build-id.h. */ 11 12-gdb_bfd_ref_ptr 13-build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) 14+static gdb_bfd_ref_ptr 15+build_id_to_debug_bfd_in (const char *directories, size_t build_id_len, const bfd_byte *build_id) 16 { 17 char *link, *debugdir; 18 VEC (char_ptr) *debugdir_vec; 19@@ -78,7 +78,7 @@ 20 int alloc_len; 21 22 /* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */ 23- alloc_len = (strlen (debug_file_directory) 24+ alloc_len = (strlen (directories) 25 + (sizeof "/.build-id/" - 1) + 1 26 + 2 * build_id_len + (sizeof ".debug" - 1) + 1); 27 link = (char *) alloca (alloc_len); 28@@ -86,7 +86,7 @@ 29 /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will 30 cause "/.build-id/..." lookups. */ 31 32- debugdir_vec = dirnames_to_char_ptr_vec (debug_file_directory); 33+ debugdir_vec = dirnames_to_char_ptr_vec (directories); 34 back_to = make_cleanup_free_char_ptr_vec (debugdir_vec); 35 36 for (ix = 0; VEC_iterate (char_ptr, debugdir_vec, ix, debugdir); ++ix) 37@@ -137,6 +137,30 @@ 38 return abfd; 39 } 40 41+gdb_bfd_ref_ptr 42+build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) 43+{ 44+ gdb_bfd_ref_ptr abfd = build_id_to_debug_bfd_in(debug_file_directory, build_id_len, build_id); 45+ 46+ if (abfd != NULL) 47+ return abfd; 48+ 49+ static int init = 0; 50+ static char *env_var; 51+ if (!init) 52+ { 53+ env_var = getenv("NIX_DEBUG_INFO_DIRS"); 54+ init = 1; 55+ } 56+ 57+ if (env_var) 58+ { 59+ abfd = build_id_to_debug_bfd_in(env_var, build_id_len, build_id); 60+ } 61+ 62+ return abfd; 63+} 64+ 65 /* See build-id.h. */ 66 67 char * 68diff -ru --exclude '*gcore' --exclude '*pdtrace' gdb-8.0-orig/gdb/symfile.c gdb-8.0/gdb/symfile.c 69--- gdb-8.0-orig/gdb/symfile.c 2017-06-04 17:51:27.000000000 +0200 70+++ gdb-8.0/gdb/symfile.c 2017-07-28 12:54:05.401586174 +0200 71@@ -1415,8 +1415,8 @@ 72 struct cmd_list_element *c, const char *value) 73 { 74 fprintf_filtered (file, 75- _("The directory where separate debug " 76- "symbols are searched for is \"%s\".\n"), 77+ _("The directories where separate debug " 78+ "symbols are searched for are \"%s\".\n"), 79 value); 80 } 81