gdb/gdb-6.3-test-sepcrc-2005040...

56 lines
1.9 KiB
Diff

Index: gdb-6.6/gdb/testsuite/gdb.base/sepdebug.exp
===================================================================
--- gdb-6.6.orig/gdb/testsuite/gdb.base/sepdebug.exp 2006-10-17 22:17:45.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.base/sepdebug.exp 2007-01-20 18:39:26.000000000 +0100
@@ -953,3 +953,40 @@ if [istarget "*-*-vxworks*"] {
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"
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+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
+ }
+}
Index: gdb-6.6/gdb/testsuite/gdb.base/sepdebug2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.6/gdb/testsuite/gdb.base/sepdebug2.c 2007-01-20 18:41:35.000000000 +0100
@@ -0,0 +1,5 @@
+int
+main (int argc, char *argv[], char *envp[])
+{
+ return 0;
+}