gas/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.java / jmisc.exp
CommitLineData
0b302171 1# Copyright 2000, 2004, 2006-2012 Free Software Foundation, Inc.
9d273ca3
AG
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
9d273ca3 6# (at your option) any later version.
e22f8b7c 7#
9d273ca3
AG
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#
9d273ca3 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/>.
9d273ca3 15
9d273ca3
AG
16# This file was written by Anthony Green. (green@redhat.com)
17#
18
9d273ca3
AG
19load_lib "java.exp"
20
ec3c07fc
NS
21if { [skip_java_tests] } { continue }
22
9d273ca3
AG
23set testfile "jmisc"
24set srcfile ${srcdir}/$subdir/${testfile}.java
25set binfile ${objdir}/${subdir}/${testfile}
ec3c07fc
NS
26if {[compile_java_from_source ${srcfile} ${binfile} "-g"] != ""} {
27 continue
9d273ca3
AG
28}
29
9d273ca3
AG
30
31# Start with a fresh gdb.
32
33gdb_exit
34gdb_start
35gdb_reinitialize_dir $srcdir/$subdir
f1208f9e 36gdb_load $binfile
9d273ca3
AG
37
38gdb_test "set print sevenbit-strings" ".*"
39
f1208f9e 40if [set_lang_java] then {
b8a56647
AC
41 # Ref PR gdb:java/1565. Don't use the simpler "break jmisc.main".
42 # As of 2004-02-24 it wasn't working and is being tested separatly.
2fa63963
DJ
43 # Before GCJ 4.1 (approximately) the demangled name did not include
44 # a method signature; after that point it does include a trailing
45 # signature.
46 runto_main
47 set function "${testfile}.main(java.lang.String\[\])"
cec808ec
KS
48 gdb_breakpoint "$function" { allow-pending }
49 gdb_breakpoint "${function}void" { allow-pending }
2fa63963 50 gdb_continue_to_breakpoint $function
9d273ca3 51
23de6b34
MS
52 gdb_test_multiple "ptype jmisc" "ptype jmisc" {
53 -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" {
54 pass "ptype jmisc"
55 }
56 -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" {
57 pass "ptype jmisc"
58 }
9d273ca3
AG
59 }
60
23de6b34
MS
61 gdb_test "p args" \
62 "\\\$1 = java\.lang\.String\\\[]@\[a-f0-9]+"
9d273ca3 63
3f9e0d32 64 gdb_test_multiple "p *args" "p *args" {
23de6b34
MS
65 -re "\\\$2 = \{length: 0\}\[\r\n\ \t]+$gdb_prompt $" {
66 pass "p *args"
67 }
2fa63963
DJ
68 -re "\\\$2 = cannot find java.lang.Object.*$gdb_prompt $" {
69 # Sometimes GCC 4.x does not emit the necessary information
70 # about java.lang.Object.
71 kfail "p *args" gdb/2214
72 }
9d273ca3 73 }
2fa63963
DJ
74
75 # The idea of running to 'exit' is that 'exit' is in a different
76 # objfile from the rest of the program (provided that program is
77 # linked normally with a shared libc). That causes gdb to examine
78 # fresh objfiles. There is nothing important about 'exit'
79 # semantics; it could be any symbol that is in a shared library.
80 # -- chastain 2003-08-06
81
82 if [gdb_breakpoint exit] {
83 pass "break exit"
84 }
85 gdb_test_multiple "continue" "continue to exit" {
86 -re ".*Breakpoint $decimal, .*exit.*$gdb_prompt $" {
87 pass "continue to exit"
88 }
89 -re ".*internal-error: sect_index_text not initialized.*\\(y or n\\) " {
90 # gdb choked on the "anonymous objfile" (probably).
91 kfail "gdb/1322" "continue to exit"
92 # get back to the gdb prompt
93 gdb_test_multiple "no" "internal sync 1" {
94 -re ".*\\(y or n\\) " {
95 gdb_test_multiple "no" "internal sync 2" {
96 -re ".*$gdb_prompt $" { ; }
97 }
98 }
99 }
100 }
101 }
3d50dd94
JK
102
103 # Test a non-mathing return type really fails the look up.
104 gdb_test_no_output "set breakpoint pending off"
105 gdb_test {break jmisc.main(java.lang.String[])int} {Function "jmisc\.main\(java\.lang\.String\[\]\)int" not defined\.}
9d273ca3 106}
This page took 1.388113 seconds and 4 git commands to generate.