2005-04-02 22:38:09 +00:00
|
|
|
2005-04-02 Andrew Cagney <cagney@gnu.org>
|
|
|
|
|
|
|
|
* symfile.c (separate_debug_file_exists): When the CRCs mismatch
|
|
|
|
print a warning.
|
|
|
|
(find_separate_debug_file): Pass in the objfile's name.
|
|
|
|
|
2008-07-14 09:09:04 +00:00
|
|
|
Index: gdb-6.8/gdb/symfile.c
|
|
|
|
===================================================================
|
|
|
|
--- gdb-6.8.orig/gdb/symfile.c 2008-01-29 23:47:20.000000000 +0100
|
|
|
|
+++ gdb-6.8/gdb/symfile.c 2008-07-14 10:26:30.000000000 +0200
|
|
|
|
@@ -1348,7 +1348,8 @@ get_debug_link_info (struct objfile *obj
|
2005-04-02 22:38:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
-separate_debug_file_exists (const char *name, unsigned long crc)
|
|
|
|
+separate_debug_file_exists (const char *name, unsigned long crc,
|
|
|
|
+ const char *parent_name)
|
|
|
|
{
|
|
|
|
unsigned long file_crc = 0;
|
|
|
|
int fd;
|
2008-07-14 09:09:04 +00:00
|
|
|
@@ -1357,6 +1358,12 @@ separate_debug_file_exists (const char *
|
2005-04-02 22:38:09 +00:00
|
|
|
|
|
|
|
fd = open (name, O_RDONLY | O_BINARY);
|
|
|
|
if (fd < 0)
|
|
|
|
+ /* Fail silently, this preserves existing behavior. The
|
|
|
|
+ assumption here is that the file wasn't found because there's
|
|
|
|
+ no file to find (we shouldn't be printing warnings about
|
|
|
|
+ missing debug info files when the user hasn't installed them).
|
|
|
|
+ The alternative is to complain here - that better belongs in a
|
|
|
|
+ warning. */
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
while ((count = read (fd, buffer, sizeof (buffer))) > 0)
|
2008-07-14 09:09:04 +00:00
|
|
|
@@ -1364,7 +1371,16 @@ separate_debug_file_exists (const char *
|
2005-04-02 22:38:09 +00:00
|
|
|
|
|
|
|
close (fd);
|
|
|
|
|
|
|
|
- return crc == file_crc;
|
|
|
|
+ if (crc != file_crc)
|
|
|
|
+ {
|
|
|
|
+ warning (_("the debug information found in \"%s\""
|
|
|
|
+ " does not match \"%s\" (CRC mismatch).\n"),
|
|
|
|
+ name, parent_name);
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* No worries! */
|
|
|
|
+ return 1;
|
|
|
|
}
|
|
|
|
|
2008-07-14 09:09:04 +00:00
|
|
|
char *debug_file_directory = NULL;
|
|
|
|
@@ -1416,6 +1432,8 @@ find_separate_debug_file (struct objfile
|
2005-04-02 22:38:09 +00:00
|
|
|
basename = get_debug_link_info (objfile, &crc32);
|
|
|
|
|
|
|
|
if (basename == NULL)
|
|
|
|
+ /* There's no separate debug info, hence there's no way we could
|
|
|
|
+ load it => no warning. */
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
dir = xstrdup (objfile->name);
|
2008-07-14 09:09:04 +00:00
|
|
|
@@ -1443,7 +1461,7 @@ find_separate_debug_file (struct objfile
|
2005-04-02 22:38:09 +00:00
|
|
|
strcpy (debugfile, dir);
|
|
|
|
strcat (debugfile, basename);
|
|
|
|
|
|
|
|
- if (separate_debug_file_exists (debugfile, crc32))
|
|
|
|
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
|
|
|
|
{
|
|
|
|
xfree (basename);
|
|
|
|
xfree (dir);
|
2008-07-14 09:09:04 +00:00
|
|
|
@@ -1456,7 +1474,7 @@ find_separate_debug_file (struct objfile
|
2005-04-02 22:38:09 +00:00
|
|
|
strcat (debugfile, "/");
|
|
|
|
strcat (debugfile, basename);
|
|
|
|
|
|
|
|
- if (separate_debug_file_exists (debugfile, crc32))
|
|
|
|
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
|
|
|
|
{
|
|
|
|
xfree (basename);
|
|
|
|
xfree (dir);
|
2008-07-14 09:09:04 +00:00
|
|
|
@@ -1469,7 +1487,7 @@ find_separate_debug_file (struct objfile
|
2005-04-02 22:38:09 +00:00
|
|
|
strcat (debugfile, dir);
|
|
|
|
strcat (debugfile, basename);
|
|
|
|
|
|
|
|
- if (separate_debug_file_exists (debugfile, crc32))
|
|
|
|
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
|
|
|
|
{
|
|
|
|
xfree (basename);
|
|
|
|
xfree (dir);
|
2008-07-14 09:09:04 +00:00
|
|
|
@@ -1488,7 +1506,7 @@ find_separate_debug_file (struct objfile
|
2007-11-01 20:24:20 +00:00
|
|
|
strcat (debugfile, "/");
|
|
|
|
strcat (debugfile, basename);
|
|
|
|
|
|
|
|
- if (separate_debug_file_exists (debugfile, crc32))
|
|
|
|
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
|
|
|
|
{
|
|
|
|
xfree (canon_name);
|
2008-07-14 09:09:04 +00:00
|
|
|
xfree (basename);
|