gdb: 8.1.1 -> 8.2 (#50444)

This commit is contained in:
Orivej Desh 2018-11-16 07:31:05 +00:00 committed by Orivej Desh (NixOS)
parent d690ccee63
commit 471f1be718
2 changed files with 24 additions and 83 deletions

View File

@ -1,81 +1,13 @@
Look up .build-id files relative to the directories in the Initialize debug-file-directory from NIX_DEBUG_INFO_DIRS, a colon-separated list
colon-separated environment variable NIX_DEBUG_INFO_DIRS, in addition of directories with separate debugging information files.
to the existing debug-file-directory setting.
diff -ru --exclude '*gcore' --exclude '*pdtrace' gdb-8.0-orig/gdb/build-id.c gdb-8.0/gdb/build-id.c --- a/gdb/main.c
--- gdb-8.0-orig/gdb/build-id.c 2017-06-04 17:51:26.000000000 +0200 +++ b/gdb/main.c
+++ gdb-8.0/gdb/build-id.c 2017-07-28 13:18:10.797375927 +0200 @@ -551,3 +551,6 @@ captured_main_1 (struct captured_main_args *context)
@@ -67,8 +67,8 @@
/* See build-id.h. */ - debug_file_directory = relocate_gdb_directory (DEBUGDIR,
+ debug_file_directory = getenv("NIX_DEBUG_INFO_DIRS");
-gdb_bfd_ref_ptr
-build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
+static gdb_bfd_ref_ptr
+build_id_to_debug_bfd_in (const char *directories, size_t build_id_len, const bfd_byte *build_id)
{
char *link, *debugdir;
VEC (char_ptr) *debugdir_vec;
@@ -78,7 +78,7 @@
int alloc_len;
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
- alloc_len = (strlen (debug_file_directory)
+ alloc_len = (strlen (directories)
+ (sizeof "/.build-id/" - 1) + 1
+ 2 * build_id_len + (sizeof ".debug" - 1) + 1);
link = (char *) alloca (alloc_len);
@@ -86,7 +86,7 @@
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
- debugdir_vec = dirnames_to_char_ptr_vec (debug_file_directory);
+ debugdir_vec = dirnames_to_char_ptr_vec (directories);
back_to = make_cleanup_free_char_ptr_vec (debugdir_vec);
for (ix = 0; VEC_iterate (char_ptr, debugdir_vec, ix, debugdir); ++ix)
@@ -137,6 +137,30 @@
return abfd;
}
+gdb_bfd_ref_ptr
+build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
+{
+ gdb_bfd_ref_ptr abfd = build_id_to_debug_bfd_in(debug_file_directory, build_id_len, build_id);
+ +
+ if (abfd != NULL) + if (debug_file_directory == NULL)
+ return abfd; + debug_file_directory = relocate_gdb_directory (DEBUGDIR,
+ DEBUGDIR_RELOCATABLE);
+ static int init = 0;
+ static char *env_var;
+ if (!init)
+ {
+ env_var = getenv("NIX_DEBUG_INFO_DIRS");
+ init = 1;
+ }
+
+ if (env_var)
+ {
+ abfd = build_id_to_debug_bfd_in(env_var, build_id_len, build_id);
+ }
+
+ return abfd;
+}
+
/* See build-id.h. */
char *
diff -ru --exclude '*gcore' --exclude '*pdtrace' gdb-8.0-orig/gdb/symfile.c gdb-8.0/gdb/symfile.c
--- gdb-8.0-orig/gdb/symfile.c 2017-06-04 17:51:27.000000000 +0200
+++ gdb-8.0/gdb/symfile.c 2017-07-28 12:54:05.401586174 +0200
@@ -1415,8 +1415,8 @@
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file,
- _("The directory where separate debug "
- "symbols are searched for is \"%s\".\n"),
+ _("The directories where separate debug "
+ "symbols are searched for are \"%s\".\n"),
value);
}

View File

@ -1,7 +1,7 @@
{ stdenv { stdenv
# Build time # Build time
, fetchurl, pkgconfig, perl, texinfo, setupDebugInfoDirs , fetchurl, fetchpatch, pkgconfig, perl, texinfo, setupDebugInfoDirs
# Run time # Run time
, ncurses, readline, gmp, mpfr, expat, zlib, dejagnu , ncurses, readline, gmp, mpfr, expat, zlib, dejagnu
@ -13,7 +13,7 @@
let let
basename = "gdb-${version}"; basename = "gdb-${version}";
version = "8.1.1"; version = "8.2";
in in
assert pythonSupport -> python != null; assert pythonSupport -> python != null;
@ -26,11 +26,20 @@ stdenv.mkDerivation rec {
src = fetchurl { src = fetchurl {
url = "mirror://gnu/gdb/${basename}.tar.xz"; url = "mirror://gnu/gdb/${basename}.tar.xz";
sha256 = "0g6hv9xk12aa58w77fydaldqr9a6b0a6bnwsq87jfc6lkcbc7p4p"; sha256 = "0fbw6j4z7kmvywwgavn7w3knp860i5i9qnjffc5p52bwkji43963";
}; };
patches = [ ./debug-info-from-env.patch ] patches = [
++ stdenv.lib.optional stdenv.isDarwin ./darwin-target-match.patch; ./debug-info-from-env.patch
] ++ stdenv.lib.optionals stdenv.isDarwin [
./darwin-target-match.patch
(fetchpatch {
name = "gdb-aarch64-linux-tdep.patch";
url = "https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=patch;h=0c0a40e0abb9f1a584330a1911ad06b3686e5361";
excludes = [ "gdb/ChangeLog" ];
sha256 = "16zjw99npyapj68sw52xzmbw671ajm9xv7g5jxfmp94if5y91mnj";
})
];
nativeBuildInputs = [ pkgconfig texinfo perl setupDebugInfoDirs ]; nativeBuildInputs = [ pkgconfig texinfo perl setupDebugInfoDirs ];