OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.java/] [jv-print.exp] - Blame information for rev 861

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 1999, 2007, 2008, 2009, 2010 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 .
15
 
16
if $tracelevel then {
17
        strace $tracelevel
18
}
19
 
20
load_lib "java.exp"
21
 
22
if { [skip_java_tests] } { continue }
23
 
24
 
25
# Set the current language to Java.  This counts as a test.  If it
26
# fails, then we skip the other tests.
27
 
28
proc set_lang_java {} {
29
    global gdb_prompt
30
 
31
    if [gdb_test "set language java" "" "set language java"] {
32
        return 0
33
    }
34
 
35
    if [gdb_test "show language" ".* source language is \"java\".*"] {
36
        return 0
37
    }
38
    return 1;
39
}
40
 
41
proc test_integer_literals_accepted {} {
42
    global gdb_prompt
43
 
44
    # Test various decimal values.
45
 
46
    gdb_test "p 123" " = 123"
47
    gdb_test "p -123" " = -123"
48
    gdb_test "p/d 123" " = 123"
49
 
50
    # Test various octal values.
51
 
52
    gdb_test "p 0123" " = 83"
53
    gdb_test "p 00123" " = 83"
54
    gdb_test "p -0123" " = -83"
55
    gdb_test "p/o 0123" " = 0123"
56
 
57
    # Test various hexadecimal values.
58
 
59
    gdb_test "p 0x123" " = 291"
60
    gdb_test "p -0x123" " = -291"
61
    gdb_test "p 0x0123" " = 291"
62
    gdb_test "p -0x0123" " = -291"
63
    gdb_test "p 0xABCDEF" " = 11259375"
64
    gdb_test "p 0xabcdef" " = 11259375"
65
    gdb_test "p 0xAbCdEf" " = 11259375"
66
    gdb_test "p/x 0x123" " = 0x123"
67
}
68
 
69
proc test_character_literals_accepted {} {
70
    global gdb_prompt
71
 
72
    gdb_test "p 'a'" " = 'a'"
73
    gdb_test "p/c 'a'" " = 'a'"
74
    gdb_test "p/c 70" " = 'F'"
75
    gdb_test "p/x 'a'" " = 0x61"
76
    gdb_test "p/d 'a'" " = 97"
77
    gdb_test "p/t 'a'" " = 1100001"
78
    gdb_test "p/x '\\377'" " = 0xff"
79
    gdb_test "p '\\''" " = '\\\\''"
80
    # Note "p '\\'" => "= 92 '\\'"
81
    gdb_test "p '\\\\'" " = '\\\\\\\\'"
82
 
83
    # Test the /c print format.
84
}
85
 
86
proc test_integer_literals_rejected {} {
87
    global gdb_prompt
88
 
89
    test_print_reject "p 0x"
90
    gdb_test "p ''" "Empty character constant"
91
    gdb_test "p '''" "Empty character constant"
92
    test_print_reject "p '\\'"
93
 
94
    # Note that this turns into "p '\\\'" at gdb's input.
95
    test_print_reject "p '\\\\\\'"
96
 
97
    # Test various decimal values.
98
 
99
    test_print_reject "p DEADBEEF"
100
 
101
    test_print_reject "p 123DEADBEEF"
102
    test_print_reject "p 123foobar.bazfoo3"
103
    test_print_reject "p 123EEEEEEEEEEEEEEEEE33333k333"
104
    gdb_test "p 123.4+56.7" "180.(099\[0-9]*|100\[0-9\]*)" "check for floating addition"
105
 
106
    # Test various octal values.
107
 
108
    test_print_reject "p 09"
109
    test_print_reject "p 079"
110
 
111
    # Test various hexadecimal values.
112
 
113
    test_print_reject "p 0xG"
114
    test_print_reject "p 0xAG"
115
}
116
 
117
 
118
 
119
# Start with a fresh gdb.
120
 
121
gdb_exit
122
gdb_start
123
gdb_reinitialize_dir $srcdir/$subdir
124
 
125
gdb_test "print \$pc" "No registers\\."
126
# FIXME: should also test "print $pc" when there is an execfile but no
127
# remote debugging target, process or corefile.
128
 
129
gdb_test "set print sevenbit-strings" ""
130
gdb_test "set print address off" "" ""
131
gdb_test "set width 0" ""
132
 
133
if [set_lang_java] then {
134
    test_integer_literals_accepted
135
    test_character_literals_accepted
136
    test_integer_literals_rejected
137
} else {
138
    fail "Java print command tests suppressed"
139
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.