5ced33e
2005-04-02  Andrew Cagney  <cagney@gnu.org>
5ced33e
5ced33e
	* symfile.c (separate_debug_file_exists): When the CRCs mismatch
5ced33e
	print a warning.
5ced33e
	(find_separate_debug_file): Pass in the objfile's name.
5ced33e
407ebe9
Index: gdb-6.8.50.20081128/gdb/symfile.c
8b1b3fd
===================================================================
407ebe9
--- gdb-6.8.50.20081128.orig/gdb/symfile.c	2008-10-03 18:36:10.000000000 +0200
407ebe9
+++ gdb-6.8.50.20081128/gdb/symfile.c	2008-12-01 16:34:36.000000000 +0100
407ebe9
@@ -1296,7 +1296,8 @@ get_debug_link_info (struct objfile *obj
5ced33e
 }
5ced33e
 
5ced33e
 static int
5ced33e
-separate_debug_file_exists (const char *name, unsigned long crc)
5ced33e
+separate_debug_file_exists (const char *name, unsigned long crc,
5ced33e
+			    const char *parent_name)
5ced33e
 {
5ced33e
   unsigned long file_crc = 0;
407ebe9
   bfd *abfd;
407ebe9
@@ -1316,7 +1317,15 @@ separate_debug_file_exists (const char *
5ced33e
 
407ebe9
   bfd_close (abfd);
5ced33e
 
5ced33e
-  return crc == file_crc;
5ced33e
+  if (crc != file_crc)
5ced33e
+    {
5ced33e
+      warning (_("the debug information found in \"%s\""
5ced33e
+		 " does not match \"%s\" (CRC mismatch).\n"),
5ced33e
+	       name, parent_name);
5ced33e
+      return 0;
5ced33e
+    }
5ced33e
+
5ced33e
+  return 1;
5ced33e
 }
5ced33e
 
8b1b3fd
 char *debug_file_directory = NULL;
407ebe9
@@ -1368,6 +1377,8 @@ find_separate_debug_file (struct objfile
5ced33e
   basename = get_debug_link_info (objfile, &crc32);
5ced33e
 
5ced33e
   if (basename == NULL)
5ced33e
+    /* There's no separate debug info, hence there's no way we could
5ced33e
+       load it => no warning.  */
5ced33e
     return NULL;
5ced33e
 
5ced33e
   dir = xstrdup (objfile->name);
407ebe9
@@ -1395,7 +1406,7 @@ find_separate_debug_file (struct objfile
5ced33e
   strcpy (debugfile, dir);
5ced33e
   strcat (debugfile, basename);
5ced33e
 
5ced33e
-  if (separate_debug_file_exists (debugfile, crc32))
5ced33e
+  if (separate_debug_file_exists (debugfile, crc32, objfile->name))
5ced33e
     {
5ced33e
       xfree (basename);
5ced33e
       xfree (dir);
407ebe9
@@ -1408,7 +1419,7 @@ find_separate_debug_file (struct objfile
5ced33e
   strcat (debugfile, "/");
5ced33e
   strcat (debugfile, basename);
5ced33e
 
5ced33e
-  if (separate_debug_file_exists (debugfile, crc32))
5ced33e
+  if (separate_debug_file_exists (debugfile, crc32, objfile->name))
5ced33e
     {
5ced33e
       xfree (basename);
5ced33e
       xfree (dir);
407ebe9
@@ -1421,7 +1432,7 @@ find_separate_debug_file (struct objfile
5ced33e
   strcat (debugfile, dir);
5ced33e
   strcat (debugfile, basename);
5ced33e
 
5ced33e
-  if (separate_debug_file_exists (debugfile, crc32))
5ced33e
+  if (separate_debug_file_exists (debugfile, crc32, objfile->name))
5ced33e
     {
5ced33e
       xfree (basename);
5ced33e
       xfree (dir);
407ebe9
@@ -1440,7 +1451,7 @@ find_separate_debug_file (struct objfile
eb9d945
       strcat (debugfile, "/");
eb9d945
       strcat (debugfile, basename);
eb9d945
 
eb9d945
-      if (separate_debug_file_exists (debugfile, crc32))
eb9d945
+      if (separate_debug_file_exists (debugfile, crc32, objfile->name))
eb9d945
 	{
eb9d945
 	  xfree (canon_name);
8b1b3fd
 	  xfree (basename);