Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gdb: Fix abort w/NIX_DEBUG_INFO_DIRS patch #80929

Merged
merged 1 commit into from Feb 25, 2020

Conversation

tollb
Copy link
Contributor

@tollb tollb commented Feb 24, 2020

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.

NOTE: As a workaround, unset NIX_DEBUG_INFO_DIRS before running gdb.

This patch was tested on gdb 8.3.1. If merged, it can hopefully be included in 20.03. The gdb 9.1 upgrade in #79711 also appears to have the same issue. @lsix

Motivation for this change
Things done
  • [x ] Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • [x ] NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@lsix
Copy link
Member

lsix commented Feb 24, 2020

Thanks for bringing this up. I’ll go update the 9.1 upgrade ASAP.

Copy link
Member

@lsix lsix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orivej comment is legitimate.

Other than that, this is all fine for me.

Thanks.

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.
@tollb tollb force-pushed the fix/gdb-debug-file-directory branch from d89c7ad to ba10646 Compare February 24, 2020 12:24
@lsix
Copy link
Member

lsix commented Feb 24, 2020

Once merged, I’ll rebase the 9.1 upgrade on top of it since it might conflict.

@tollb
Copy link
Contributor Author

tollb commented Feb 24, 2020

Once merged, I’ll rebase the 9.1 upgrade on top of it since it might conflict.

Thanks. I really appreciate your help with this.

@orivej-nixos orivej-nixos merged commit ad337f7 into NixOS:staging Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants