| 1 | # Copyright 2003 Free Software Foundation, Inc. |
| 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 2 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, write to the Free Software |
| 15 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 16 | |
| 17 | # Test for PR gdb/1056. |
| 18 | # 2003-10-18 Michael Chastain <mec@shout.net> |
| 19 | |
| 20 | if $tracelevel then { |
| 21 | strace $tracelevel |
| 22 | } |
| 23 | |
| 24 | # test SIGFPE (such as division by 0) inside gdb itself |
| 25 | |
| 26 | set prms_id 0 |
| 27 | set bug_id 0 |
| 28 | |
| 29 | gdb_start |
| 30 | |
| 31 | # When SIGFPE happens, the operating system may restart the |
| 32 | # offending instruction after the signal handler returns, |
| 33 | # rather than proceeding to the next instruction. This happens |
| 34 | # on i686-pc-linux-gnu with a linux kernel. If gdb has a naive |
| 35 | # signal handler that just returns, then it will restart the |
| 36 | # broken instruction and gdb gets an endless stream of SIGFPE's |
| 37 | # and makes no progress. |
| 38 | # |
| 39 | # On a broken gdb this test will just time out. |
| 40 | |
| 41 | gdb_test_multiple "print 1/0" "" { |
| 42 | -re ".*$gdb_prompt $" { |
| 43 | pass "print 1/0" |
| 44 | } |
| 45 | timeout { |
| 46 | kfail "gdb/1056" "print 1/0" |
| 47 | } |
| 48 | } |