From fc81840a8ee8dc3e313273519559504047beec2b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 15 Dec 2025 19:09:37 +0100 Subject: [PATCH] dev-shell: Set mesonBuildType to debugoptimized Previously, we got debug symbols implicitly because we were using `separateDebugInfo = true`, which adds `-ggdb` to the compiler flags. --- doc/manual/source/development/debugging.md | 9 +-------- packaging/dev-shell.nix | 3 +++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/doc/manual/source/development/debugging.md b/doc/manual/source/development/debugging.md index d2450495e..6578632d9 100644 --- a/doc/manual/source/development/debugging.md +++ b/doc/manual/source/development/debugging.md @@ -6,14 +6,7 @@ Additionally, see [Testing Nix](./testing.md) for further instructions on how to ## Building Nix with Debug Symbols -In the development shell, set the `mesonBuildType` environment variable to `debug` before configuring the build: - -```console -[nix-shell]$ export mesonBuildType=debugoptimized -``` - -Then, proceed to build Nix as described in [Building Nix](./building.md). -This will build Nix with debug symbols, which are essential for effective debugging. +In the development shell, `mesonBuildType` is set automatically to `debugoptimized`. This builds Nix with debug symbols, which are essential for effective debugging. It is also possible to build without optimization for faster build: diff --git a/packaging/dev-shell.nix b/packaging/dev-shell.nix index 95cbc4a36..8fb4cb743 100644 --- a/packaging/dev-shell.nix +++ b/packaging/dev-shell.nix @@ -258,10 +258,13 @@ pkgs.nixComponents2.nix-util.overrideAttrs ( # We use this shell with the local checkout, not unpackPhase. src = null; + # Workaround https://sourceware.org/pipermail/gdb-patches/2025-October/221398.html # Remove when gdb fix is rolled out everywhere. separateDebugInfo = false; + mesonBuildType = "debugoptimized"; + env = { # For `make format`, to work without installing pre-commit _NIX_PRE_COMMIT_HOOKS_CONFIG = "${(pkgs.formats.yaml { }).generate "pre-commit-config.yaml"