8b1b3fd
Index: gdb-6.8/gdb/testsuite/gdb.base/sepdebug.exp
aefb0e1
===================================================================
8b1b3fd
--- gdb-6.8.orig/gdb/testsuite/gdb.base/sepdebug.exp	2008-02-26 09:14:11.000000000 +0100
8b1b3fd
+++ gdb-6.8/gdb/testsuite/gdb.base/sepdebug.exp	2008-07-14 10:26:19.000000000 +0200
8b1b3fd
@@ -981,3 +981,40 @@ if ![string compare $build_id_debug_file
8b1b3fd
     # Spare debug files may confuse testsuite runs in the future.
8b1b3fd
     remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}"
5ced33e
 }
5ced33e
+
5ced33e
+
5ced33e
+# Compile up a second, different, object file.  Copy its debug info
5ced33e
+# over the top of the new debug info.  Note that somewhere in the
5ced33e
+# above the "set debug-file-directory" variable is set to
5ced33e
+# ${objdir}/${subdir} so need to move things there.
5ced33e
+
5ced33e
+set existing_binfile $binfile
5ced33e
+set testfile "sepdebug2"
5ced33e
+set srcfile ${testfile}.c
5ced33e
+set binfile ${objdir}/${subdir}/${testfile}
5ced33e
+set corrupt_debug_file [separate_debug_filename $binfile]
5ced33e
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
5ced33e
+    return -1
5ced33e
+}
5ced33e
+if [gdb_gnu_strip_debug $binfile] {
5ced33e
+    # check that you have a recent version of strip and objcopy installed
5ced33e
+    unsupported "cannot produce separate debug info files"
5ced33e
+    return -1
5ced33e
+}
5ced33e
+remote_exec build "cp $corrupt_debug_file ${existing_binfile}.debug"
5ced33e
+
aefb0e1
+gdb_exit
aefb0e1
+gdb_start
aefb0e1
+gdb_reinitialize_dir $srcdir/$subdir
aefb0e1
+gdb_load ${binfile}
aefb0e1
+
5ced33e
+set test  "A corrupt debug file gets a warning"
5ced33e
+gdb_test_multiple "file $existing_binfile" "$test" {
5ced33e
+    -re "warning:.*mismatch.*" {
5ced33e
+	pass "$test"
5ced33e
+    }
5ced33e
+    -re ".y or n. " {
5ced33e
+	send_gdb "y\n"
5ced33e
+	exp_continue
5ced33e
+    }
5ced33e
+}
8b1b3fd
Index: gdb-6.8/gdb/testsuite/gdb.base/sepdebug2.c
aefb0e1
===================================================================
aefb0e1
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
8b1b3fd
+++ gdb-6.8/gdb/testsuite/gdb.base/sepdebug2.c	2008-07-14 10:26:19.000000000 +0200
5ced33e
@@ -0,0 +1,5 @@
5ced33e
+int
5ced33e
+main (int argc, char *argv[], char *envp[])
5ced33e
+{
5ced33e
+  return 0;
5ced33e
+}