]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.java/jmain.exp
run copyright.sh for 2011.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.java / jmain.exp
1 # Copyright 2000, 2004, 2007, 2008, 2009, 2010, 2011
2 # Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 # This file was based on jmisc.exp which in turn was written by
18 # Anthony Green. (green@redhat.com)
19
20 if $tracelevel then {
21 strace $tracelevel
22 }
23
24 load_lib "java.exp"
25
26 if { [skip_java_tests] } { continue }
27
28 set testfile "jmain"
29 set srcfile ${srcdir}/$subdir/${testfile}.java
30 set binfile ${objdir}/${subdir}/${testfile}
31 if {[compile_java_from_source ${srcfile} ${binfile} "-g"] != ""} {
32 continue
33 }
34
35
36 # Start with a fresh gdb.
37
38 gdb_exit
39 gdb_start
40 gdb_reinitialize_dir $srcdir/$subdir
41
42 gdb_test "set print sevenbit-strings" ".*"
43
44 # Check that plain old "main" works. The load should both set the
45 # language to java and (since --main=jmain), some how set the scope to
46 # jmain's main.
47
48 # Where the breakpoint should always land
49
50 set bpmain "Breakpoint .* file .*jmain.java, line 5\."
51
52 # Where GCC PR 16439 puts the breakpoint.
53 set earlybpmain "Breakpoint .* file .*jmain.java, line 4\."
54
55 gdb_load "${binfile}"
56 setup_kfail java/1567 *-*-*
57 gdb_test "break main" "${bpmain}"
58
59 # Check that an unqualified "main" works.
60
61 gdb_load "${binfile}"
62 setup_kfail java/1565 *-*-*
63 gdb_test "break jmain.main" "${bpmain}"
64
65 # Check that a fully qualified "main" works.
66 gdb_load "${binfile}"
67 set cmd "break ${testfile}.main(java.lang.String\[\])"
68 set msg $cmd
69 gdb_test_multiple $cmd $msg {
70 -re "${bpmain}\r\n$gdb_prompt $" {
71 pass $msg
72 }
73 -re "${earlybpmain}\r\n$gdb_prompt $" {
74 setup_xfail *-*-* gcc/16439
75 fail $msg
76 }
77 -re "Make breakpoint pending.* \\(y or \\\[n\\\]\\) $" {
78 gdb_test "n" "" ""
79
80 # Check again with a method signature at the end.
81 set cmd "break ${testfile}.main(java.lang.String\[\])void"
82 set msg $cmd
83 gdb_test_multiple $cmd $msg {
84 -re "${bpmain}\r\n$gdb_prompt $" {
85 pass $msg
86 }
87 -re "${earlybpmain}\r\n$gdb_prompt $" {
88 setup_xfail *-*-* gcc/16439
89 fail $msg
90 }
91 }
92 }
93 }
94