From 89e6c70d5330612f3963c11f58c0a7e116c059fa Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Sat, 30 Dec 1995 22:27:24 +0000 Subject: [PATCH] * lib/gdb.exp (default_gdb_start): Fix typo. * gdb.base/corefile.exp: Allow "Core was generated by ..." messages to not include the full program name that caused the core dump since some systems (such as solaris) apparently truncate this path to about 80 characters. When generating a core file first try increasing the core file size limit to unlimited since some systems may default it to zero, and it is harmless to try it. Move the test for failing to generate a core file to where it will actually get executed. * gdb.c++/templates.exp (test_ptype_of_templates): Accept new gdb result from g++ debug info improvements and make old pattern obsolescent. Also account for size_t differences (may be int or long). * gdb.base/a1-selftest.exp (test_with_self): Check for case where initialization before function call is placed in the delay slot and thus appears to be skipped over by commands such as "next". --- gdb/testsuite/ChangeLog | 19 ++++++++ gdb/testsuite/gdb.base/a1-selftest.exp | 41 ++++++++++------ gdb/testsuite/gdb.base/corefile.exp | 67 ++++++++++++++++---------- 3 files changed, 86 insertions(+), 41 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e28fa8c70df..c69a7b37e0a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,22 @@ +Sat Dec 30 12:59:12 1995 Fred Fish + + * lib/gdb.exp (default_gdb_start): Fix typo. + * gdb.base/corefile.exp: Allow "Core was generated by ..." + messages to not include the full program name that caused + the core dump since some systems (such as solaris) apparently + truncate this path to about 80 characters. + When generating a core file first try increasing the core file + size limit to unlimited since some systems may default it to + zero, and it is harmless to try it. Move the test for failing + to generate a core file to where it will actually get executed. + * gdb.c++/templates.exp (test_ptype_of_templates): Accept + new gdb result from g++ debug info improvements and make old + pattern obsolescent. Also account for size_t differences + (may be int or long). + * gdb.base/a1-selftest.exp (test_with_self): Check for case where + initialization before function call is placed in the delay slot + and thus appears to be skipped over by commands such as "next". + Fri Dec 29 16:09:20 1995 Stan Shebs * gdb.base/a1-selftest.exp (test_with_self): Run without windows. diff --git a/gdb/testsuite/gdb.base/a1-selftest.exp b/gdb/testsuite/gdb.base/a1-selftest.exp index a5df025a141..ec6fff25ee5 100644 --- a/gdb/testsuite/gdb.base/a1-selftest.exp +++ b/gdb/testsuite/gdb.base/a1-selftest.exp @@ -196,12 +196,17 @@ proc test_with_self {} { } } + set ttyarg_in_delay_slot 0 set description "step over cdarg initialization" send "step\n" expect { -re "char \[*\]ttyarg = NULL;.*$prompt $" { pass "$description" } + -re ".*time_at_startup = get_run_time .*$prompt $" { + pass "$description" + set ttyarg_in_delay_slot 1 + } -re ".*No such file or directory.\r\n$prompt $" { pass "$description (no source available)" } @@ -217,22 +222,26 @@ proc test_with_self {} { } set description "step over ttyarg initialization" - send "step\n" - expect { - -re ".*time_at_startup = get_run_time .*$prompt $" { - pass "$description" - } - -re ".*No such file or directory.\r\n$prompt $" { - pass "$description (no source available)" - } - -re ".*A file or directory .* does not exist..\r\n$prompt $" { - pass "$description (no source available)" - } - -re ".*$prompt $" { - fail "$description" - } - timeout { - fail "$description (timeout)" + if $ttyarg_in_delay_slot==1 then { + pass "$description (in delay slot)" + } else { + send "step\n" + expect { + -re ".*time_at_startup = get_run_time .*$prompt $" { + pass "$description" + } + -re ".*No such file or directory.\r\n$prompt $" { + pass "$description (no source available)" + } + -re ".*A file or directory .* does not exist..\r\n$prompt $" { + pass "$description (no source available)" + } + -re ".*$prompt $" { + fail "$description" + } + timeout { + fail "$description (timeout)" + } } } diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp index f8799d6ddb1..1c30e0c203c 100644 --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp @@ -32,9 +32,9 @@ if ![isnative] then { } set testfile "coremaker" -set srcfile ${srcdir}/${subdir}/${testfile}.c +set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -if { [compile "${srcfile} -g -o ${binfile}"] != "" } { +if { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } { perror "Couldn't compile ${srcfile}" return -1 } @@ -50,11 +50,15 @@ if ![file exists ${objdir}/${subdir}/corefile] then { # avoid problems with sys admin types that like to regularly prune all # files named "core" from the system. # + # Arbitrarily try setting the core size limit to "unlimited" since + # this does not hurt on systems where the command does not work and + # allows us to generate a core on systems where it does. + # # Some systems append "core" to the name of the program; others append # the name of the program to "core". set found 0 - catch "system \"cd ${objdir}/${subdir}; ${binfile}\"" - # execute_anywhere "./${binfile}" + catch "system \"cd ${objdir}/${subdir}; ulimit -c unlimited; ${binfile}\"" + # execute_anywhere "${binfile}" foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" { set exec_output [execute_anywhere "ls $i"] if [ regexp "No such file or directory" ${exec_output} ] { @@ -63,10 +67,10 @@ if ![file exists ${objdir}/${subdir}/corefile] then { execute_anywhere "mv $i ${objdir}/${subdir}/corefile" set found 1 } - if { $found == 0 } { - warning "can't generate a core file - core tests suppressed - check ulimit -c" - return 0 - } + } + if { $found == 0 } { + warning "can't generate a core file - core tests suppressed - check ulimit -c" + return 0 } } @@ -81,6 +85,10 @@ if ![file exists ${objdir}/${subdir}/corefile] then { # grumbles about (said grumbling currently being ignored in gdb_start). # **FIXME** # +# Another problem is that on some systems (solaris for example), there +# is apparently a limit on the length of a fully specified path to +# the coremaker executable, at about 80 chars. For this case, consider +# it a pass, but note that the program name is bad. gdb_exit if $verbose>1 then { @@ -91,11 +99,14 @@ set oldtimeout $timeout set timeout [expr "$timeout + 60"] eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile" expect { - -re "Core was generated by .*coremaker.*\r -\#0 .*\(\).*\r -$prompt $" { pass "args: -core=corefile" } - -re ".*$prompt $" { fail "args: -core=corefile" } - timeout { fail "(timeout) starting with -core" } + -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$prompt $" { + pass "args: -core=corefile" + } + -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$prompt $" { + pass "args: -core=corefile (with bad program name)" + } + -re ".*$prompt $" { fail "args: -core=corefile" } + timeout { fail "(timeout) starting with -core" } } @@ -106,17 +117,20 @@ $prompt $" { pass "args: -core=corefile" } gdb_exit if $verbose>1 then { - send_user "Spawning $GDB -nw $GDBFLAGS $objdir/$subdir/$binfile -core=$objdir/$subdir/corefile\n" + send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n" } -spawn $GDB -nw $GDBFLAGS $objdir/$subdir/$binfile -core=$objdir/$subdir/corefile +spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile expect { - -re "Core was generated by .*coremaker.*\r -\#0 .*\(\).*\r -$prompt $" { pass "args: execfile -core=corefile" } - -re ".*$prompt $" { fail "args: execfile -core=corefile" } - timeout { fail "(timeout) starting with -core" } + -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$prompt $" { + pass "args: execfile -core=corefile" + } + -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$prompt $" { + pass "args: execfile -core=corefile (with bad program name)" + } + -re ".*$prompt $" { fail "args: execfile -core=corefile" } + timeout { fail "(timeout) starting with -core" } } set timeout $oldtimeout @@ -134,11 +148,14 @@ source gdb.base/coremaker.ci send "core-file $objdir/$subdir/corefile\n" expect { - -re "Core was generated by .*coremaker.*\r -\#0 .*\(\).*\r -$prompt $" { pass "core-file command" } - -re ".*$prompt $" { fail "core-file command" } - timeout { fail "(timeout) core-file command" } + -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$prompt $" { + pass "core-file command" + } + -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$prompt $" { + pass "core-file command (with bad program name)" + } + -re ".*$prompt $" { fail "core-file command" } + timeout { fail "(timeout) core-file command" } } # Test correct mapping of corefile sections by printing some variables. -- 2.30.2