Update
[gdb.git] / gdb / testsuite / gdb.base / siginfo-addr.exp
blob259dd0193647f982da99baae17bdcb2736788138
1 # Copyright 2004, 2007, 2008 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 # The program siginfo-addr.c arranges for a signal handler registered
18 # using sigaction's sa_sigaction / SA_SIGINFO to be called with
19 # si_addr filled in.
21 # This test confirms that the si_addr value is correct rather than
22 # having been corrupted when GDB passed the signal on to the handler.
24 if [target_info exists gdb,nosignals] {
25     verbose "Skipping siginfo-addr.exp because of nosignals."
26     continue
29 if [gdb_skip_stdio_test "siginfo-addr.exp"] {
30     continue
33 if $tracelevel then {
34     strace $tracelevel
37 set prms_id 0
38 set bug_id 0
40 set testfile siginfo-addr
41 set srcfile ${testfile}.c
42 set binfile ${objdir}/${subdir}/${testfile}
43 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
44     untested "Couldn't compile ${srcfile}.c"
45     return -1
48 # get things started
49 gdb_exit
50 gdb_start
51 gdb_reinitialize_dir $srcdir/$subdir
52 gdb_load ${binfile}
54 gdb_test "display/i \$pc"
56 # Advance to main
57 if { ![runto_main] } then {
58     gdb_suppress_tests;
61 # Run to the signal.
62 gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal"
64 # Check for correct si_addr.
65 set test "program exit"
66 gdb_test_multiple "continue" "${test}" {
67     -re "Correct si_addr" {
68         pass "si_addr value"
69     }
70     -re "Got si_addr" {
71         fail "si_addr value"
72     }