This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 8/9] move CRC to per-bfd


This moves the CRC computation to the objfile's per-BFD storage.

	* objfiles.h (struct objfile_per_bfd_storage) <crc32,
	crc32_p>: New fields.
	(struct objfile) <crc32, crc32_p>: Remove.
	* symfile.c (separate_debug_file_exists): Update.
---
 gdb/objfiles.h |   10 +++++-----
 gdb/symfile.c  |   11 ++++++-----
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 82dbcba..f4397d0 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -177,6 +177,11 @@ struct objfile_per_bfd_storage
 
   /* Byte cache for macros.  */
   struct bcache *macro_cache;
+
+  /* Cached 32-bit CRC as computed by gnu_debuglink_crc32.  CRC32 is
+     valid iff CRC32_P.  */
+  unsigned long crc32;
+  int crc32_p;
 };
 
 /* Master structure for keeping track of each file from which
@@ -258,11 +263,6 @@ struct objfile
 
     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
        table from this object file.  */
 
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 61b7b7c..fdf604d 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1395,15 +1395,16 @@ separate_debug_file_exists (const char *name, unsigned long crc,
 	 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->per_bfd->crc32_p)
 	{
-	  parent_objfile->crc32_p = get_file_crc (parent_objfile->obfd,
-						  &parent_objfile->crc32);
-	  if (!parent_objfile->crc32_p)
+	  parent_objfile->per_bfd->crc32_p
+	    = get_file_crc (parent_objfile->obfd,
+			    &parent_objfile->per_bfd->crc32);
+	  if (!parent_objfile->per_bfd->crc32_p)
 	    return 0;
 	}
 
-      if (verified_as_different || parent_objfile->crc32 != file_crc)
+      if (verified_as_different || parent_objfile->per_bfd->crc32 != file_crc)
 	warning (_("the debug information found in \"%s\""
 		   " does not match \"%s\" (CRC mismatch).\n"),
 		 name, parent_objfile->name);
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]