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