Mark Wielaard f0e9e4
commit 93104368952c37268da724231487058ea3eaf1dc
Mark Wielaard f0e9e4
Author: Tom Hughes <tom@compton.nu>
Mark Wielaard f0e9e4
Date:   Thu May 20 17:16:06 2021 +0100
Mark Wielaard f0e9e4
Mark Wielaard f0e9e4
    Don't look for separate debuginfo if the image has a .debug_info section
Mark Wielaard f0e9e4
    
Mark Wielaard f0e9e4
    Fixes BZ#435908
Mark Wielaard f0e9e4
Mark Wielaard f0e9e4
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
Mark Wielaard f0e9e4
index b0f062ddc..e424e3e7e 100644
Mark Wielaard f0e9e4
--- a/coregrind/m_debuginfo/readelf.c
Mark Wielaard f0e9e4
+++ b/coregrind/m_debuginfo/readelf.c
Mark Wielaard f0e9e4
@@ -2879,13 +2879,15 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
Mark Wielaard f0e9e4
       /* Look for a build-id */
Mark Wielaard f0e9e4
       HChar* buildid = find_buildid(mimg, False, False);
Mark Wielaard f0e9e4
 
Mark Wielaard f0e9e4
-      /* Look for a debug image that matches either the build-id or
Mark Wielaard f0e9e4
+      /* If we don't have a .debug_info section in the main image then
Mark Wielaard f0e9e4
+         look for a debug image that matches either the build-id or
Mark Wielaard f0e9e4
          the debuglink-CRC32 in the main image.  If the main image
Mark Wielaard f0e9e4
          doesn't contain either of those then this won't even bother
Mark Wielaard f0e9e4
          to try looking.  This looks in all known places, including
Mark Wielaard f0e9e4
          the --extra-debuginfo-path if specified and on the
Mark Wielaard f0e9e4
          --debuginfo-server if specified. */
Mark Wielaard f0e9e4
-      if (buildid != NULL || debuglink_escn.img != NULL) {
Mark Wielaard f0e9e4
+      if (debug_info_escn.img == NULL &&
Mark Wielaard f0e9e4
+          (buildid != NULL || debuglink_escn.img != NULL)) {
Mark Wielaard f0e9e4
          /* Do have a debuglink section? */
Mark Wielaard f0e9e4
          if (debuglink_escn.img != NULL) {
Mark Wielaard f0e9e4
             UInt crc_offset