2012-01-16 Pedro Alves <palves@redhat.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.java / jmain.exp
1 # Copyright 2000, 2004, 2007-2012 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 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 # This file was based on jmisc.exp which in turn was written by
17 # Anthony Green. (green@redhat.com)
18
19 load_lib "java.exp"
20
21 if { [skip_java_tests] } { continue }
22
23 set testfile "jmain"
24 set srcfile ${srcdir}/$subdir/${testfile}.java
25 set binfile ${objdir}/${subdir}/${testfile}
26 if {[compile_java_from_source ${srcfile} ${binfile} "-g"] != ""} {
27 continue
28 }
29
30
31 # Start with a fresh gdb.
32
33 gdb_exit
34 gdb_start
35 gdb_reinitialize_dir $srcdir/$subdir
36
37 gdb_test "set print sevenbit-strings" ".*"
38
39 # Check that plain old "main" works. The load should both set the
40 # language to java and (since --main=jmain), some how set the scope to
41 # jmain's main.
42
43 # Where the breakpoint should always land
44
45 set bpmain "Breakpoint .* file .*jmain.java, line 5\."
46
47 # Where GCC PR 16439 puts the breakpoint.
48 set earlybpmain "Breakpoint .* file .*jmain.java, line 4\."
49
50 gdb_load "${binfile}"
51 setup_kfail java/1567 *-*-*
52 gdb_test "break main" "${bpmain}"
53
54 # Check that an unqualified "main" works.
55
56 gdb_load "${binfile}"
57 setup_kfail java/1565 *-*-*
58 gdb_test "break jmain.main" "${bpmain}"
59
60 # Check that a fully qualified "main" works.
61 gdb_load "${binfile}"
62 set cmd "break ${testfile}.main(java.lang.String\[\])"
63 set msg $cmd
64 gdb_test_multiple $cmd $msg {
65 -re "${bpmain}\r\n$gdb_prompt $" {
66 pass $msg
67 }
68 -re "${earlybpmain}\r\n$gdb_prompt $" {
69 setup_xfail *-*-* gcc/16439
70 fail $msg
71 }
72 -re "Make breakpoint pending.* \\(y or \\\[n\\\]\\) $" {
73 gdb_test "n" "" ""
74
75 # Check again with a method signature at the end.
76 set cmd "break ${testfile}.main(java.lang.String\[\])void"
77 set msg $cmd
78 gdb_test_multiple $cmd $msg {
79 -re "${bpmain}\r\n$gdb_prompt $" {
80 pass $msg
81 }
82 -re "${earlybpmain}\r\n$gdb_prompt $" {
83 setup_xfail *-*-* gcc/16439
84 fail $msg
85 }
86 }
87 }
88 }
89
This page took 0.033333 seconds and 5 git commands to generate.