return -1
}
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
execute_anywhere "rm -f ${binfile}.ci"
if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
- perror "Couldn't make ${testfile}.ci file"
+ perror "Couldn't make ${binfile}.ci file"
return -1
}
+source ${binfile}.ci
# Create a core file named "corefile" rather than just "core", to
# avoid problems with sys admin types that like to regularly prune all
if { $found == 0 } {
# The braindamaged HPUX shell quits after the ulimit -c above
# without executing ${binfile}. So we try again without the
- # ulimit here if we didn't fine a core file above.
+ # ulimit here if we didn't find a core file above.
catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\""
foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
set exec_output [execute_anywhere "ls $i"]
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
+verbose "Timeout is now $timeout seconds" 2
eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile"
expect {
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$prompt $" {
timeout { fail "(timeout) starting with -core" }
}
set timeout $oldtimeout
-
+verbose "Timeout is now $timeout seconds" 2
# Now restart normally.
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
-source gdb.base/coremaker.ci
-
# Test basic corefile recognition via core-file command.
send "core-file $objdir/$subdir/corefile\n"
gdb_test "print coremaker_bss" "\\\$$decimal = 10"
gdb_test "print coremaker_ro" "\\\$$decimal = 201"
-# This fails under at least Unixware (i*86-*-sysv4*) and linux.
-setup_xfail "i*86-*-*"
+setup_xfail "i*86-*-sysv4*" "i*86-*-linux*" "m68*-*-hpux*"
+if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
gdb_test "print func2::coremaker_local" "\\\$$decimal = {0, 1, 2, 3, 4}"
# Somehow we better test the ability to read the registers out of the core
# file correctly. I don't think the other tests do this.
# Haven't investigated this xfail
-# This fails under at least Unixware (i*86-*-sysv4*) and linux.
-setup_xfail "m68k-*-hpux*" "i*86-*-*"
+setup_xfail "m68k-*-hpux*" "i*86-*-sysv4*" "i*86-*-linux*"
gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp"
+# Test ability to read mmap'd data
+
+gdb_test "x/8bd buf1" ".*:.*0.*1.*2.*3.*4.*5.*6.*7" "accessing original mmap data in core file"
+setup_xfail "*-*-sunos*" "*-*-ultrix*" "*-*-aix*"
+send "x/8bd buf2\n"
+expect {
+ -re ".*:.*0.*1.*2.*3.*4.*5.*6.*7.*$prompt $" {
+ pass "accessing mmapped data in core file"
+ }
+ -re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*" {
+ fail "accessing mmapped data (mapping failed at runtime)"
+ }
+ -re "0x.*:.*Cannot access memory at address 0x.*" {
+ fail "accessing mmapped data (mapping address not found in core file)"
+ }
+ -re ".*$prompt $" {
+ fail "accessing mmapped data (incorrect data found in core file)"
+ }
+ timeout {
+ fail "accessing mmapped data (timeout)"
+ }
+}
+
# test reinit_frame_cache
gdb_load ${binfile}