gdb/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / siginfo-addr.exp
CommitLineData
7b6bb8da 1# Copyright 2004, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
c162e8c9
JM
2
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.
7#
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.
12#
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/>.
15
16
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.
20
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.
23
24if [target_info exists gdb,nosignals] {
25 verbose "Skipping siginfo-addr.exp because of nosignals."
26 continue
27}
28
29if [gdb_skip_stdio_test "siginfo-addr.exp"] {
30 continue
31}
32
33if $tracelevel then {
34 strace $tracelevel
35}
36
c162e8c9
JM
37
38set testfile siginfo-addr
39set srcfile ${testfile}.c
40set binfile ${objdir}/${subdir}/${testfile}
41if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
42 untested "Couldn't compile ${srcfile}.c"
43 return -1
44}
45
46# get things started
47gdb_exit
48gdb_start
49gdb_reinitialize_dir $srcdir/$subdir
50gdb_load ${binfile}
51
52gdb_test "display/i \$pc"
53
54# Advance to main
55if { ![runto_main] } then {
56 gdb_suppress_tests;
57}
58
59# Run to the signal.
60gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal"
61
62# Check for correct si_addr.
63set test "program exit"
64gdb_test_multiple "continue" "${test}" {
65 -re "Correct si_addr" {
66 pass "si_addr value"
67 }
68 -re "Got si_addr" {
69 fail "si_addr value"
70 }
71}
This page took 0.353916 seconds and 4 git commands to generate.