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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [radix.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
# Copyright (C) 1993, 1997 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 2 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, write to the Free Software
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
# This file was written by Fred Fish. (fnf@cygnus.com)
21
 
22
if $tracelevel then {
23
        strace $tracelevel
24
}
25
 
26
set prms_id 0
27
set bug_id 0
28
 
29
proc test_input_radix_2 {} {
30
    gdb_test "set radix" \
31
        "Input and output radices now set to decimal 10, hex a, octal 12." \
32
        "set radix #1"
33
    gdb_test "set input-radix 2" \
34
        "Input radix now set to decimal 2, hex 2, octal 2."
35
    gdb_test "show radix" \
36
        "Input radix set to decimal 2, hex 2, octal 2.\r\nOutput radix set to decimal 10, hex a, octal 12." \
37
        "show radix #1"
38
    gdb_test "p 010"            "8"
39
    gdb_test "p 20."            "20"
40
    gdb_test "p (int) 20."      "20"
41
    gdb_test "p 0xf"            "15"
42
    gdb_test "p 10"             "2"
43
    gdb_test "p -101"           "-5"
44
    gdb_test "p 101"            "5"
45
    gdb_test "p 10101"          "21"
46
    gdb_test "p 4"              "Invalid number \"4\"\\."
47
    gdb_test "p -2"             "Invalid number \"2\"\\."
48
}
49
 
50
# Test input radix 3 (an non-typical radix)
51
 
52
proc test_input_radix_3 {} {
53
    gdb_test "set radix" \
54
        "Input and output radices now set to decimal 10, hex a, octal 12." \
55
        "set radix #2"
56
    gdb_test "set input-radix 3" \
57
        "Input radix now set to decimal 3, hex 3, octal 3."
58
    gdb_test "show radix" \
59
        "Input radix set to decimal 3, hex 3, octal 3.\r\nOutput radix set to decimal 10, hex a, octal 12." \
60
        "show radix #2"
61
    gdb_test "p 010"            "8"
62
    gdb_test "p 20."            "20"
63
    gdb_test "p (int) 20."      "20"
64
    gdb_test "p 0xf"            "15"
65
    gdb_test "p 10"             "3"
66
    gdb_test "p 0"              "0"
67
    gdb_test "p 1"              "1"
68
    gdb_test "p 2"              "2"
69
    gdb_test "p 10"             "3"
70
    gdb_test "p 20"             "6"
71
    gdb_test "p 100"            "9"
72
    gdb_test "p -100"           "-9"
73
    gdb_test "p 3"              "Invalid number \"3\"."
74
    gdb_test "p 30"             "Invalid number \"30\"."
75
}
76
 
77
proc test_input_radix_8 {} {
78
    gdb_test "set radix" \
79
        "Input and output radices now set to decimal 10, hex a, octal 12." \
80
        "set radix #3"
81
    gdb_test "set input-radix 8" \
82
        "Input radix now set to decimal 8, hex 8, octal 10."
83
    gdb_test "show radix" \
84
        "Input radix set to decimal 8, hex 8, octal 10.\r\nOutput radix set to decimal 10, hex a, octal 12." \
85
        "set radix #3"
86
    gdb_test "p 010"            "8"
87
    gdb_test "p 20."            "20"
88
    gdb_test "p (int) 20."      "20"
89
    gdb_test "p 0xf"            "15"
90
    gdb_test "p 10"             "8"
91
    gdb_test "p 20"             "16"
92
    gdb_test "p -20"            "-16"
93
    gdb_test "p 100"            "64"
94
    gdb_test "p 8"              "Invalid number \"8\"."
95
    gdb_test "p -9"             "Invalid number \"9\"."
96
}
97
 
98
proc test_input_radix_10 {} {
99
    gdb_test "set radix" \
100
        "Input and output radices now set to decimal 10, hex a, octal 12." \
101
        "set radix #4"
102
    gdb_test "set input-radix 10" \
103
        "Input radix now set to decimal 10, hex a, octal 12."
104
    gdb_test "show radix" \
105
        "Input and output radices set to decimal 10, hex a, octal 12." \
106
        "show radix #4"
107
    gdb_test "p 010"            "8"
108
    gdb_test "p 20."            "20"
109
    gdb_test "p (int) 20."      "20"
110
    gdb_test "p 0xf"            "15"
111
    gdb_test "p 10"             "10"
112
    gdb_test "p -12"            "-12"
113
}
114
 
115
proc test_input_radix_16 {} {
116
    gdb_test "set radix" \
117
        "Input and output radices now set to decimal 10, hex a, octal 12." \
118
        "set radix #5"
119
    gdb_test "set input-radix 16" \
120
        "Input radix now set to decimal 16, hex 10, octal 20."
121
    gdb_test "show radix" \
122
        "Input radix set to decimal 16, hex 10, octal 20.\r\nOutput radix set to decimal 10, hex a, octal 12." \
123
        "show radix #5"
124
    gdb_test "p 010"            "8"
125
    gdb_test "p 20."            "20"
126
    gdb_test "p (int) 20."      "20"
127
    gdb_test "p 0xf"            "15"
128
    gdb_test "p 10"             "16"
129
    gdb_test "p 100"            "256"
130
}
131
 
132
proc test_output_radix_8 {} {
133
    gdb_test "set radix" \
134
        "Input and output radices now set to decimal 10, hex a, octal 12." \
135
        "set radix #6"
136
    gdb_test "set output-radix 8" \
137
        "Output radix now set to decimal 8, hex 8, octal 10."
138
    gdb_test "show radix" \
139
        "Input radix set to decimal 10, hex a, octal 12.\r\nOutput radix set to decimal 8, hex 8, octal 10." \
140
        "show radix #6"
141
    gdb_test "p 010"            "010"
142
    # FIXME:  If gdb can't handle float printing in different radices, it
143
    # should at least warn once the first time that is attempted.
144
    setup_xfail "*-*-*"
145
    gdb_test "p 20."            "24"    "Float printing when output radix is 8"
146
    gdb_test "p (int) 20."      "24"
147
    gdb_test "p 0xf"            "17"
148
    gdb_test "p 10"             "12"
149
    gdb_test "p 100"            "144"
150
}
151
 
152
proc test_output_radix_10 {} {
153
    gdb_test "set radix" \
154
        "Input and output radices now set to decimal 10, hex a, octal 12." \
155
        "set radix #7"
156
    gdb_test "set output-radix 10" \
157
        "Output radix now set to decimal 10, hex a, octal 12."
158
    gdb_test "show radix" \
159
        "Input and output radices set to decimal 10, hex a, octal 12." \
160
        "show radix #7"
161
    gdb_test "p 010"            "8"
162
    gdb_test "p 20."            "20"
163
    gdb_test "p (int) 20."      "20"
164
    gdb_test "p 0xf"            "15"
165
    gdb_test "p 10"             "10"
166
    gdb_test "p 100"            "100"
167
}
168
 
169
proc test_output_radix_16 {} {
170
    gdb_test "set radix" \
171
        "Input and output radices now set to decimal 10, hex a, octal 12." \
172
        "set radix #8"
173
    gdb_test "set output-radix 16" \
174
        "Output radix now set to decimal 16, hex 10, octal 20."
175
    gdb_test "show radix" \
176
        "Input radix set to decimal 10, hex a, octal 12.\r\nOutput radix set to decimal 16, hex 10, octal 20." \
177
        "show radix #8"
178
    gdb_test "p 010"            "8"
179
    # FIXME:  If gdb can't handle float printing in different radices, it
180
    # should at least warn once the first time that is attempted.
181
    setup_xfail "*-*-*"
182
    gdb_test "p 20."            "14"    "Float printing when output radix is 16"
183
    gdb_test "p (int) 20."      "14"
184
    gdb_test "p 0xf"            "f"
185
    gdb_test "p 10"             "a"
186
    gdb_test "p 100"            "64"
187
}
188
 
189
# Start with a fresh gdb.
190
 
191
gdb_exit
192
gdb_start
193
 
194
test_input_radix_2
195
test_input_radix_3
196
test_input_radix_8
197
test_input_radix_10
198
test_input_radix_16
199
test_output_radix_8
200
test_output_radix_10
201
test_output_radix_16

powered by: WebSVN 2.1.0

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