* config/pa/tm-hppa.h: Define lots register offsets needed by
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / radix.exp
1 # Copyright (C) 1993 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., 675 Mass Ave, Cambridge, MA 02139, 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 gdb_test "set input-radix 2" \
33 "Input radix now set to decimal 2, hex 2, octal 2."
34 gdb_test "show radix" \
35 "Input radix set to decimal 2, hex 2, octal 2.\r\nOutput radix set to decimal 10, hex a, octal 12."
36 gdb_test "p 010" "8"
37 gdb_test "p 20." "20"
38 gdb_test "p (int) 20." "20"
39 gdb_test "p 0xf" "15"
40 gdb_test "p 10" "2"
41 gdb_test "p -101" "-5"
42 gdb_test "p 101" "5"
43 gdb_test "p 10101" "21"
44 gdb_test "p 4" "Invalid number \"4\""
45 gdb_test "p -2" "Invalid number \"2\""
46 }
47
48 # Test input radix 3 (an non-typical radix)
49
50 proc test_input_radix_3 {} {
51 gdb_test "set radix" \
52 "Input and output radices now set to decimal 10, hex a, octal 12."
53 gdb_test "set input-radix 3" \
54 "Input radix now set to decimal 3, hex 3, octal 3."
55 gdb_test "show radix" \
56 "Input radix set to decimal 3, hex 3, octal 3.\r\nOutput radix set to decimal 10, hex a, octal 12."
57 gdb_test "p 010" "8"
58 gdb_test "p 20." "20"
59 gdb_test "p (int) 20." "20"
60 gdb_test "p 0xf" "15"
61 gdb_test "p 10" "3"
62 gdb_test "p 0" "0"
63 gdb_test "p 1" "1"
64 gdb_test "p 2" "2"
65 gdb_test "p 10" "3"
66 gdb_test "p 20" "6"
67 gdb_test "p 100" "9"
68 gdb_test "p -100" "-9"
69 gdb_test "p 3" "Invalid number \"3\"."
70 gdb_test "p 30" "Invalid number \"30\"."
71 }
72
73 proc test_input_radix_8 {} {
74 gdb_test "set radix" \
75 "Input and output radices now set to decimal 10, hex a, octal 12."
76 gdb_test "set input-radix 8" \
77 "Input radix now set to decimal 8, hex 8, octal 10."
78 gdb_test "show radix" \
79 "Input radix set to decimal 8, hex 8, octal 10.\r\nOutput radix set to decimal 10, hex a, octal 12."
80 gdb_test "p 010" "8"
81 gdb_test "p 20." "20"
82 gdb_test "p (int) 20." "20"
83 gdb_test "p 0xf" "15"
84 gdb_test "p 10" "8"
85 gdb_test "p 20" "16"
86 gdb_test "p -20" "-16"
87 gdb_test "p 100" "64"
88 gdb_test "p 8" "Invalid number \"8\"."
89 gdb_test "p -9" "Invalid number \"9\"."
90 }
91
92 proc test_input_radix_10 {} {
93 gdb_test "set radix" \
94 "Input and output radices now set to decimal 10, hex a, octal 12."
95 gdb_test "set input-radix 10" \
96 "Input radix now set to decimal 10, hex a, octal 12."
97 gdb_test "show radix" \
98 "Input and output radices set to decimal 10, hex a, octal 12."
99 gdb_test "p 010" "8"
100 gdb_test "p 20." "20"
101 gdb_test "p (int) 20." "20"
102 gdb_test "p 0xf" "15"
103 gdb_test "p 10" "10"
104 gdb_test "p -12" "-12"
105 }
106
107 proc test_input_radix_16 {} {
108 gdb_test "set radix" \
109 "Input and output radices now set to decimal 10, hex a, octal 12."
110 gdb_test "set input-radix 16" \
111 "Input radix now set to decimal 16, hex 10, octal 20."
112 gdb_test "show radix" \
113 "Input radix set to decimal 16, hex 10, octal 20.\r\nOutput radix set to decimal 10, hex a, octal 12."
114 gdb_test "p 010" "8"
115 gdb_test "p 20." "20"
116 gdb_test "p (int) 20." "20"
117 gdb_test "p 0xf" "15"
118 gdb_test "p 10" "16"
119 gdb_test "p 100" "256"
120 }
121
122 proc test_output_radix_8 {} {
123 gdb_test "set radix" \
124 "Input and output radices now set to decimal 10, hex a, octal 12."
125 gdb_test "set output-radix 8" \
126 "Output radix now set to decimal 8, hex 8, octal 10."
127 gdb_test "show radix" \
128 "Input radix set to decimal 10, hex a, octal 12.\r\nOutput radix set to decimal 8, hex 8, octal 10."
129 gdb_test "p 010" "010"
130 # FIXME: If gdb can't handle float printing in different radices, it
131 # should at least warn once the first time that is attempted.
132 setup_xfail "*-*-*"
133 gdb_test "p 20." "24" "Float printing when output radix is 8"
134 gdb_test "p (int) 20." "24"
135 gdb_test "p 0xf" "17"
136 gdb_test "p 10" "12"
137 gdb_test "p 100" "144"
138 }
139
140 proc test_output_radix_10 {} {
141 gdb_test "set radix" \
142 "Input and output radices now set to decimal 10, hex a, octal 12."
143 gdb_test "set output-radix 10" \
144 "Output radix now set to decimal 10, hex a, octal 12."
145 gdb_test "show radix" \
146 "Input and output radices set to decimal 10, hex a, octal 12."
147 gdb_test "p 010" "8"
148 gdb_test "p 20." "20"
149 gdb_test "p (int) 20." "20"
150 gdb_test "p 0xf" "15"
151 gdb_test "p 10" "10"
152 gdb_test "p 100" "100"
153 }
154
155 proc test_output_radix_16 {} {
156 gdb_test "set radix" \
157 "Input and output radices now set to decimal 10, hex a, octal 12."
158 gdb_test "set output-radix 16" \
159 "Output radix now set to decimal 16, hex 10, octal 20."
160 gdb_test "show radix" \
161 "Input radix set to decimal 10, hex a, octal 12.\r\nOutput radix set to decimal 16, hex 10, octal 20."
162 gdb_test "p 010" "8"
163 # FIXME: If gdb can't handle float printing in different radices, it
164 # should at least warn once the first time that is attempted.
165 setup_xfail "*-*-*"
166 gdb_test "p 20." "14" "Float printing when output radix is 16"
167 gdb_test "p (int) 20." "14"
168 gdb_test "p 0xf" "f"
169 gdb_test "p 10" "a"
170 gdb_test "p 100" "64"
171 }
172
173 # Start with a fresh gdb.
174
175 gdb_exit
176 gdb_start
177
178 test_input_radix_2
179 test_input_radix_3
180 test_input_radix_8
181 test_input_radix_10
182 test_input_radix_16
183 test_output_radix_8
184 test_output_radix_10
185 test_output_radix_16
This page took 0.032802 seconds and 4 git commands to generate.