]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.java/jprint.exp
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.java / jprint.exp
CommitLineData
8acc9f48 1# Copyright 2004-2013 Free Software Foundation, Inc.
7213f6d6
JJ
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
7213f6d6 6# (at your option) any later version.
e22f8b7c 7#
7213f6d6
JJ
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#
7213f6d6 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/>.
7213f6d6
JJ
15
16# This file was written by Jeff Johnston. (jjohnstn@redhat.com)
17#
18
7213f6d6
JJ
19load_lib "java.exp"
20
ec3c07fc
NS
21if { [skip_java_tests] } { continue }
22
c24ccbce
TT
23standard_testfile .java
24if {[compile_java_from_source $srcdir/$subdir/$srcfile $binfile "-g"] != ""} {
ec3c07fc 25 continue
7213f6d6
JJ
26}
27
7213f6d6
JJ
28
29# Start with a fresh gdb.
30
31gdb_exit
32gdb_start
33gdb_reinitialize_dir $srcdir/$subdir
f1208f9e 34gdb_load $binfile
7213f6d6
JJ
35
36gdb_test "set print sevenbit-strings" ".*"
37
f1208f9e 38if [set_lang_java] then {
7213f6d6
JJ
39 # Ref PR gdb:java/1565. Don't use the simpler "break jmisc.main".
40 # As of 2004-02-24 it wasn't working and is being tested separatly.
2fa63963
DJ
41 # Before GCJ 4.1 (approximately) the demangled name did not include
42 # a method signature; after that point it does include a trailing
43 # signature.
44 runto_main
45 set function "${testfile}.main(java.lang.String\[\])"
21a7b089
JK
46 gdb_breakpoint "$function" allow-pending
47 gdb_breakpoint "${function}void" allow-pending
2fa63963 48 gdb_continue_to_breakpoint $function
7213f6d6 49
eb5227ce 50 gdb_test "p jvclass.addprint(4,5,6)" " = 15" "unambiguous static call"
7213f6d6
JJ
51
52 gdb_test "next" ""
53 gdb_test "next" ""
54
eb5227ce
PA
55 gdb_test "p x.print(44)" " = 44" "single argument call"
56 gdb_test "p x.print(22,33)" " = 33" "double argument call"
57 gdb_test "p x.dothat(55)" " = 62.*" "virtual fn call"
58 gdb_test "p x.addprint(1,2,3)" "= 6" "inherited static call"
59 gdb_test "p x.addk(44)" " = 121" "inherited virtual fn call"
6f451e5e
TT
60
61 # Regression test for a crasher.
e62b8c7e
KS
62 # GCC does not output location information for static class members,
63 # so GDB will report these as "optimized out". See gcc/43260.
64 setup_xfail *-*-* gcc/43260
6f451e5e 65 gdb_test "print *jprint.props" " = .*" "print a java.util.Properties"
eb2a6f42 66
97d146f8
JK
67 set test "print a java.lang.String"
68 gdb_test_multiple "print jprint.hi" $test {
69 -re " = java.lang.String \"hi maude\"\r\n$gdb_prompt $" {
70 pass $test
71 }
72 -re "There is no member named data\\.\r\n$gdb_prompt $" {
73 # GCJ system debug info for java.lang.String is not installed.
74 xfail $test
75 }
76 }
7213f6d6 77}