summary refs log tree commit diff
path: root/pkgs/development/tools/misc/gdb
diff options
context:
space:
mode:
authortollb <4109762+tollb@users.noreply.github.com>2020-02-24 20:18:09 -0500
committerGitHub <noreply@github.com>2020-02-25 01:18:09 +0000
commitad337f7f3ac02616132b39a07822d1254bd36ba3 (patch)
treea733d99412b7949f30cd6b212e30333104d90c7c /pkgs/development/tools/misc/gdb
parent2cb48bb1c6facec6020703a98766147011eabc50 (diff)
downloadnixpkgs-ad337f7f3ac02616132b39a07822d1254bd36ba3.tar
nixpkgs-ad337f7f3ac02616132b39a07822d1254bd36ba3.tar.gz
nixpkgs-ad337f7f3ac02616132b39a07822d1254bd36ba3.tar.bz2
nixpkgs-ad337f7f3ac02616132b39a07822d1254bd36ba3.tar.lz
nixpkgs-ad337f7f3ac02616132b39a07822d1254bd36ba3.tar.xz
nixpkgs-ad337f7f3ac02616132b39a07822d1254bd36ba3.tar.zst
nixpkgs-ad337f7f3ac02616132b39a07822d1254bd36ba3.zip
gdb: Fix abort w/NIX_DEBUG_INFO_DIRS patch (#80929)
The current gdb patch to support NIX_DEBUG_INFO_DIRS fails if
the user attempts to change the debug file directory to a
value other than the default. For instance:

(gdb) set debug-file-directory /run/booted-system/sw/lib/debug

results in:

munmap_chunk(): invalid pointer
Aborted (core dumped)

To fix this issue, the debug_file_directory is allocated
with xstrdup so that a subsequent call to xfree will succeed.
Diffstat (limited to 'pkgs/development/tools/misc/gdb')
-rw-r--r--pkgs/development/tools/misc/gdb/debug-info-from-env.patch6
1 files changed, 4 insertions, 2 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 a7eda2c7e17..499b61ba869 100644
--- a/pkgs/development/tools/misc/gdb/debug-info-from-env.patch
+++ b/pkgs/development/tools/misc/gdb/debug-info-from-env.patch
@@ -3,11 +3,13 @@ of directories with separate debugging information files.
 
 --- a/gdb/main.c
 +++ b/gdb/main.c
-@@ -551,3 +551,6 @@ captured_main_1 (struct captured_main_args *context)
+@@ -556,3 +556,8 @@ captured_main_1 (struct captured_main_args *context)
  
 -  debug_file_directory = relocate_gdb_directory (DEBUGDIR,
 +  debug_file_directory = getenv("NIX_DEBUG_INFO_DIRS");
 +
-+  if (debug_file_directory == NULL)
++  if (debug_file_directory != NULL)
++    debug_file_directory = xstrdup(debug_file_directory);
++  else
 +    debug_file_directory = relocate_gdb_directory (DEBUGDIR,
  						 DEBUGDIR_RELOCATABLE);