mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 04:00:07 +08:00
* 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.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
Fri Nov 1 11:56:09 1996 Fred Fish <fnf@cygnus.com>
|
||||||
|
|
||||||
|
* 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
|
start-sanitize-m32r
|
||||||
Wed Oct 30 18:19:16 1996 Michael Snyder <msnyder@cleaver.cygnus.com>
|
Wed Oct 30 18:19:16 1996 Michael Snyder <msnyder@cleaver.cygnus.com>
|
||||||
|
|
||||||
|
@ -39,11 +39,14 @@ if { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } {
|
|||||||
return -1
|
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"
|
execute_anywhere "rm -f ${binfile}.ci"
|
||||||
if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${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
|
return -1
|
||||||
}
|
}
|
||||||
|
source ${binfile}.ci
|
||||||
|
|
||||||
# Create a core file named "corefile" rather than just "core", to
|
# Create a core file named "corefile" rather than just "core", to
|
||||||
# avoid problems with sys admin types that like to regularly prune all
|
# 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 } {
|
if { $found == 0 } {
|
||||||
# The braindamaged HPUX shell quits after the ulimit -c above
|
# The braindamaged HPUX shell quits after the ulimit -c above
|
||||||
# without executing ${binfile}. So we try again without the
|
# 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\""
|
catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\""
|
||||||
foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
|
foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
|
||||||
set exec_output [execute_anywhere "ls $i"]
|
set exec_output [execute_anywhere "ls $i"]
|
||||||
@ -111,6 +114,7 @@ if $verbose>1 then {
|
|||||||
|
|
||||||
set oldtimeout $timeout
|
set oldtimeout $timeout
|
||||||
set timeout [expr "$timeout + 60"]
|
set timeout [expr "$timeout + 60"]
|
||||||
|
verbose "Timeout is now $timeout seconds" 2
|
||||||
eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile"
|
eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile"
|
||||||
expect {
|
expect {
|
||||||
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$prompt $" {
|
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$prompt $" {
|
||||||
@ -153,7 +157,7 @@ expect {
|
|||||||
timeout { fail "(timeout) starting with -core" }
|
timeout { fail "(timeout) starting with -core" }
|
||||||
}
|
}
|
||||||
set timeout $oldtimeout
|
set timeout $oldtimeout
|
||||||
|
verbose "Timeout is now $timeout seconds" 2
|
||||||
|
|
||||||
# Now restart normally.
|
# Now restart normally.
|
||||||
|
|
||||||
@ -162,8 +166,6 @@ gdb_start
|
|||||||
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_reinitialize_dir $srcdir/$subdir
|
||||||
gdb_load ${binfile}
|
gdb_load ${binfile}
|
||||||
|
|
||||||
source gdb.base/coremaker.ci
|
|
||||||
|
|
||||||
# Test basic corefile recognition via core-file command.
|
# Test basic corefile recognition via core-file command.
|
||||||
|
|
||||||
send "core-file $objdir/$subdir/corefile\n"
|
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_bss" "\\\$$decimal = 10"
|
||||||
gdb_test "print coremaker_ro" "\\\$$decimal = 201"
|
gdb_test "print coremaker_ro" "\\\$$decimal = 201"
|
||||||
|
|
||||||
# This fails under at least Unixware (i*86-*-sysv4*) and linux.
|
setup_xfail "i*86-*-sysv4*" "i*86-*-linux*" "m68*-*-hpux*"
|
||||||
setup_xfail "i*86-*-*"
|
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
|
||||||
gdb_test "print func2::coremaker_local" "\\\$$decimal = {0, 1, 2, 3, 4}"
|
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
|
# 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.
|
# file correctly. I don't think the other tests do this.
|
||||||
|
|
||||||
# Haven't investigated this xfail
|
# Haven't investigated this xfail
|
||||||
# This fails under at least Unixware (i*86-*-sysv4*) and linux.
|
setup_xfail "m68k-*-hpux*" "i*86-*-sysv4*" "i*86-*-linux*"
|
||||||
setup_xfail "m68k-*-hpux*" "i*86-*-*"
|
|
||||||
gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp"
|
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
|
# test reinit_frame_cache
|
||||||
|
|
||||||
gdb_load ${binfile}
|
gdb_load ${binfile}
|
||||||
|
Reference in New Issue
Block a user