Index: gdb/testsuite/gdb.base/corefile.exp |
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp |
index b9fc7dca94fdb9fe2afdfa0c62b71f2eaf47a4b7..72c7a4a1c4c654f892cf545b7eaee987a63a1dfc 100644 |
--- a/gdb/testsuite/gdb.base/corefile.exp |
+++ b/gdb/testsuite/gdb.base/corefile.exp |
@@ -1,4 +1,4 @@ |
-# Copyright 1992-2000, 2007-2012 Free Software Foundation, Inc. |
+# Copyright 1992-2013 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 |
@@ -21,18 +21,17 @@ if ![isnative] then { |
return |
} |
-set testfile "coremaker" |
-set srcfile ${testfile}.c |
-set binfile ${objdir}/${subdir}/${testfile} |
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
- untested corefile.exp |
- return -1 |
-} |
+standard_testfile coremaker.c |
# Create and source the file that provides information about the compiler |
# used to compile the test case. |
if [get_compiler_info] { |
- return -1; |
+ return -1 |
+} |
+ |
+if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { |
+ untested $testfile.exp |
+ return -1 |
} |
set corefile [core_find $binfile {coremmap.data}] |
@@ -49,7 +48,7 @@ if {$corefile == ""} { |
# |
# 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 |
+# the corefile executable, at about 80 chars. For this case, consider |
# it a pass, but note that the program name is bad. |
gdb_exit |
@@ -65,7 +64,7 @@ expect { |
-re "Couldn't find .* registers in core file.*$gdb_prompt $" { |
fail "args: -core=[file tail $corefile] (couldn't find regs)" |
} |
- -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { |
+ -re "Core was generated by .*corefile.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { |
pass "args: -core=[file tail $corefile]" |
} |
-re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { |
@@ -84,16 +83,16 @@ expect { |
# See previous comments above, they are still applicable. |
# |
-close; |
+close |
if $verbose>1 then { |
send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$corefile\n" |
} |
-eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$corefile"; |
+eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$corefile" |
expect { |
- -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { |
+ -re "Core was generated by .*corefile.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { |
pass "args: execfile -core=[file tail $corefile]" |
} |
-re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { |
@@ -108,7 +107,7 @@ expect { |
set timeout $oldtimeout |
verbose "Timeout is now $timeout seconds" 2 |
-close; |
+close |
# Now restart normally. |
@@ -122,9 +121,9 @@ gdb_test_multiple "core-file $corefile" "core-file command" { |
-re ".* program is being debugged already.*y or n. $" { |
# gdb_load may connect us to a gdbserver. |
send_gdb "y\n" |
- exp_continue; |
+ exp_continue |
} |
- -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { |
+ -re "Core was generated by .*corefile.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { |
pass "core-file command" |
} |
-re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { |
@@ -143,6 +142,16 @@ gdb_test "print coremaker_ro" "\\\$$decimal = 201" |
gdb_test "print func2::coremaker_local" "\\\$$decimal = \\{0, 1, 2, 3, 4\\}" |
+# Test the presence and the correct values of $_exitsignal and |
+# $_exitcode variables. The corefile is generated with a SIGABRT, |
+# which is "6" in the Linux kernel. |
+ |
+gdb_test "print \$_exitsignal" " = 6" \ |
+ "\$_exitsignal prints SIGABRT (6)" |
+ |
+gdb_test "print \$_exitcode" " = void" \ |
+ "\$_exitcode is void" |
+ |
# 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. |
@@ -228,7 +237,7 @@ gdb_exit |
if ![is_remote target] { |
set test "attach: spawn sleep" |
- set res [remote_spawn host "$binfile sleep"]; |
+ set res [remote_spawn host "$binfile sleep"] |
if { $res < 0 || $res == "" } { |
fail $test |
return |
@@ -256,3 +265,19 @@ if ![is_remote target] { |
gdb_exit |
} |
+ |
+# Test warning-free core file load. E.g., a Linux vDSO used to |
+# trigger this warning: |
+# warning: Can't read pathname for load map: Input/output error. |
+ |
+clean_restart ${testfile} |
+ |
+set test "core-file warning-free" |
+gdb_test_multiple "core-file $corefile" $test { |
+ -re "warning: .*\r\n.*\r\n$gdb_prompt $" { |
+ fail $test |
+ } |
+ -re "\r\n$gdb_prompt $" { |
+ pass $test |
+ } |
+} |