1 # Copyright 2000-2014 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/>.
16 # This file was based on jmisc.exp which in turn was written by
17 # Anthony Green. (green@redhat.com)
21 if { [skip_java_tests] } { continue }
23 standard_testfile .java
24 if {[compile_java_from_source $srcdir/$subdir/$srcfile $binfile "-g"] != ""} {
29 # Start with a fresh gdb.
33 gdb_reinitialize_dir $srcdir/$subdir
35 gdb_test "set print sevenbit-strings" ".*"
37 # Check that plain old "main" works. The load should both set the
38 # language to java and (since --main=jmain), some how set the scope to
41 # Where the breakpoint should always land
43 set bpmain "Breakpoint .* file .*jmain.java, line 5\."
45 # Where GCC PR 16439 puts the breakpoint.
46 set earlybpmain "Breakpoint .* file .*jmain.java, line 4\."
49 setup_kfail java/1567 *-*-*
50 gdb_test "break main" "${bpmain}"
52 # Check that an unqualified "main" works.
55 setup_kfail java/1565 *-*-*
56 gdb_test "break jmain.main" "${bpmain}"
58 # Check that a fully qualified "main" works.
60 set cmd "break ${testfile}.main(java.lang.String\[\])"
62 gdb_test_multiple $cmd $msg {
63 -re "${bpmain}\r\n$gdb_prompt $" {
66 -re "${earlybpmain}\r\n$gdb_prompt $" {
67 setup_xfail *-*-* gcc/16439
70 -re "Make breakpoint pending.* \\(y or \\\[n\\\]\\) $" {
73 # Check again with a method signature at the end.
74 set cmd "break ${testfile}.main(java.lang.String\[\])void"
76 gdb_test_multiple $cmd $msg {
77 -re "${bpmain}\r\n$gdb_prompt $" {
80 -re "${earlybpmain}\r\n$gdb_prompt $" {
81 setup_xfail *-*-* gcc/16439