This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: cache the CRC in the BFD
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 27 Jan 2013 05:29:39 -0200
- Subject: Re: RFC: cache the CRC in the BFD
- References: <87k3r1ez2z.fsf@fleche.redhat.com>
On Friday, January 25 2013, Tom Tromey wrote:
> Right now gdb may cache a CRC on an objfile.
>
> However, the CRC is actually a property of the BFD. It seems better to
> me to cache it there instead. This patch implements that.
Thanks for the patch, just a minor comment.
> diff --git a/gdb/symfile.c b/gdb/symfile.c
> index 4d65889..eef3128 100644
[...]
> static int
> separate_debug_file_exists (const char *name, unsigned long crc,
> struct objfile *parent_objfile)
> @@ -1434,7 +1397,7 @@ separate_debug_file_exists (const char *name, unsigned long crc,
> else
> verified_as_different = 0;
>
> - file_crc_p = get_file_crc (abfd, &file_crc);
> + file_crc_p = gdb_bfd_crc (abfd, &file_crc);
>
> gdb_bfd_unref (abfd);
>
> @@ -1443,19 +1406,21 @@ separate_debug_file_exists (const char *name, unsigned long crc,
>
> if (crc != file_crc)
> {
> + unsigned long parent_crc;
> + int parent_crc_p;
> +
> /* If one (or both) the files are accessed for example the via "remote:"
> gdbserver way it does not support the bfd_stat operation. Verify
> whether those two files are not the same manually. */
>
> - if (!verified_as_different && !parent_objfile->crc32_p)
> + if (!verified_as_different)
> {
> - parent_objfile->crc32_p = get_file_crc (parent_objfile->obfd,
> - &parent_objfile->crc32);
> - if (!parent_objfile->crc32_p)
> + parent_crc_p = gdb_bfd_crc (parent_objfile->obfd, &parent_crc);
> + if (!parent_crc_p)
> return 0;
> }
>
> - if (verified_as_different || parent_objfile->crc32 != file_crc)
> + if (verified_as_different || parent_crc != file_crc)
> warning (_("the debug information found in \"%s\""
> " does not match \"%s\" (CRC mismatch).\n"),
> name, parent_objfile->name);
The `parent_crc_p' variable is only used to check the return value of
`gdb_bfd_crc', so IMO it could be removed, WDYT?
Otherwise it looks fine for me.
Thanks,
--
Sergio