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