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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gdb/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.java/] [jv-print.exp] - Blame information for rev 25

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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