aboutsummaryrefslogtreecommitdiff
path: root/gdb/debuginfod-support.c
AgeCommit message (Collapse)AuthorFilesLines
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-12-16[gdb] Print progress for debuginfodMartin Liska1-8/+19
Prints progress like: Downloading 4.89 MB separate debug info for /usr/lib64/libgcrypt.so.20. Downloading 1.10 MB separate debug info for /usr/lib64/liblzma.so.5. Downloading 1.31 MB separate debug info for /usr/lib64/liblz4.so.1. Downloading 0.96 MB separate debug info for /usr/lib64/libsmime3.so. [### ] Tested on x86_64-linux. ChangeLog: 2020-12-16 Martin Liska <mliska@suse.cz> Tom de Vries <tdevries@suse.de> * gdb/debuginfod-support.c (struct user_data): Remove has_printed field. Add meter field. (progressfn): Print progress using meter.
2020-11-23[gdb] Don't return non-existing path in debuginfod_source_queryTom de Vries1-2/+4
When setting env var DEBUGINFOD_URLS to " " and running the testsuite, we run into these regressions: ... FAIL: gdb.base/list-missing-source.exp: info source FAIL: gdb.base/source-dir.exp: info source before setting directory search list ... Setting var DEBUGINFOD_URLS to " " allows the debuginfod query function debuginfod_source_query to get past its early exit. The function debuginfod_source_query is documented as: "If the file is successfully retrieved, its path on the local machine is stored in DESTNAME". However, in case we get back -ENOENT from libdebuginfod, we still set DESTNAME: .... if (fd.get () < 0 && fd.get () != -ENOENT) printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"), safe_strerror (-fd.get ()), styled_string (file_name_style.style (), srcpath)); else *destname = make_unique_xstrdup (srcpath); return fd; ... Fix this by making debuginfod_source_query fit it's documentation and only setting DESTNAME when successfully retrieving a file. Likewise in debuginfod_debuginfo_query. gdb/ChangeLog: 2020-11-23 Tom de Vries <tdevries@suse.de> * debuginfod-support.c (debuginfod_source_query) (debuginfod_debuginfo_query): Only set DESTNAME if successful.
2020-11-18[gdb] Improve early exits for env var in debuginfod-support.cTom de Vries1-2/+4
There's an early exit in libdebuginfod's debuginfod_query_server, which checks both for: - getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL, and - (getenv (DEBUGINFOD_URLS_ENV_VAR))[0] == '\0'. In debuginfod_source_query and debuginfod_debuginfo_query (which both end up calling debuginfod_query_server) there are also early exits checking the same env var, but those just check for NULL. Make the early exit tests in debuginfod-support.c match those in libdebuginfod. gdb/ChangeLog: 2020-11-18 Tom de Vries <tdevries@suse.de> * debuginfod-support.c (debuginfod_source_query) (debuginfod_debuginfo_query): Also do early exit if "(getenv (DEBUGINFOD_URLS_ENV_VAR))[0] == '\0'".
2020-09-14gdb: introduce debuginfod_client_up typeSimon Marchi1-11/+24
Introduce and use a unique pointer specialization for the debuginfod_client type. The deleter calls debuginfod_end to free the client. gdb/ChangeLog: * debuginfod-support.c (debuginfod_client_deleter): New. (debuginfod_client_up): New. (debuginfod_init): Return debuginfod_client_up. (debuginfod_source_query): Adjust. (debuginfod_debuginfo_query): Adjust. Change-Id: Ie56441e123ab80b78e5311c824c162cd804f68c0
2020-09-14gdb: use make_unique_xstrdup in debuginfod-support.cSimon Marchi1-1/+1
Use make_unique_xstrdup instead of reset + xstrdup. gdb/ChangeLog: * debuginfod-support.c (debuginfod_source_query): Use make_unique_xstrdup. Change-Id: Iee9524fea7630b4d6ee5c74e30c60fe222dc1d2c
2020-08-13debuginfod-support.c: Replace globals with user_dataAaron Merey1-16/+22
Store query information in user_data struct instead of global variables. gdb/ChangeLog: * debuginfod-support.c: Replace global variables with user_data.
2020-03-02gdb: Move defs.h before any system header in debuginfod-support.cJon Turney1-1/+1
* defs.h includes config.h * config.h may define _GNU_SOURCE * if _GNU_SOURCE is defined, that must be before including any system header (see feature_test_macro(7)) This is necessary to ensure that a prototype for mkostemp() is brought into scope by <stdlib.h> when compiling filestuff.h, on platforms where _GNU_SOURCE isn't unconditionally defined for C++. In file included from ../../gdb/../gdbsupport/scoped_fd.h:24, from ../../gdb/debuginfod-support.c:22: ../../gdb/../gdbsupport/filestuff.h: In function ‘int gdb_mkostemp_cloexec(char*, int)’: ../../gdb/../gdbsupport/filestuff.h:59:10: error: ‘mkostemp’ was not declared in this scope; did you mean ‘mkstemp’? gdb/ChangeLog: 2020-02-29 Jon Turney <jon.turney@dronecode.org.uk> * debuginfod-support.c: Include defs.h first.
2020-02-26Add debuginfod support to GDBAaron Merey1-0/+155
debuginfod is a lightweight web service that indexes ELF/DWARF debugging resources by build-id and serves them over HTTP. This patch enables GDB to query debuginfod servers for separate debug files and source code when it is otherwise not able to find them. GDB can be built with debuginfod using the --with-debuginfod configure option. This requires that libdebuginfod be installed and found at configure time. debuginfod is packaged with elfutils, starting with version 0.178. For more information see https://sourceware.org/elfutils/. Tested on x86_64 Fedora 31. gdb/ChangeLog: 2020-02-26 Aaron Merey <amerey@redhat.com> * Makefile.in: Handle optional debuginfod support. * NEWS: Update. * README: Add --with-debuginfod summary. * config.in: Regenerate. * configure: Regenerate. * configure.ac: Handle optional debuginfod support. * debuginfod-support.c: debuginfod helper functions. * debuginfod-support.h: Ditto. * doc/gdb.texinfo: Add --with-debuginfod to configure options summary. * dwarf2/read.c (dwarf2_get_dwz_file): Query debuginfod servers when a dwz file cannot be found. * elfread.c (elf_symfile_read): Query debuginfod servers when a debuginfo file cannot be found. * source.c (open_source_file): Query debuginfod servers when a source file cannot be found. * top.c (print_gdb_configuration): Include --{with,without}-debuginfod in the output. gdb/testsuite/ChangeLog: 2020-02-26 Aaron Merey <amerey@redhat.com> * gdb.debuginfod: New directory for debuginfod tests. * gdb.debuginfod/main.c: New test file. * gdb.debuginfod/fetch_src_and_symbols.exp: New tests.