Commit | Line | Data |
---|---|---|
7b6bb8da | 1 | # Copyright 2009, 2010, 2011 Free Software Foundation, Inc. |
186c406b TT |
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 | if $tracelevel then { | |
17 | strace $tracelevel | |
18 | } | |
19 | ||
20 | load_lib "java.exp" | |
21 | ||
22 | set testfile "jnpe" | |
23 | set srcfile ${testfile}.java | |
24 | set binfile ${objdir}/${subdir}/${testfile} | |
25 | if { [compile_java_from_source ${srcdir}/$subdir/${srcfile} ${binfile} "-g"] != "" } { | |
26 | untested "Couldn't compile ${srcdir}/$subdir/${srcfile}" | |
27 | return -1 | |
28 | } | |
29 | ||
30 | # Start with a fresh gdb. | |
31 | ||
32 | clean_restart $testfile | |
33 | ||
34 | set line [gdb_get_line_number "break here" $testfile.java] | |
35 | if ![runto "$testfile.java:$line"] then { | |
36 | perror "couldn't run to jnpe.main" | |
37 | continue | |
38 | } | |
39 | ||
40 | # See whether we have the needed unwinder hooks. | |
41 | set ok 1 | |
42 | gdb_test_multiple "print _Unwind_DebugHook" "check for unwinder hook in java" { | |
43 | -re "= .*_Unwind_DebugHook.*\r\n$gdb_prompt $" { | |
44 | pass "check for unwinder hook in java" | |
45 | } | |
46 | -re "No symbol .* in current context.?\r\n$gdb_prompt $" { | |
47 | # Pass the test so we don't get bogus fails in the results. | |
48 | setup_xfail *-*-* | |
49 | fail "check for unwinder hook in java" | |
50 | set ok 0 | |
51 | } | |
52 | } | |
53 | if {!$ok} { | |
54 | unsupported "jnpe.exp could not find _Unwind_DebugHook" | |
55 | return -1 | |
56 | } | |
57 | ||
58 | gdb_test "handle SIGSEGV nostop noprint" \ | |
59 | "SIGSEGV.*fault" \ | |
60 | "disable SIGSEGV for next-over-NPE" | |
61 | ||
62 | # The line where we stop differs according to gcj; just check that we | |
63 | # did not already execute the catch point. This is done in a somewhat | |
64 | # funny way due to other gcj debuginfo oddities that don't | |
65 | # meaningfully affect the user's experience. | |
66 | ||
67 | gdb_test "next" \ | |
68 | ".*" \ | |
69 | "next over NPE" | |
70 | ||
71 | set line [gdb_get_line_number "stop point"] | |
72 | gdb_breakpoint $line | |
73 | gdb_test "continue" "Continuing.\[\r\n\]*success\[\r\n\]*Breakpoint .*:$line\[\r\n\]*.*// stop point\[\r\n\]*" \ | |
74 | "continue to success for next-over-NPE" |