]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.java/jmain.exp
This commit was manufactured by cvs2svn to create branch
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.java / jmain.exp
CommitLineData
9b254dd1 1# Copyright 2000, 2004, 2007, 2008 Free Software Foundation, Inc.
11422c86
AC
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
11422c86 6# (at your option) any later version.
e22f8b7c 7#
11422c86
AC
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.
e22f8b7c 12#
11422c86 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
11422c86
AC
15
16# This file was based on jmisc.exp which in turn was written by
17# Anthony Green. (green@redhat.com)
18
19if $tracelevel then {
20 strace $tracelevel
21}
22
23load_lib "java.exp"
24
25set testfile "jmain"
26set srcfile ${srcdir}/$subdir/${testfile}.java
27set binfile ${objdir}/${subdir}/${testfile}
81d2cbae
NS
28if { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } {
29 untested "Couldn't compile ${srcfile}"
30 return -1
11422c86
AC
31}
32
33set prms_id 0
34set bug_id 0
35
36# Start with a fresh gdb.
37
38gdb_exit
39gdb_start
40gdb_reinitialize_dir $srcdir/$subdir
41
42gdb_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
935c2760 50set bpmain "Breakpoint .* file .*jmain.java, line 5\."
11422c86 51
b1d53152
DJ
52# Where GCC PR 16439 puts the breakpoint.
53set earlybpmain "Breakpoint .* file .*jmain.java, line 4\."
54
11422c86
AC
55gdb_load "${binfile}"
56setup_kfail *-*-* java/1567
57gdb_test "break main" "${bpmain}"
58
59# Check that an unqualified "main" works.
60
11422c86
AC
61gdb_load "${binfile}"
62setup_kfail *-*-* java/1565
63gdb_test "break jmain.main" "${bpmain}"
64
65# Check that a fully qualified "main" works.
66gdb_load "${binfile}"
b1d53152
DJ
67set cmd "break \'${testfile}.main(java.lang.String\[\])\'"
68set msg $cmd
69gdb_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