Re: [RFC PATCH] Support debuginfo and source file fetching via debuginfo server

Christian Biesinger via gdb-patches
2019-09-22T03:53:49Z

On Tue, Aug 20, 2019 at 4:28 PM Aaron Merey <amerey@redhat.com> wrote:
> Debuginfo server is a lightweight web service that indexes debuginfo
> and source files by build-id and serves them over HTTP. Debuginfo server
> is able to index unpackaged, locally-built software in addition to RPM
> files. Debuginfo server is packaged with a shared library, libdbgserver,
> that provides a small set of client functions for fetching files from
> debuginfo server. This patch adds debuginfo server support to GDB. In
> case a source file or separate debuginfo file cannot be found locally,
> GDB can use libdbgserver to query debuginfo server for the file in
> question, if enabled to do so.
>
[...]
> @@ -1296,6 +1299,30 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
> symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (),
> symfile_flags, objfile);
> }
> +#if HAVE_LIBDBGSERVER
> + else
> + {
> + const struct bfd_build_id *build_id;
> + char *debugfile_path;
> +
> + build_id = build_id_bfd_get (objfile->obfd);
> + int fd = dbgserver_find_debuginfo (build_id->data,
> + build_id->size,
> + &debugfile_path);
> +
> + if (fd >= 0)
> + {
> + /* debuginfo successfully retrieved from server, reopen
> + the file as a bfd instead. */
> + gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (debugfile_path));
> +
> + symbol_file_add_separate(debug_bfd.get (), debugfile_path,
> + symfile_flags, objfile);
> + close(fd);
> + free(debugfile_path);
> + }
> + }
> +#endif /* LIBDBGSERVER */
> }
> }
>

You wrote that the debuginfo server will download symbols over HTTP.
Does that mean that this call to dbgserver_find_debuginfo will block
as it downloads the file? (will ctrl+c work as it does that?)

If so, any way to do this download on a background thread?

Christian