forked from Imagelibrary/binutils-gdb
gdb/
Fix separate debuginfo warning with "remote:" access. * objfiles.h (struct objfile): New fields crc32 and crc32_p. * symfile.c (get_file_crc): New function with the code moved from ... (separate_debug_file_exists): ... this function, specifically variables buffer and count. New variable verified_as_different, set it. Remove file_crc initialization. Verify also if both files are not the same manually, if needed.
This commit is contained in:
@@ -1,3 +1,13 @@
|
|||||||
|
2011-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
Fix separate debuginfo warning with "remote:" access.
|
||||||
|
* objfiles.h (struct objfile): New fields crc32 and crc32_p.
|
||||||
|
* symfile.c (get_file_crc): New function with the code moved from ...
|
||||||
|
(separate_debug_file_exists): ... this function, specifically variables
|
||||||
|
buffer and count. New variable verified_as_different, set it. Remove
|
||||||
|
file_crc initialization. Verify also if both files are not the same
|
||||||
|
manually, if needed.
|
||||||
|
|
||||||
2011-10-11 Yao Qi <yao@codesourcery.com>
|
2011-10-11 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
* arm-tdep.c (arm_get_next_pc_raw): Use read_memory_unsigned_integer
|
* arm-tdep.c (arm_get_next_pc_raw): Use read_memory_unsigned_integer
|
||||||
|
|||||||
@@ -245,6 +245,11 @@ struct objfile
|
|||||||
|
|
||||||
long mtime;
|
long mtime;
|
||||||
|
|
||||||
|
/* Cached 32-bit CRC as computed by gnu_debuglink_crc32. CRC32 is valid
|
||||||
|
iff CRC32_P. */
|
||||||
|
unsigned long crc32;
|
||||||
|
int crc32_p;
|
||||||
|
|
||||||
/* Obstack to hold objects that should be freed when we load a new symbol
|
/* Obstack to hold objects that should be freed when we load a new symbol
|
||||||
table from this object file. */
|
table from this object file. */
|
||||||
|
|
||||||
|
|||||||
@@ -1311,15 +1311,52 @@ get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
|
|||||||
return contents;
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return 32-bit CRC for ABFD. If successful store it to *FILE_CRC_RETURN and
|
||||||
|
return 1. Otherwise print a warning and return 0. ABFD seek position is
|
||||||
|
not preserved. */
|
||||||
|
|
||||||
|
static int
|
||||||
|
get_file_crc (bfd *abfd, unsigned long *file_crc_return)
|
||||||
|
{
|
||||||
|
unsigned long file_crc = 0;
|
||||||
|
|
||||||
|
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
|
||||||
|
{
|
||||||
|
warning (_("Problem reading \"%s\" for CRC: %s"),
|
||||||
|
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
gdb_byte buffer[8 * 1024];
|
||||||
|
bfd_size_type count;
|
||||||
|
|
||||||
|
count = bfd_bread (buffer, sizeof (buffer), abfd);
|
||||||
|
if (count == (bfd_size_type) -1)
|
||||||
|
{
|
||||||
|
warning (_("Problem reading \"%s\" for CRC: %s"),
|
||||||
|
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (count == 0)
|
||||||
|
break;
|
||||||
|
file_crc = gnu_debuglink_crc32 (file_crc, buffer, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
*file_crc_return = file_crc;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
separate_debug_file_exists (const char *name, unsigned long crc,
|
separate_debug_file_exists (const char *name, unsigned long crc,
|
||||||
struct objfile *parent_objfile)
|
struct objfile *parent_objfile)
|
||||||
{
|
{
|
||||||
unsigned long file_crc = 0;
|
unsigned long file_crc;
|
||||||
|
int file_crc_p;
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
gdb_byte buffer[8*1024];
|
|
||||||
int count;
|
|
||||||
struct stat parent_stat, abfd_stat;
|
struct stat parent_stat, abfd_stat;
|
||||||
|
int verified_as_different;
|
||||||
|
|
||||||
/* Find a separate debug info file as if symbols would be present in
|
/* Find a separate debug info file as if symbols would be present in
|
||||||
PARENT_OBJFILE itself this function would not be called. .gnu_debuglink
|
PARENT_OBJFILE itself this function would not be called. .gnu_debuglink
|
||||||
@@ -1346,25 +1383,46 @@ separate_debug_file_exists (const char *name, unsigned long crc,
|
|||||||
negatives. */
|
negatives. */
|
||||||
|
|
||||||
if (bfd_stat (abfd, &abfd_stat) == 0
|
if (bfd_stat (abfd, &abfd_stat) == 0
|
||||||
&& bfd_stat (parent_objfile->obfd, &parent_stat) == 0
|
&& abfd_stat.st_ino != 0
|
||||||
&& abfd_stat.st_dev == parent_stat.st_dev
|
&& bfd_stat (parent_objfile->obfd, &parent_stat) == 0)
|
||||||
&& abfd_stat.st_ino == parent_stat.st_ino
|
|
||||||
&& abfd_stat.st_ino != 0)
|
|
||||||
{
|
{
|
||||||
bfd_close (abfd);
|
if (abfd_stat.st_dev == parent_stat.st_dev
|
||||||
return 0;
|
&& abfd_stat.st_ino == parent_stat.st_ino)
|
||||||
|
{
|
||||||
|
bfd_close (abfd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
verified_as_different = 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
verified_as_different = 0;
|
||||||
|
|
||||||
while ((count = bfd_bread (buffer, sizeof (buffer), abfd)) > 0)
|
file_crc_p = get_file_crc (abfd, &file_crc);
|
||||||
file_crc = gnu_debuglink_crc32 (file_crc, buffer, count);
|
|
||||||
|
|
||||||
bfd_close (abfd);
|
bfd_close (abfd);
|
||||||
|
|
||||||
|
if (!file_crc_p)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (crc != file_crc)
|
if (crc != file_crc)
|
||||||
{
|
{
|
||||||
warning (_("the debug information found in \"%s\""
|
/* If one (or both) the files are accessed for example the via "remote:"
|
||||||
" does not match \"%s\" (CRC mismatch).\n"),
|
gdbserver way it does not support the bfd_stat operation. Verify
|
||||||
name, parent_objfile->name);
|
whether those two files are not the same manually. */
|
||||||
|
|
||||||
|
if (!verified_as_different && !parent_objfile->crc32_p)
|
||||||
|
{
|
||||||
|
parent_objfile->crc32_p = get_file_crc (parent_objfile->obfd,
|
||||||
|
&parent_objfile->crc32);
|
||||||
|
if (!parent_objfile->crc32_p)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verified_as_different || parent_objfile->crc32 != crc)
|
||||||
|
warning (_("the debug information found in \"%s\""
|
||||||
|
" does not match \"%s\" (CRC mismatch).\n"),
|
||||||
|
name, parent_objfile->name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user