rpms/gdb/devel gdb-6.3-sepcrc-20050402.patch, NONE, 1.1 gdb-6.3-test-sepcrc-20050402.patch, NONE, 1.1 gdb.spec, 1.139, 1.140

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Sat Apr 2 22:38:11 UTC 2005


Update of /cvs/dist/rpms/gdb/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv21395

Modified Files:
	gdb.spec 
Added Files:
	gdb-6.3-sepcrc-20050402.patch 
	gdb-6.3-test-sepcrc-20050402.patch 
Log Message:
* Sat Apr 2 2005 Andrew Cagney <cagney at redhat.com>   	6.3.0.0-1.10
- Print a warning when the separate debug info's CRC doen't match;
  test.


gdb-6.3-sepcrc-20050402.patch:
 symfile.c |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

--- NEW FILE gdb-6.3-sepcrc-20050402.patch ---
2005-04-02  Andrew Cagney  <cagney at 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.

--- ../gdb-6.3/./gdb/symfile.c	2005-04-02 16:02:22.000000000 -0500
+++ ./gdb/symfile.c	2005-04-02 13:05:10.000000000 -0500
@@ -1043,7 +1043,8 @@
 }
 
 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;
@@ -1052,6 +1053,12 @@
 
   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)
@@ -1059,7 +1066,16 @@
 
   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;
 }
 
 static char *debug_file_directory = NULL;
@@ -1083,6 +1099,8 @@
   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);
@@ -1110,7 +1128,7 @@
   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);
@@ -1123,7 +1141,7 @@
   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);
@@ -1136,7 +1154,7 @@
   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);

gdb-6.3-test-sepcrc-20050402.patch:
 sepdebug.exp |   32 ++++++++++++++++++++++++++++++++
 sepdebug2.c  |    5 +++++
 2 files changed, 37 insertions(+)

--- NEW FILE gdb-6.3-test-sepcrc-20050402.patch ---
Index: ./gdb/testsuite/ChangeLog
2005-04-02  Andrew Cagney  <cagney at gnu.org>

	* gdb.base/sepdebug.exp: Check that things fail when the debug
	info is corrupt.
	* gdb.base/sepdebug2.c (main): New file.

--- ../gdb-6.3/./gdb/testsuite/gdb.base/sepdebug.exp	2004-01-14 10:09:37.000000000 -0500
+++ ./gdb/testsuite/gdb.base/sepdebug.exp	2005-04-02 15:57:17.000000000 -0500
@@ -985,3 +985,35 @@
     send_gdb "set args main\n"
     gdb_expect -re ".*$gdb_prompt $" {}
 }
+
+
+# Compile up a second, different, object file.  Copy its debug info
+# over the top of the new debug info.  Note that somewhere in the
+# above the "set debug-file-directory" variable is set to
+# ${objdir}/${subdir} so need to move things there.
+
+set existing_binfile $binfile
+set testfile "sepdebug2"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+set corrupt_debug_file [separate_debug_filename $binfile]
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
+    return -1
+}
+if [gdb_gnu_strip_debug $binfile] {
+    # check that you have a recent version of strip and objcopy installed
+    unsupported "cannot produce separate debug info files"
+    return -1
+}
+remote_exec build "cp $corrupt_debug_file ${existing_binfile}.debug"
+
+set test  "A corrupt debug file gets a warning"
+gdb_test_multiple "file $existing_binfile" "$test" {
+    -re "warning:.*mismatch.*" {
+	pass "$test"
+    }
+    -re ".y or n. " {
+	send_gdb "y\n"
+	exp_continue
+    }
+}
--- /dev/null	2005-04-02 11:30:32.604931736 -0500
+++ ./gdb/testsuite/gdb.base/sepdebug2.c	2005-04-02 13:09:31.000000000 -0500
@@ -0,0 +1,5 @@
+int
+main (int argc, char *argv[], char *envp[])
+{
+  return 0;
+}


Index: gdb.spec
===================================================================
RCS file: /cvs/dist/rpms/gdb/devel/gdb.spec,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- gdb.spec	30 Mar 2005 23:40:51 -0000	1.139
+++ gdb.spec	2 Apr 2005 22:38:09 -0000	1.140
@@ -11,7 +11,7 @@
 Version: 6.3.0.0
 
 # The release always contains a leading reserved number, start it at 0.
-Release: 1.9
+Release: 1.10
 
 License: GPL
 Group: Development/Debuggers
@@ -204,6 +204,10 @@
 # Add vsyscall page support for ia64.
 Patch149: gdb-6.3-ia64-vsyscall-20050330.patch
 
+# Print a warning when the separate debug info's CRC doesn't match.
+Patch150: gdb-6.3-test-sepcrc-20050402.patch
+Patch151: gdb-6.3-sepcrc-20050402.patch
+
 %ifarch ia64
 BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu libunwind >= 0.96-3
 %else
@@ -286,6 +290,8 @@
 %patch147 -p1
 %patch148 -p1
 %patch149 -p1
+%patch150 -p1
+%patch151 -p1
 
 # Change the version that gets printed at GDB startup, so it is RedHat
 # specific.
@@ -454,6 +460,10 @@
 # don't include the files in include, they are part of binutils
 
 %changelog
+* Sat Apr 2 2005 Andrew Cagney <cagney at redhat.com>   	6.3.0.0-1.10
+- Print a warning when the separate debug info's CRC doen't match;
+  test.
+
 * Wed Mar 30 2005 Jeff Johnston <jjohnstn at redhat.com>   6.3.0.0-1.9
 - Bump up release number.
 




More information about the fedora-cvs-commits mailing list