From 7a6e913309d24854fdff990fe255dc2b0d67d283 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Fri, 1 Nov 1996 20:00:26 +0000 Subject: [PATCH] * gdb.base/coremaker.c: Add code to mmap some data so we can check that it ends up in the core file. * gdb.base/corefile.exp: Add test to read mmapped data from core file. --- gdb/testsuite/ChangeLog | 7 +++++ gdb/testsuite/gdb.base/corefile.exp | 42 ++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 5f1d2bc22fa..cc4f882787d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +Fri Nov 1 11:56:09 1996 Fred Fish + + * gdb.base/coremaker.c: Add code to mmap some data so we + can check that it ends up in the core file. + * gdb.base/corefile.exp: Add test to read mmapped data + from core file. + start-sanitize-m32r Wed Oct 30 18:19:16 1996 Michael Snyder diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp index c81537de37b..1ca0ca4dc03 100644 --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp @@ -39,11 +39,14 @@ if { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } { 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 @@ -70,7 +73,7 @@ foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfi 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"] @@ -111,6 +114,7 @@ if $verbose>1 then { 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 $" { @@ -153,7 +157,7 @@ expect { timeout { fail "(timeout) starting with -core" } } set timeout $oldtimeout - +verbose "Timeout is now $timeout seconds" 2 # Now restart normally. @@ -162,8 +166,6 @@ gdb_start 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" @@ -187,18 +189,40 @@ gdb_test "print coremaker_data" "\\\$$decimal = 202" 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} -- 2.30.2