URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/tags/gdb/gdb-6.8/gdb-6.8.openrisc-2.1/gdb/testsuite/gdb.java
- from Rev 24 to Rev 33
- ↔ Reverse comparison
Rev 24 → Rev 33
/jmisc.exp
0,0 → 1,138
# Copyright 2000, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. |
|
# This program is free software; you can redistribute it and/or modify |
# it under the terms of the GNU General Public License as published by |
# the Free Software Foundation; either version 3 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
# Please email any bugs, comments, and/or additions to this file to: |
# bug-gdb@prep.ai.mit.edu |
|
# This file was written by Anthony Green. (green@redhat.com) |
# |
|
if $tracelevel then { |
strace $tracelevel |
} |
|
load_lib "java.exp" |
|
set testfile "jmisc" |
set srcfile ${srcdir}/$subdir/${testfile}.java |
set binfile ${objdir}/${subdir}/${testfile} |
if { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } { |
untested "Couldn't compile ${srcfile}" |
return -1 |
} |
|
# Set the current language to java. This counts as a test. If it |
# fails, then we skip the other tests. |
|
proc set_lang_java {} { |
global gdb_prompt |
global binfile objdir subdir |
|
verbose "loading file '$binfile'" |
gdb_load $binfile |
|
send_gdb "set language java\n" |
gdb_expect { |
-re ".*$gdb_prompt $" {} |
timeout { fail "set language java (timeout)" ; return 0 } |
} |
|
return [gdb_test "show language" ".* source language is \"java\".*" \ |
"set language to \"java\""] |
} |
|
set prms_id 0 |
set bug_id 0 |
|
# Start with a fresh gdb. |
|
gdb_exit |
gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
|
gdb_test "set print sevenbit-strings" ".*" |
|
if ![set_lang_java] then { |
# Ref PR gdb:java/1565. Don't use the simpler "break jmisc.main". |
# As of 2004-02-24 it wasn't working and is being tested separatly. |
# Before GCJ 4.1 (approximately) the demangled name did not include |
# a method signature; after that point it does include a trailing |
# signature. |
runto_main |
set function "${testfile}.main(java.lang.String\[\])" |
gdb_breakpoint "\'$function\'" { allow-pending } |
gdb_breakpoint "\'${function}void\'" { allow-pending } |
gdb_continue_to_breakpoint $function |
|
send_gdb "ptype jmisc\n" |
gdb_expect { |
-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 $" |
{ pass "ptype jmisc" } |
-re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\)void;\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { |
# Just because GCC includes the signature doesn't mean we |
# should print it here. We already show the return type. |
kfail "ptype jmisc" gdb/2215 |
} |
-re ".*$gdb_prompt $" { fail "ptype jmisc" } |
timeout { fail "ptype jmisc (timeout)" ; return } |
} |
|
send_gdb "p args\n" |
gdb_expect { |
-re "\\\$1 = java\.lang\.String\\\[]@\[a-f0-9]+\[\r\n\ \t]+$gdb_prompt $" { pass "p args" } |
-re ".*$gdb_prompt $" { fail "p args" } |
timeout { fail "p args (timeout)" ; return } |
} |
|
send_gdb "p *args\n" |
gdb_expect { |
-re "\\\$2 = \{length: 0\}\[\r\n\ \t]+$gdb_prompt $" { pass "p *args" } |
-re "\\\$2 = cannot find java.lang.Object.*$gdb_prompt $" { |
# Sometimes GCC 4.x does not emit the necessary information |
# about java.lang.Object. |
kfail "p *args" gdb/2214 |
} |
-re ".*$gdb_prompt $" { fail "p *args" } |
timeout { fail "p *args (timeout)" ; return } |
} |
|
# The idea of running to 'exit' is that 'exit' is in a different |
# objfile from the rest of the program (provided that program is |
# linked normally with a shared libc). That causes gdb to examine |
# fresh objfiles. There is nothing important about 'exit' |
# semantics; it could be any symbol that is in a shared library. |
# -- chastain 2003-08-06 |
|
if [gdb_breakpoint exit] { |
pass "break exit" |
} |
gdb_test_multiple "continue" "continue to exit" { |
-re ".*Breakpoint $decimal, .*exit.*$gdb_prompt $" { |
pass "continue to exit" |
} |
-re ".*internal-error: sect_index_text not initialized.*\\(y or n\\) " { |
# gdb choked on the "anonymous objfile" (probably). |
kfail "gdb/1322" "continue to exit" |
# get back to the gdb prompt |
gdb_test_multiple "no" "internal sync 1" { |
-re ".*\\(y or n\\) " { |
gdb_test_multiple "no" "internal sync 2" { |
-re ".*$gdb_prompt $" { ; } |
} |
} |
} |
} |
} |
} |
/jprint.exp
0,0 → 1,86
# Copyright 2004, 2006, 2007, 2008 Free Software Foundation, Inc. |
|
# This program is free software; you can redistribute it and/or modify |
# it under the terms of the GNU General Public License as published by |
# the Free Software Foundation; either version 3 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
# This file was written by Jeff Johnston. (jjohnstn@redhat.com) |
# |
|
if $tracelevel then { |
strace $tracelevel |
} |
|
load_lib "java.exp" |
|
set testfile "jprint" |
set srcfile ${srcdir}/$subdir/${testfile}.java |
set binfile ${objdir}/${subdir}/${testfile} |
if { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } { |
untested "Couldn't compile ${srcfile}" |
return -1 |
} |
|
# Set the current language to java. This counts as a test. If it |
# fails, then we skip the other tests. |
|
proc set_lang_java {} { |
global gdb_prompt |
global binfile objdir subdir |
|
verbose "loading file '$binfile'" |
gdb_load $binfile |
|
send_gdb "set language java\n" |
gdb_expect { |
-re ".*$gdb_prompt $" {} |
timeout { fail "set language java (timeout)" ; return 0 } |
} |
|
return [gdb_test "show language" ".* source language is \"java\".*" \ |
"set language to \"java\""] |
} |
|
set prms_id 0 |
set bug_id 0 |
|
# Start with a fresh gdb. |
|
gdb_exit |
gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
|
gdb_test "set print sevenbit-strings" ".*" |
|
if ![set_lang_java] then { |
# Ref PR gdb:java/1565. Don't use the simpler "break jmisc.main". |
# As of 2004-02-24 it wasn't working and is being tested separatly. |
# Before GCJ 4.1 (approximately) the demangled name did not include |
# a method signature; after that point it does include a trailing |
# signature. |
runto_main |
set function "${testfile}.main(java.lang.String\[\])" |
gdb_breakpoint "\'$function\'" { allow-pending } |
gdb_breakpoint "\'${function}void\'" { allow-pending } |
gdb_continue_to_breakpoint $function |
|
gdb_test "p jvclass.addprint(4,5,6)" "sum is 15\r\n.*" "unambiguous static call" |
|
gdb_test "next" "" |
gdb_test "next" "" |
|
gdb_test "p x.print(44)" "x is 44\r\n.*" "single argument print call" |
gdb_test "p x.print(22,33)" "y is 33\r\n.*" "double argument print call" |
gdb_test "call x.dothat(55)" "new value is 58\r\n.*= 62.*" "virtual fn call" |
gdb_test "p x.addprint(1,2,3)" "sum is 6\r\n.*" "inherited static call" |
gdb_test "call x.addk(44)" "adding k gives 121\r\n.*= 121.*" "inherited virtual fn call" |
} |
/jv-exp.exp
0,0 → 1,65
# Copyright 2000, 2007, 2008 Free Software Foundation, Inc. |
|
# This program is free software; you can redistribute it and/or modify |
# it under the terms of the GNU General Public License as published by |
# the Free Software Foundation; either version 3 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
# Please email any bugs, comments, and/or additions to this file to: |
# bug-gdb@prep.ai.mit.edu |
|
if $tracelevel then { |
strace $tracelevel |
} |
|
set prms_id 0 |
set bug_id 0 |
|
# Set the current language to Java. This counts as a test. If it |
# fails, then we skip the other tests. |
|
proc set_lang_java {} { |
global gdb_prompt |
|
if [gdb_test "set language java" "" "set language java"] { |
return 0 |
} |
|
if [gdb_test "show language" ".* source language is \"java\".*"] { |
return 0 |
} |
return 1; |
} |
|
proc test_comparisons {} { |
global gdb_prompt |
|
# Test various comparisons. |
|
gdb_test "p 1 > 2" " = false" |
gdb_test "p 1 < 2" " = true" |
} |
|
# Start with a fresh gdb. |
|
gdb_exit |
gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
|
gdb_test "set print sevenbit-strings" "" |
gdb_test "set print address off" "" "" |
gdb_test "set width 0" "" |
|
if [set_lang_java] then { |
test_comparisons |
} else { |
fail "Java expression tests suppressed" |
} |
/jv-print.exp
0,0 → 1,140
# Copyright 1999, 2007, 2008 Free Software Foundation, Inc. |
|
# This program is free software; you can redistribute it and/or modify |
# it under the terms of the GNU General Public License as published by |
# the Free Software Foundation; either version 3 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
# Please email any bugs, comments, and/or additions to this file to: |
# bug-gdb@prep.ai.mit.edu |
|
if $tracelevel then { |
strace $tracelevel |
} |
|
set prms_id 0 |
set bug_id 0 |
|
# Set the current language to Java. This counts as a test. If it |
# fails, then we skip the other tests. |
|
proc set_lang_java {} { |
global gdb_prompt |
|
if [gdb_test "set language java" "" "set language java"] { |
return 0 |
} |
|
if [gdb_test "show language" ".* source language is \"java\".*"] { |
return 0 |
} |
return 1; |
} |
|
proc test_integer_literals_accepted {} { |
global gdb_prompt |
|
# Test various decimal values. |
|
gdb_test "p 123" " = 123" |
gdb_test "p -123" " = -123" |
gdb_test "p/d 123" " = 123" |
|
# Test various octal values. |
|
gdb_test "p 0123" " = 83" |
gdb_test "p 00123" " = 83" |
gdb_test "p -0123" " = -83" |
gdb_test "p/o 0123" " = 0123" |
|
# Test various hexadecimal values. |
|
gdb_test "p 0x123" " = 291" |
gdb_test "p -0x123" " = -291" |
gdb_test "p 0x0123" " = 291" |
gdb_test "p -0x0123" " = -291" |
gdb_test "p 0xABCDEF" " = 11259375" |
gdb_test "p 0xabcdef" " = 11259375" |
gdb_test "p 0xAbCdEf" " = 11259375" |
gdb_test "p/x 0x123" " = 0x123" |
} |
|
proc test_character_literals_accepted {} { |
global gdb_prompt |
|
gdb_test "p 'a'" " = 'a'" |
gdb_test "p/c 'a'" " = 'a'" |
gdb_test "p/c 70" " = 'F'" |
gdb_test "p/x 'a'" " = 0x61" |
gdb_test "p/d 'a'" " = 97" |
gdb_test "p/t 'a'" " = 1100001" |
gdb_test "p/x '\\377'" " = 0xff" |
gdb_test "p '\\''" " = '\\\\''" |
# Note "p '\\'" => "= 92 '\\'" |
gdb_test "p '\\\\'" " = '\\\\\\\\'" |
|
# Test the /c print format. |
} |
|
proc test_integer_literals_rejected {} { |
global gdb_prompt |
|
test_print_reject "p 0x" |
gdb_test "p ''" "Empty character constant" |
gdb_test "p '''" "Empty character constant" |
test_print_reject "p '\\'" |
|
# Note that this turns into "p '\\\'" at gdb's input. |
test_print_reject "p '\\\\\\'" |
|
# Test various decimal values. |
|
test_print_reject "p DEADBEEF" |
|
test_print_reject "p 123DEADBEEF" |
test_print_reject "p 123foobar.bazfoo3" |
test_print_reject "p 123EEEEEEEEEEEEEEEEE33333k333" |
gdb_test "p 123.4+56.7" "180.(099\[0-9]*|100\[0-9\]*)" "check for floating addition" |
|
# Test various octal values. |
|
test_print_reject "p 09" |
test_print_reject "p 079" |
|
# Test various hexadecimal values. |
|
test_print_reject "p 0xG" |
test_print_reject "p 0xAG" |
} |
|
|
|
# Start with a fresh gdb. |
|
gdb_exit |
gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
|
gdb_test "print \$pc" "No registers\\." |
# FIXME: should also test "print $pc" when there is an execfile but no |
# remote debugging target, process or corefile. |
|
gdb_test "set print sevenbit-strings" "" |
gdb_test "set print address off" "" "" |
gdb_test "set width 0" "" |
|
if [set_lang_java] then { |
test_integer_literals_accepted |
test_character_literals_accepted |
test_integer_literals_rejected |
} else { |
fail "Java print command tests suppressed" |
} |
/jmisc.java
0,0 → 1,7
public class jmisc |
{ |
public static void main (String[] args) |
{ |
return; |
} |
} |
jmisc.java
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: jprint.java
===================================================================
--- jprint.java (nonexistent)
+++ jprint.java (revision 33)
@@ -0,0 +1,62 @@
+// jprint.java test program.
+//
+// Copyright 2004
+// Free Software Foundation, Inc.
+//
+// Written by Jeff Johnston
+// Contributed by Red Hat
+//
+// This file is part of GDB.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+class jvclass {
+ public static int k;
+ static {
+ k = 77;
+ }
+ public static void addprint (int x, int y, int z) {
+ int sum = x + y + z;
+ System.out.println ("sum is " + sum);
+ }
+
+ public int addk (int x) {
+ int sum = x + k;
+ System.out.println ("adding k gives " + sum);
+ return sum;
+ }
+}
+
+public class jprint extends jvclass {
+ public int dothat (int x) {
+ int y = x + 3;
+ System.out.println ("new value is " + y);
+ return y + 4;
+ }
+ public static void print (int x) {
+ System.out.println("x is " + x);
+ }
+ public static void print (int x, int y) {
+ System.out.println("y is " + y);
+ }
+ public static void main(String[] args) {
+ jprint x = new jprint ();
+ x.dothat (44);
+ print (k, 33);
+ }
+}
+
+
jprint.java
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: jmain.exp
===================================================================
--- jmain.exp (nonexistent)
+++ jmain.exp (revision 33)
@@ -0,0 +1,94 @@
+# Copyright 2000, 2004, 2007, 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+# This file was based on jmisc.exp which in turn was written by
+# Anthony Green. (green@redhat.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+load_lib "java.exp"
+
+set testfile "jmain"
+set srcfile ${srcdir}/$subdir/${testfile}.java
+set binfile ${objdir}/${subdir}/${testfile}
+if { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } {
+ untested "Couldn't compile ${srcfile}"
+ return -1
+}
+
+set prms_id 0
+set bug_id 0
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+gdb_test "set print sevenbit-strings" ".*"
+
+# Check that plain old "main" works. The load should both set the
+# language to java and (since --main=jmain), some how set the scope to
+# jmain's main.
+
+# Where the breakpoint should always land
+
+set bpmain "Breakpoint .* file .*jmain.java, line 5\."
+
+# Where GCC PR 16439 puts the breakpoint.
+set earlybpmain "Breakpoint .* file .*jmain.java, line 4\."
+
+gdb_load "${binfile}"
+setup_kfail *-*-* java/1567
+gdb_test "break main" "${bpmain}"
+
+# Check that an unqualified "main" works.
+
+gdb_load "${binfile}"
+setup_kfail *-*-* java/1565
+gdb_test "break jmain.main" "${bpmain}"
+
+# Check that a fully qualified "main" works.
+gdb_load "${binfile}"
+set cmd "break \'${testfile}.main(java.lang.String\[\])\'"
+set msg $cmd
+gdb_test_multiple $cmd $msg {
+ -re "${bpmain}\r\n$gdb_prompt $" {
+ pass $msg
+ }
+ -re "${earlybpmain}\r\n$gdb_prompt $" {
+ setup_xfail *-*-* gcc/16439
+ fail $msg
+ }
+ -re "Make breakpoint pending.* \\(y or \\\[n\\\]\\) $" {
+ gdb_test "n" "" ""
+
+ # Check again with a method signature at the end.
+ set cmd "break \'${testfile}.main(java.lang.String\[\])void\'"
+ set msg $cmd
+ gdb_test_multiple $cmd $msg {
+ -re "${bpmain}\r\n$gdb_prompt $" {
+ pass $msg
+ }
+ -re "${earlybpmain}\r\n$gdb_prompt $" {
+ setup_xfail *-*-* gcc/16439
+ fail $msg
+ }
+ }
+ }
+}
+
Index: jmain.java
===================================================================
--- jmain.java (nonexistent)
+++ jmain.java (revision 33)
@@ -0,0 +1,7 @@
+public class jmain
+{
+ public static void main (String[] args)
+ {
+ return;
+ }
+}
jmain.java
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property