summary refs log tree commit diff
path: root/pkgs/development/tools/misc/gdb
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2022-05-02 09:45:04 +0100
committerSergei Trofimovich <slyich@gmail.com>2022-05-04 19:39:45 +0100
commite6491be4e39a7dcd1337ba50cccc00a59c8f44aa (patch)
treead8b7bdc2c40ad77c72f644c875f87097533b01c /pkgs/development/tools/misc/gdb
parenta6902b39739e68ef243306222c5eb652b04ef159 (diff)
downloadnixpkgs-e6491be4e39a7dcd1337ba50cccc00a59c8f44aa.tar
nixpkgs-e6491be4e39a7dcd1337ba50cccc00a59c8f44aa.tar.gz
nixpkgs-e6491be4e39a7dcd1337ba50cccc00a59c8f44aa.tar.bz2
nixpkgs-e6491be4e39a7dcd1337ba50cccc00a59c8f44aa.tar.lz
nixpkgs-e6491be4e39a7dcd1337ba50cccc00a59c8f44aa.tar.xz
nixpkgs-e6491be4e39a7dcd1337ba50cccc00a59c8f44aa.tar.zst
nixpkgs-e6491be4e39a7dcd1337ba50cccc00a59c8f44aa.zip
gdb: 11.2 -> 12.1
Added trivial updater script.
Refreshed nix-specific patch with path to debug symbols.
Dropped upstreamed patches for gcc-12 support and musl support.

Changes: https://www.sourceware.org/gdb/download/ANNOUNCEMENT
Diffstat (limited to 'pkgs/development/tools/misc/gdb')
-rw-r--r--pkgs/development/tools/misc/gdb/debug-info-from-env.patch27
-rw-r--r--pkgs/development/tools/misc/gdb/default.nix34
2 files changed, 29 insertions, 32 deletions
diff --git a/pkgs/development/tools/misc/gdb/debug-info-from-env.patch b/pkgs/development/tools/misc/gdb/debug-info-from-env.patch
index de59bd2d17b..7a3d78da077 100644
--- a/pkgs/development/tools/misc/gdb/debug-info-from-env.patch
+++ b/pkgs/development/tools/misc/gdb/debug-info-from-env.patch
@@ -1,24 +1,17 @@
-diff -ur a/gdb/main.c b/gdb/main.c
---- a/gdb/main.c	2020-02-08 13:50:14.000000000 +0100
-+++ b/gdb/main.c	2020-02-24 10:02:07.731806739 +0100
-@@ -567,9 +567,17 @@
-       gdb_sysroot = xstrdup (TARGET_SYSROOT_PREFIX);
-     }
+--- a/gdb/main.c
++++ b/gdb/main.c
+@@ -708,8 +708,12 @@ captured_main_1 (struct captured_main_args *context)
+   if (gdb_sysroot.empty ())
+     gdb_sysroot = TARGET_SYSROOT_PREFIX;
  
 -  debug_file_directory
--    = xstrdup (relocate_gdb_directory (DEBUGDIR,
--				     DEBUGDIR_RELOCATABLE).c_str ());
-+  debug_file_directory = getenv ("NIX_DEBUG_INFO_DIRS");
-+  if (debug_file_directory != NULL)
-+    // This might be updated later using
-+    // $ set debug-file-directory /to/some/path
-+    // which will use xfree. We must then have a xmallocated
-+    // copy of the string that can be xfeed later.
-+    debug_file_directory = xstrdup (debug_file_directory);
+-    = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE);
++  const char * nix_debug = getenv ("NIX_DEBUG_INFO_DIRS");
++  if (nix_debug != NULL)
++      debug_file_directory = nix_debug;
 +  else
 +    debug_file_directory
-+      = xstrdup (relocate_gdb_directory (DEBUGDIR,
-+                                         DEBUGDIR_RELOCATABLE).c_str ());
++      = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE);
  
    gdb_datadir = relocate_gdb_directory (GDB_DATADIR,
  					GDB_DATADIR_RELOCATABLE);
diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix
index f21808b1bf7..bc760f79be9 100644
--- a/pkgs/development/tools/misc/gdb/default.nix
+++ b/pkgs/development/tools/misc/gdb/default.nix
@@ -1,7 +1,7 @@
 { lib, stdenv, targetPackages
 
 # Build time
-, fetchurl, fetchpatch, pkg-config, perl, texinfo, setupDebugInfoDirs, buildPackages
+, fetchurl, pkg-config, perl, texinfo, setupDebugInfoDirs, buildPackages
 
 # Run time
 , ncurses, readline, gmp, mpfr, expat, libipt, zlib, dejagnu, sourceHighlight
@@ -15,6 +15,7 @@
    # targetPackages so we get the right libc when cross-compiling and using buildPackages.gdb
    targetPackages.stdenv.cc.cc.lib
   ]
+, writeScript
 }:
 
 let
@@ -27,11 +28,11 @@ assert pythonSupport -> python3 != null;
 
 stdenv.mkDerivation rec {
   pname = targetPrefix + basename;
-  version = "11.2";
+  version = "12.1";
 
   src = fetchurl {
     url = "mirror://gnu/gdb/${basename}-${version}.tar.xz";
-    hash = "sha256-FJfDanGIG4ZxqahKDuQPqreIyjDXuhnYRjw8x4cVLjI=";
+    hash = "sha256-DheTv48rVNU/Rt6oTM/URvSPgbKXsoxPf8AXuBjWn+0=";
   };
 
   postPatch = if stdenv.isDarwin then ''
@@ -43,20 +44,9 @@ stdenv.mkDerivation rec {
 
   patches = [
     ./debug-info-from-env.patch
-
-    # Pull upstream fix for gcc-12. Will be included in gdb-12.
-    (fetchpatch {
-      name = "gcc-12.patch";
-      url = "https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=e97436b1b789dcdb6ffb502263f4c86f8bc22996";
-      sha256 = "1mpgw6s9qgnwhwyg3hagc6vhqhvia0l1s8nr22bcahwqxi3wvzcw";
-    })
   ] ++ lib.optionals stdenv.isDarwin [
     ./darwin-target-match.patch
-  ] ++ lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
-    name = "musl-fix-pagesize-page_size.patch";
-    url = "https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=fd0975b96b16d96010dce439af9620d3dfb65426";
-    hash = "sha256-M3U7uIIFJnYu0g8/sMLJPhm02q7cGOi6pLjgsUUjeKI=";
-  });
+  ];
 
   nativeBuildInputs = [ pkg-config texinfo perl setupDebugInfoDirs ];
 
@@ -115,6 +105,20 @@ stdenv.mkDerivation rec {
   # TODO: Investigate & fix the test failures.
   doCheck = false;
 
+  passthru = {
+    updateScript = writeScript "update-gdb" ''
+      #!/usr/bin/env nix-shell
+      #!nix-shell -i bash -p curl pcre common-updater-scripts
+
+      set -eu -o pipefail
+
+      # Expect the text in format of '<h3>GDB version 12.1</h3>'
+      new_version="$(curl -s https://www.sourceware.org/gdb/ |
+          pcregrep -o1 '<h3>GDB version ([0-9.]+)</h3>')"
+      update-source-version ${pname} "$new_version"
+    '';
+  };
+
   meta = with lib; {
     description = "The GNU Project debugger";