xref: /openbsd-src/gnu/usr.bin/binutils/gdb/testsuite/gdb.base/gdb1056.exp (revision b725ae7711052a2233e31a66fefb8a752c388d7a)
1*b725ae77Skettenis# Copyright 2003 Free Software Foundation, Inc.
2*b725ae77Skettenis
3*b725ae77Skettenis# This program is free software; you can redistribute it and/or modify
4*b725ae77Skettenis# it under the terms of the GNU General Public License as published by
5*b725ae77Skettenis# the Free Software Foundation; either version 2 of the License, or
6*b725ae77Skettenis# (at your option) any later version.
7*b725ae77Skettenis#
8*b725ae77Skettenis# This program is distributed in the hope that it will be useful,
9*b725ae77Skettenis# but WITHOUT ANY WARRANTY; without even the implied warranty of
10*b725ae77Skettenis# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11*b725ae77Skettenis# GNU General Public License for more details.
12*b725ae77Skettenis#
13*b725ae77Skettenis# You should have received a copy of the GNU General Public License
14*b725ae77Skettenis# along with this program; if not, write to the Free Software
15*b725ae77Skettenis# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16*b725ae77Skettenis
17*b725ae77Skettenis# Test for PR gdb/1056.
18*b725ae77Skettenis# 2003-10-18  Michael Chastain <mec@shout.net>
19*b725ae77Skettenis
20*b725ae77Skettenisif $tracelevel then {
21*b725ae77Skettenis    strace $tracelevel
22*b725ae77Skettenis}
23*b725ae77Skettenis
24*b725ae77Skettenis# test SIGFPE (such as division by 0) inside gdb itself
25*b725ae77Skettenis
26*b725ae77Skettenisset prms_id 0
27*b725ae77Skettenisset bug_id 0
28*b725ae77Skettenis
29*b725ae77Skettenisgdb_start
30*b725ae77Skettenis
31*b725ae77Skettenis# When SIGFPE happens, the operating system may restart the
32*b725ae77Skettenis# offending instruction after the signal handler returns,
33*b725ae77Skettenis# rather than proceeding to the next instruction.  This happens
34*b725ae77Skettenis# on i686-pc-linux-gnu with a linux kernel.  If gdb has a naive
35*b725ae77Skettenis# signal handler that just returns, then it will restart the
36*b725ae77Skettenis# broken instruction and gdb gets an endless stream of SIGFPE's
37*b725ae77Skettenis# and makes no progress.
38*b725ae77Skettenis#
39*b725ae77Skettenis# On a broken gdb this test will just time out.
40*b725ae77Skettenis
41*b725ae77Skettenisgdb_test_multiple "print 1/0" "" {
42*b725ae77Skettenis    -re ".*$gdb_prompt $" {
43*b725ae77Skettenis	pass "print 1/0"
44*b725ae77Skettenis    }
45*b725ae77Skettenis    timeout {
46*b725ae77Skettenis	kfail "gdb/1056" "print 1/0"
47*b725ae77Skettenis    }
48*b725ae77Skettenis}
49