aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2009-11-02 14:55:05 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2009-11-02 14:55:05 +0000
commit287ccc17edcb68ea6ba15be621e72e5bf7f46038 (patch)
tree1b15aa0035b73c0ce9a7528cc3ca9534cba61975 /gdb/symfile.c
parentabd0a5fa917322975ca664878f29de21fa878e21 (diff)
downloadgdb-287ccc17edcb68ea6ba15be621e72e5bf7f46038.zip
gdb-287ccc17edcb68ea6ba15be621e72e5bf7f46038.tar.gz
gdb-287ccc17edcb68ea6ba15be621e72e5bf7f46038.tar.bz2
gdb/
* symfile.c (separate_debug_file_exists): When the CRCs mismatch print a warning. (find_separate_debug_file): Pass in the objfile's name. gdb/testsuite/ * gdb.base/sepdebug.exp (CRC mismatch is reported): New test. * gdb.base/sepdebug2.c: New file.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 5ace773..75cb0f8 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1283,7 +1283,8 @@ get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
}
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;
bfd *abfd;
@@ -1303,7 +1304,15 @@ separate_debug_file_exists (const char *name, unsigned long crc)
bfd_close (abfd);
- 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;
+ }
+
+ return 1;
}
char *debug_file_directory = NULL;
@@ -1355,6 +1364,8 @@ find_separate_debug_file (struct objfile *objfile)
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);
@@ -1388,7 +1399,7 @@ find_separate_debug_file (struct objfile *objfile)
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);
@@ -1402,7 +1413,7 @@ find_separate_debug_file (struct objfile *objfile)
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);
@@ -1416,7 +1427,7 @@ find_separate_debug_file (struct objfile *objfile)
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);
@@ -1435,7 +1446,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (canon_name);
xfree (basename);