+10
-17
pkgs/development/tools/misc/gdb/debug-info-from-env.patch
+10
-17
pkgs/development/tools/misc/gdb/debug-info-from-env.patch
···
1
-
diff -ur a/gdb/main.c b/gdb/main.c
2
-
--- a/gdb/main.c 2020-02-08 13:50:14.000000000 +0100
3
-
+++ b/gdb/main.c 2020-02-24 10:02:07.731806739 +0100
4
-
@@ -567,9 +567,17 @@
5
-
gdb_sysroot = xstrdup (TARGET_SYSROOT_PREFIX);
6
-
}
1
+
--- a/gdb/main.c
2
+
+++ b/gdb/main.c
3
+
@@ -708,8 +708,12 @@ captured_main_1 (struct captured_main_args *context)
4
+
if (gdb_sysroot.empty ())
5
+
gdb_sysroot = TARGET_SYSROOT_PREFIX;
7
6
8
7
- debug_file_directory
9
-
- = xstrdup (relocate_gdb_directory (DEBUGDIR,
10
-
- DEBUGDIR_RELOCATABLE).c_str ());
11
-
+ debug_file_directory = getenv ("NIX_DEBUG_INFO_DIRS");
12
-
+ if (debug_file_directory != NULL)
13
-
+ // This might be updated later using
14
-
+ // $ set debug-file-directory /to/some/path
15
-
+ // which will use xfree. We must then have a xmallocated
16
-
+ // copy of the string that can be xfeed later.
17
-
+ debug_file_directory = xstrdup (debug_file_directory);
8
+
- = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE);
9
+
+ const char * nix_debug = getenv ("NIX_DEBUG_INFO_DIRS");
10
+
+ if (nix_debug != NULL)
11
+
+ debug_file_directory = nix_debug;
18
12
+ else
19
13
+ debug_file_directory
20
-
+ = xstrdup (relocate_gdb_directory (DEBUGDIR,
21
-
+ DEBUGDIR_RELOCATABLE).c_str ());
14
+
+ = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE);
22
15
23
16
gdb_datadir = relocate_gdb_directory (GDB_DATADIR,
24
17
GDB_DATADIR_RELOCATABLE);
+19
-15
pkgs/development/tools/misc/gdb/default.nix
+19
-15
pkgs/development/tools/misc/gdb/default.nix
···
1
1
{ lib, stdenv, targetPackages
2
2
3
3
# Build time
4
-
, fetchurl, fetchpatch, pkg-config, perl, texinfo, setupDebugInfoDirs, buildPackages
4
+
, fetchurl, pkg-config, perl, texinfo, setupDebugInfoDirs, buildPackages
5
5
6
6
# Run time
7
7
, ncurses, readline, gmp, mpfr, expat, libipt, zlib, dejagnu, sourceHighlight
···
15
15
# targetPackages so we get the right libc when cross-compiling and using buildPackages.gdb
16
16
targetPackages.stdenv.cc.cc.lib
17
17
]
18
+
, writeScript
18
19
}:
19
20
20
21
let
···
27
28
28
29
stdenv.mkDerivation rec {
29
30
pname = targetPrefix + basename;
30
-
version = "11.2";
31
+
version = "12.1";
31
32
32
33
src = fetchurl {
33
34
url = "mirror://gnu/gdb/${basename}-${version}.tar.xz";
34
-
hash = "sha256-FJfDanGIG4ZxqahKDuQPqreIyjDXuhnYRjw8x4cVLjI=";
35
+
hash = "sha256-DheTv48rVNU/Rt6oTM/URvSPgbKXsoxPf8AXuBjWn+0=";
35
36
};
36
37
37
38
postPatch = if stdenv.isDarwin then ''
···
43
44
44
45
patches = [
45
46
./debug-info-from-env.patch
46
-
47
-
# Pull upstream fix for gcc-12. Will be included in gdb-12.
48
-
(fetchpatch {
49
-
name = "gcc-12.patch";
50
-
url = "https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=e97436b1b789dcdb6ffb502263f4c86f8bc22996";
51
-
sha256 = "1mpgw6s9qgnwhwyg3hagc6vhqhvia0l1s8nr22bcahwqxi3wvzcw";
52
-
})
53
47
] ++ lib.optionals stdenv.isDarwin [
54
48
./darwin-target-match.patch
55
-
] ++ lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
56
-
name = "musl-fix-pagesize-page_size.patch";
57
-
url = "https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=fd0975b96b16d96010dce439af9620d3dfb65426";
58
-
hash = "sha256-M3U7uIIFJnYu0g8/sMLJPhm02q7cGOi6pLjgsUUjeKI=";
59
-
});
49
+
];
60
50
61
51
nativeBuildInputs = [ pkg-config texinfo perl setupDebugInfoDirs ];
62
52
···
114
104
115
105
# TODO: Investigate & fix the test failures.
116
106
doCheck = false;
107
+
108
+
passthru = {
109
+
updateScript = writeScript "update-gdb" ''
110
+
#!/usr/bin/env nix-shell
111
+
#!nix-shell -i bash -p curl pcre common-updater-scripts
112
+
113
+
set -eu -o pipefail
114
+
115
+
# Expect the text in format of '<h3>GDB version 12.1</h3>'
116
+
new_version="$(curl -s https://www.sourceware.org/gdb/ |
117
+
pcregrep -o1 '<h3>GDB version ([0-9.]+)</h3>')"
118
+
update-source-version ${pname} "$new_version"
119
+
'';
120
+
};
117
121
118
122
meta = with lib; {
119
123
description = "The GNU Project debugger";