Skip to content

strip trailing slashes in DEBUGINFOD_URLS#2

Merged
patryk4815 merged 1 commit intopwndbg:mainfrom
Feyorsh:main
Feb 23, 2026
Merged

strip trailing slashes in DEBUGINFOD_URLS#2
patryk4815 merged 1 commit intopwndbg:mainfrom
Feyorsh:main

Conversation

@Feyorsh
Copy link
Contributor

@Feyorsh Feyorsh commented Feb 18, 2026

A trailing slash in a url in DEBUGINFOD_URLS (the default on e.g. Fedora) causes the path to be completely ignored, resulting in a query returning nothing of value.

strip trailing slash in DEBUGINFOD_URLS
bash-5.2$ export DEBUGINFOD_URLS="https://debuginfod.elfutils.org/"
bash-5.2$ export DEBUGINFOD_VERBOSE=1
bash-5.2$ gdb
GNU gdb (GDB) 16.2
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=aarch64-apple-darwin24.6.0 --target=x86_64-apple-darwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) tar rem ...
Remote debugging using ...
Reading ... from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading ... from remote target...
Reading symbols from target:...
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.elfutils.org/>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
info(debuginfod_zig): findDebuginfo 265d92b5d001e68fc815c0716b5d6bd23124fe37
info(debuginfod_zig): fetch https://debuginfod.elfutils.org//buildid/265d92b5d001e68fc815c0716b5d6bd23124fe37/debuginfo
Downloading separate debug info for system-supplied DSO at 0xffffa5ae6000
warning: `~/.cache/debuginfod_client/265d92b5d001e68fc815c0716b5d6bd23124fe37/debuginfo': can't read symbols: file format not recognized.
0x0000ffff97e00ca0 in ?? ()
(gdb)

And the contents of ~/.cache/debuginfod_client/265d92b5d001e68fc815c0716b5d6bd23124fe37/debuginfo is debuginfod (elfutils) 0.194 instead of the expected debuginfo (in this case specifically it should actually return warning(debuginfod_zig): findDebuginfo err: error.FetchStatusNotFound because the elfutils server does not have symbols for this build-id).

A simpler demonstration of the issue with curl:

bash-5.2$ curl https://debuginfod.elfutils.org//buildid/265d92b5d001e68fc815c0716b5d6bd23124fe37/debuginfo
debuginfod (elfutils) 0.194
bash-5.2$ curl https://debuginfod.elfutils.org/buildid/265d92b5d001e68fc815c0716b5d6bd23124fe37/debuginfo
not found

@patryk4815
Copy link
Member

@Feyorsh thank you!

@patryk4815 patryk4815 merged commit d459a53 into pwndbg:main Feb 23, 2026
10 checks passed
@patryk4815
Copy link
Member

@Feyorsh https://debuginfod.pwndbg.re support fetching debuginfo from nix/nixpkgs, but we still didn't add fetching source code

@Feyorsh
Copy link
Contributor Author

Feyorsh commented Feb 23, 2026

Oh nice, is that using nixseparatedebuginfod2?

Also unrelated, do you maybe want to add a snippet for using debuginfod-zig with Nix to the README? (I'm using it in my CTF flake, I'm sure there's probably a better way to do that though lol)

@patryk4815
Copy link
Member

patryk4815 commented Feb 23, 2026

Oh nice, is that using nixseparatedebuginfod2?

didn't know it exists 🙉 We just develop version in golang that downloads debuginfo+nar from cache.nixos.org, converts .nar to .erofs, etc.. 😆 But it not yet open sourced, maybe in few months when I will have more time.

@patryk4815
Copy link
Member

patryk4815 commented Feb 23, 2026

Also unrelated, do you maybe want to add a snippet for using debuginfod-zig with Nix to the README? (I'm using it in my CTF flake, I'm sure there's probably a better way to do that though lol)

Right. Probably something like should work (added to readme):

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
    debuginfod-zig.url = "github:pwndbg/debuginfod-zig";
  };
  outputs =
    inputs@{
      self,
      nixpkgs,
      debuginfod-zig,
      ...
    }:
    let
      forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
      fun_pkgs =
        system:
        import nixpkgs {
          inherit system;
          overlays = [
            debuginfod-zig.overlays.default
            (final: prev: {
              gdb-with-debuginfod = (prev.gdb.override { enableDebuginfod = false; }).overrideAttrs( old: {
                 buildInputs = (old.buildInputs or []) ++ [
                    prev.libdebuginfod-zig-static
                 ];
                 configureFlags = (old.configureFlags or []) ++ [
                    "--with-debuginfod=yes"
                 ];
              });
            })
          ];
        };
    in
    {
      packages = forAllSystems (
        system:
        let
          pkgs = (fun_pkgs system);
        in
        {
          gdb-with-debuginfod = pkgs.gdb-with-debuginfod;
        }
      );
    };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants