https://sourceware.org/bugzilla/show_bug.cgi?id=34309

            Bug ID: 34309
           Summary: debuginfod and relative source paths
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: debuginfod
          Assignee: unassigned at sourceware dot org
          Reporter: glance at ac2 dot se
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

We're using -fdebug-prefix-map= to produce reproducible builds, independent of
absolute path to the source directory.

In our Makefiles we use some make magic to calculate current directory and
compile with the following in CFLAGS:
-fdebug-prefix-map=$(current_dir)=.

This works great with local gdb, but I'm looking at using debuginfod to better
support remote debugging.

I get debug symbols just fine, but I won't get source code from debuginfod.

This means comp_dir             (line_strp) "."

When I start gdb on that binary with appropriate
DEBUGINFOD_URLS=http://127.0.0.1:8002/ (local debuginfod tunneled over ssh to
remote machine) and DEBUGINFOD_VERBOSE=1 setup I get:

debuginfod_find_source 6f248cd46b3ca94cc00cbba3bfa9ec38d88e77f6 ././source.c

Currently the debuginfod-client code filters out that request, but i I patch
that check:
> --- ./debuginfod/debuginfod-client.c.orig     2026-06-15 14:48:46.676508854 
> +0200
> +++ ./debuginfod/debuginfod-client.c  2026-06-15 16:14:35.096394214 +0200
> @@ -1900,8 +1900,8 @@
>    if (filename != NULL)
>      {
>        if (vfd >= 0)
> -     dprintf (vfd, "checking filename\n");
> -      if (filename[0] != '/') // must start with /
> +     dprintf (vfd, "checking filename: %s\n", filename);
> +      if (filename[0] != '/' && filename[0] != '.') // must start with / or .
>       {
>         rc = -EINVAL;
>         goto out;

I get:
http://127.0.0.1:8002/buildid/6f248cd46b3ca94cc00cbba3bfa9ec38d88e77f6/source//./source.c

Which debuginfod happily accepts and services.

I'd like to improve the story for debugging reproducible builds, so this check
that filenames must start with / is kinda in the way.

Are there any plans / work happening in this area, and would something like
this be acceptable?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to