commit: PR 22802: Skip debug link processing if not requested by the user

Message ID 87bmgzpsxa.fsf@redhat.com
State New
Headers show
Series
  • commit: PR 22802: Skip debug link processing if not requested by the user
Related show

Commit Message

Nick Clifton Feb. 8, 2018, 12:28 p.m.
Hi Guys,

  I am going to check in the patch below to address the performance
  regression in readelf (and objdump) when displaying the details of a
  file containing a large amount of debug information.

  The problem was that the function to find DWO debug links needs to
  read in and parse all of the debug information, even if there are DWO
  links to be found, and this was being done even when the user had not
  requested that debug links be displayed or followed.

Cheers
  Nick

binutils/ChangeLog
2018-02-08  Nick Clifton  <nickc@redhat.com>

	PR 22802
	* dwarf.c (load_separate_debug_file): Return early if the user is
	not interested in debug links.

Patch

diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 71fdf39108..6aca9b7994 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -9876,6 +9876,10 @@  load_dwo_file (const char * main_filename)
 void *
 load_separate_debug_file (void * file, const char * filename)
 {
+  /* Skip this operation if we are not interested in debug links.  */
+  if (! do_follow_links && ! do_debug_links)
+    return NULL;
+
   /* See if there is a dwo link.  */
   if (load_debug_section (str, file)
       && load_debug_section (abbrev, file)
@@ -9910,6 +9914,8 @@  load_separate_debug_file (void * file, const char * filename)
     }
 
   if (! do_follow_links)
+    /* The other debug links will be displayed by display_debug_links()
+       so we do not need to do any further processing here.  */
     return NULL;
 
   /* FIXME: We do not check for the presence of both link sections in the same file.  */