X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Ftestsuite%2Fgdb.base%2Fbigcore.exp;h=93a6faf62e10a49ae5100f5c67fa0fe4d998f390;hb=2cd8cc0b66ca297bce4d08e4f712f86d9f1a2fb6;hp=db92cc42d9617cd6d6228f9089994a968b7077c4;hpb=b60f089831eca7b76afeb3c1d95369f8abcdcc98;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/testsuite/gdb.base/bigcore.exp b/gdb/testsuite/gdb.base/bigcore.exp index db92cc42d9..93a6faf62e 100644 --- a/gdb/testsuite/gdb.base/bigcore.exp +++ b/gdb/testsuite/gdb.base/bigcore.exp @@ -1,83 +1,66 @@ -# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2005 -# Free Software Foundation, Inc. +# Copyright 1992-2018 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu +# along with this program. If not, see . # This file is based on corefile.exp which was written by Fred # Fish. (fnf@cygnus.com) -if $tracelevel then { - strace $tracelevel -} - -set prms_id 0 -set bug_id 0 # Are we on a target board? As of 2004-02-12, GDB didn't have a # mechanism that would let it efficiently access a remote corefile. if ![isnative] then { - untested "Remote system" + untested "remote system" return } # Can the system run this test (in particular support sparse # corefiles)? On systems that lack sparse corefile support this test -# consumes too many resources - gigabytes worth of disk space and and +# consumes too many resources - gigabytes worth of disk space and # I/O bandwith. if { [istarget "*-*-*bsd*"] - || [istarget "*-*-hpux*"] || [istarget "*-*-solaris*"] + || [istarget "*-*-darwin*"] || [istarget "*-*-cygwin*"] } { - untested "Kernel lacks sparse corefile support (PR gdb/1551)" - return -} - -# This testcase causes too much stress (in terms of memory usage) -# on certain systems... -if { [istarget "*-*-*irix*"] } { - untested "Testcase too stressful for this system" + untested "kernel lacks sparse corefile support (PR gdb/1551)" return } -set testfile "bigcore" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -set corefile ${objdir}/${subdir}/${testfile}.corefile +standard_testfile .c +set corefile [standard_output_file ${binfile}.corefile] if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested bigcore.exp + untested "failed to compile" return -1 } # Run GDB on the bigcore program up-to where it will dump core. -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} -gdb_test "set print sevenbit-strings" "" \ - "set print sevenbit-strings; ${testfile}" -gdb_test "set width 0" "" \ - "set width 0; ${testfile}" -if { ![runto_main] } then { - gdb_suppress_tests; +clean_restart ${binfile} +gdb_test_no_output "set print sevenbit-strings" +gdb_test_no_output "set width 0" + +# Get the core into the output directory. +if {![is_remote host]} { + gdb_test "cd [file dirname $corefile]" "Working directory .*" \ + "cd to test directory" +} + +if ![runto_main] then { + fail "can't run to main" + return 0 } set print_core_line [gdb_get_line_number "Dump core"] gdb_test "tbreak $print_core_line" @@ -99,7 +82,7 @@ proc extract_heap { dir } { } -re " = \\(struct list \\*\\) (0x\[0-9a-f\]*).*$gdb_prompt $" { set heap [concat $heap $expect_out(1,string)] - if { $lim >= 50 } { + if { $lim >= 200 } { pass "$test (stop at $lim)" } else { incr lim @@ -114,14 +97,14 @@ proc extract_heap { dir } { fail "$test (timeout)" } } - return $heap; + return $heap } set next_heap [extract_heap next] set prev_heap [extract_heap prev] # Save the total allocated size within GDB so that we can check # the core size later. -gdb_test "set \$bytes_allocated = bytes_allocated" "" "save heap size" +gdb_test_no_output "set \$bytes_allocated = bytes_allocated" "save heap size" # Now create a core dump @@ -150,11 +133,12 @@ gdb_test_multiple "info program" $test { set oldtimeout $timeout set timeout 600 gdb_test "signal SIGABRT" "Program terminated with signal SIGABRT, .*" +set timeout $oldtimeout # Find the corefile set file "" foreach pat [list core.${inferior_pid} ${testfile}.core core] { - set names [glob -nocomplain $pat] + set names [glob -nocomplain [standard_output_file $pat]] if {[llength $names] == 1} { set file [lindex $names 0] remote_exec build "mv $file $corefile" @@ -163,7 +147,7 @@ foreach pat [list core.${inferior_pid} ${testfile}.core core] { } if { $file == "" } { - untested "Can't generate a core file" + untested "can't generate a core file" return 0 } @@ -203,7 +187,9 @@ if {! $core_ok} { # Now load up that core file set test "load corefile" -gdb_test_multiple "core $corefile" "$test" { +# We use [file tail] because gdb is still "cd"d to the +# output directory. +gdb_test_multiple "core [file tail $corefile]" "$test" { -re "A program is being debugged already. Kill it. .y or n. " { send_gdb "y\n" exp_continue