- Print a warning when the separate debug info's CRC doen't match; test.
This commit is contained in:
parent
81e47be6db
commit
5ced33ee9c
85
gdb-6.3-sepcrc-20050402.patch
Normal file
85
gdb-6.3-sepcrc-20050402.patch
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
2005-04-02 Andrew Cagney <cagney@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);
|
53
gdb-6.3-test-sepcrc-20050402.patch
Normal file
53
gdb-6.3-test-sepcrc-20050402.patch
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
Index: ./gdb/testsuite/ChangeLog
|
||||||
|
2005-04-02 Andrew Cagney <cagney@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;
|
||||||
|
+}
|
12
gdb.spec
12
gdb.spec
@ -11,7 +11,7 @@ Name: gdb
|
|||||||
Version: 6.3.0.0
|
Version: 6.3.0.0
|
||||||
|
|
||||||
# The release always contains a leading reserved number, start it at 0.
|
# The release always contains a leading reserved number, start it at 0.
|
||||||
Release: 1.9
|
Release: 1.10
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
Group: Development/Debuggers
|
Group: Development/Debuggers
|
||||||
@ -204,6 +204,10 @@ Patch148: gdb-6.3-inheritance-20050324.patch
|
|||||||
# Add vsyscall page support for ia64.
|
# Add vsyscall page support for ia64.
|
||||||
Patch149: gdb-6.3-ia64-vsyscall-20050330.patch
|
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
|
%ifarch ia64
|
||||||
BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu libunwind >= 0.96-3
|
BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu libunwind >= 0.96-3
|
||||||
%else
|
%else
|
||||||
@ -286,6 +290,8 @@ and printing their data.
|
|||||||
%patch147 -p1
|
%patch147 -p1
|
||||||
%patch148 -p1
|
%patch148 -p1
|
||||||
%patch149 -p1
|
%patch149 -p1
|
||||||
|
%patch150 -p1
|
||||||
|
%patch151 -p1
|
||||||
|
|
||||||
# Change the version that gets printed at GDB startup, so it is RedHat
|
# Change the version that gets printed at GDB startup, so it is RedHat
|
||||||
# specific.
|
# specific.
|
||||||
@ -454,6 +460,10 @@ fi
|
|||||||
# don't include the files in include, they are part of binutils
|
# don't include the files in include, they are part of binutils
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Apr 2 2005 Andrew Cagney <cagney@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@redhat.com> 6.3.0.0-1.9
|
* Wed Mar 30 2005 Jeff Johnston <jjohnstn@redhat.com> 6.3.0.0-1.9
|
||||||
- Bump up release number.
|
- Bump up release number.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user