diff options
author | Nick Clifton <nickc@redhat.com> | 2022-03-10 09:11:40 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2022-03-10 09:11:40 +0000 |
commit | bed566bbf6b619e15f0290c7d4c8a8b6dcbd99d4 (patch) | |
tree | dfa7d8b1680c9424387902a933d9245cdcc8e170 /binutils/dwarf.c | |
parent | d7c448293af68af5fc270d90d3746e39a496e750 (diff) | |
download | gdb-bed566bbf6b619e15f0290c7d4c8a8b6dcbd99d4.zip gdb-bed566bbf6b619e15f0290c7d4c8a8b6dcbd99d4.tar.gz gdb-bed566bbf6b619e15f0290c7d4c8a8b6dcbd99d4.tar.bz2 |
Add option to objdump/readelf to disable access to debuginfod servers.
* dwarf.c (use_debuginfod): New variable. Set to 1.
(load_separate_debug_info): Only call
debuginfod_fetch_separate_debug_info is use_debuginfod is true.
(dwarf_select_sections_by_names): Add do-not-use-debuginfod and
use-debuginfod options.
(dwarf_select_sections_by_letters): Add D and E options.
* dwarf.h (use_debuginfod): New extern.
* objdump.c (usage): Mention the new options.
* readelf.c (usage): Likewise.
* doc/binutils.texi: Document the new options.
* doc/debug-options.texi: Describe the new options.
* NEWS: Mention the new feature.
* testsuite/binutils-all/debuginfod.exp: Add tests of the new
options.
Diffstat (limited to 'binutils/dwarf.c')
-rw-r--r-- | binutils/dwarf.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c index bc33e9f..15b3c81 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -109,6 +109,9 @@ int do_debug_cu_index; int do_wide; int do_debug_links; int do_follow_links = DEFAULT_FOR_FOLLOW_LINKS; +#ifdef HAVE_LIBDEBUGINFOD +int use_debuginfod = 1; +#endif bool do_checks; int dwarf_cutoff_level = -1; @@ -11038,7 +11041,7 @@ debuginfod_fetch_separate_debug_info (struct dwarf_section * section, return false; } -#endif +#endif /* HAVE_LIBDEBUGINFOD */ static void * load_separate_debug_info (const char * main_filename, @@ -11157,9 +11160,10 @@ load_separate_debug_info (const char * main_filename, { char * tmp_filename; - if (debuginfod_fetch_separate_debug_info (xlink, - & tmp_filename, - file)) + if (use_debuginfod + && debuginfod_fetch_separate_debug_info (xlink, + & tmp_filename, + file)) { /* File successfully downloaded from server, replace debug_filename with the file's path. */ @@ -11207,13 +11211,15 @@ load_separate_debug_info (const char * main_filename, warn (_("tried: %s\n"), debug_filename); #if HAVE_LIBDEBUGINFOD - { - char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR); - if (urls == NULL) - urls = ""; + if (use_debuginfod) + { + char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR); - warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls); - } + if (urls == NULL) + urls = ""; + + warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls); + } #endif } @@ -11707,6 +11713,9 @@ dwarf_select_sections_by_names (const char *names) { "aranges", & do_debug_aranges, 1 }, { "cu_index", & do_debug_cu_index, 1 }, { "decodedline", & do_debug_lines, FLAG_DEBUG_LINES_DECODED }, +#ifdef HAVE_LIBDEBUGINFOD + { "do-not-use-debuginfod", & use_debuginfod, 0 }, +#endif { "follow-links", & do_follow_links, 1 }, { "frames", & do_debug_frames, 1 }, { "frames-interp", & do_debug_frames_interp, 1 }, @@ -11730,6 +11739,9 @@ dwarf_select_sections_by_names (const char *names) { "trace_abbrev", & do_trace_abbrevs, 1 }, { "trace_aranges", & do_trace_aranges, 1 }, { "trace_info", & do_trace_info, 1 }, +#ifdef HAVE_LIBDEBUGINFOD + { "use-debuginfod", & use_debuginfod, 1 }, +#endif { NULL, NULL, 0 } }; @@ -11783,6 +11795,10 @@ dwarf_select_sections_by_letters (const char *letters) case 'A': do_debug_addr = 1; break; case 'a': do_debug_abbrevs = 1; break; case 'c': do_debug_cu_index = 1; break; +#ifdef HAVE_LIBDEBUGINFOD + case 'D': use_debuginfod = 1; break; + case 'E': use_debuginfod = 0; break; +#endif case 'F': do_debug_frames_interp = 1; /* Fall through. */ case 'f': do_debug_frames = 1; break; case 'g': do_gdb_index = 1; break; |