Commit: objdump/readelf: Try harder to avoid following links to separate debug info files

Nick Clifton nickc@redhat.com
Fri May 20 15:55:00 GMT 2022


Hi Guys,

  I am applying the attached patch to change objdump's and readelf's
  behaviour slightly.  Currently if the follow-debug-links configure
  option is enabled they will automatically load and follow debug
  links, even if the requested dumping operation(s) have nothing to do
  with debugging.  This can cause performance slow downs if the use of
  debuginfod is also enabled and a debuginfod server cannot be
  contacted.

  So this patch makes two changes.  Firstly the heuristic for deciding
  when to try loading separate debug info files is moved into separate
  functions.  In addition these functions will only check the
  do_follow_links variable if the default value for that variable is
  zero.  Ie, if it defaults to 1 then the new function will need some
  other reason for saying that the separate files should be loaded.

  The second change is to make the options that disable link following
  (-wN/-WN) and disable debuginfod use (-wU/-WU) *not* enable debug
  dumping.  Ie these options can now be used to turn off these
  behaviours without enabling extra dumps.

Cheers
  Nick

binutils/ChangeLog
2022-05-20  Nick Clifton  <nickc@redhat.com>

	* dwarf.c (dwarf_select_sections_by_names): Return zero if no
	sections were selected.
	(dwarf_select_sections_by_letters): Likewise.
	* dwarf.h: (dwarf_select_sections_by_names): Update prototype.
	(dwarf_select_sections_by_letters): Update prototype.
	* objdump.c (might_need_separate_debug_info): New function.
	(dump_bfd): Call new function before attempting to load separate
	debug info files.
	(main): Do not enable dwarf section dumping for -WK or -WN.
	* readelf.c (parse_args): Do not enable dwarf section dumping for
	-wK or -wN.
	(might_need_separate_debug_info): New function.
	(process_object): Call new function before attempting to load
	separate debug info files.
	* testsuite/binutils-all/debuginfo.exp: Expect -WE and -wE
	debuginfod tests to pass.
	* testsuite/binutils-all/objdump.Wk: Add extra regexps.
	* testsuite/binutils-all/readelf.k: Add extra regexps.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: follow-links-less.patch
Type: text/x-patch
Size: 12548 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20220520/40f5c49f/attachment-0001.bin>


More information about the Binutils mailing list