Index: gdb-6.8/gdb/testsuite/gdb.base/sepdebug.exp =================================================================== --- gdb-6.8.orig/gdb/testsuite/gdb.base/sepdebug.exp 2008-02-26 09:14:11.000000000 +0100 +++ gdb-6.8/gdb/testsuite/gdb.base/sepdebug.exp 2008-07-14 10:26:19.000000000 +0200 @@ -981,3 +981,40 @@ if ![string compare $build_id_debug_file # Spare debug files may confuse testsuite runs in the future. remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}" } + + +# 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.8/gdb/testsuite/gdb.base/sepdebug2.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-6.8/gdb/testsuite/gdb.base/sepdebug2.c 2008-07-14 10:26:19.000000000 +0200 @@ -0,0 +1,5 @@ +int +main (int argc, char *argv[], char *envp[]) +{ + return 0; +}