Commit | Line | Data |
---|---|---|
373a8247 | 1 | /* Support for printing Pascal values for GDB, the GNU debugger. |
5bcca90b | 2 | |
7b6bb8da | 3 | Copyright (C) 2000, 2001, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
4f2aea11 | 4 | Free Software Foundation, Inc. |
373a8247 PM |
5 | |
6 | This file is part of GDB. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 10 | the Free Software Foundation; either version 3 of the License, or |
373a8247 PM |
11 | (at your option) any later version. |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
373a8247 PM |
20 | |
21 | /* This file is derived from c-valprint.c */ | |
22 | ||
23 | #include "defs.h" | |
04ea0df1 | 24 | #include "gdb_obstack.h" |
373a8247 PM |
25 | #include "symtab.h" |
26 | #include "gdbtypes.h" | |
27 | #include "expression.h" | |
28 | #include "value.h" | |
29 | #include "command.h" | |
30 | #include "gdbcmd.h" | |
31 | #include "gdbcore.h" | |
32 | #include "demangle.h" | |
33 | #include "valprint.h" | |
3172dc30 | 34 | #include "typeprint.h" |
373a8247 PM |
35 | #include "language.h" |
36 | #include "target.h" | |
37 | #include "annotate.h" | |
38 | #include "p-lang.h" | |
eb43544b | 39 | #include "cp-abi.h" |
d3cbe7ef | 40 | #include "cp-support.h" |
373a8247 PM |
41 | \f |
42 | ||
32b72a42 PA |
43 | /* See val_print for a description of the various parameters of this |
44 | function; they are identical. The semantics of the return value is | |
45 | also identical to val_print. */ | |
373a8247 PM |
46 | |
47 | int | |
fc1a4b47 | 48 | pascal_val_print (struct type *type, const gdb_byte *valaddr, |
a2bd3dcd | 49 | int embedded_offset, CORE_ADDR address, |
79a45b7d | 50 | struct ui_file *stream, int recurse, |
0e03807e | 51 | const struct value *original_value, |
79a45b7d | 52 | const struct value_print_options *options) |
373a8247 | 53 | { |
5af949e3 | 54 | struct gdbarch *gdbarch = get_type_arch (type); |
e17a4113 | 55 | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
52f0bd74 | 56 | unsigned int i = 0; /* Number of characters printed */ |
373a8247 | 57 | unsigned len; |
df178451 | 58 | LONGEST low_bound, high_bound; |
373a8247 PM |
59 | struct type *elttype; |
60 | unsigned eltlen; | |
5598ce11 | 61 | int length_pos, length_size, string_pos; |
6c7a06a3 | 62 | struct type *char_type; |
373a8247 PM |
63 | LONGEST val; |
64 | CORE_ADDR addr; | |
65 | ||
66 | CHECK_TYPEDEF (type); | |
67 | switch (TYPE_CODE (type)) | |
68 | { | |
69 | case TYPE_CODE_ARRAY: | |
8148cf8d | 70 | if (get_array_bounds (type, &low_bound, &high_bound)) |
373a8247 | 71 | { |
8148cf8d | 72 | len = high_bound - low_bound + 1; |
373a8247 PM |
73 | elttype = check_typedef (TYPE_TARGET_TYPE (type)); |
74 | eltlen = TYPE_LENGTH (elttype); | |
79a45b7d | 75 | if (options->prettyprint_arrays) |
373a8247 PM |
76 | { |
77 | print_spaces_filtered (2 + 2 * recurse, stream); | |
78 | } | |
6e354e5e PM |
79 | /* If 's' format is used, try to print out as string. |
80 | If no format is given, print as string if element type | |
81 | is of TYPE_CODE_CHAR and element size is 1,2 or 4. */ | |
82 | if (options->format == 's' | |
83 | || ((eltlen == 1 || eltlen == 2 || eltlen == 4) | |
84 | && TYPE_CODE (elttype) == TYPE_CODE_CHAR | |
85 | && options->format == 0)) | |
373a8247 PM |
86 | { |
87 | /* If requested, look for the first null char and only print | |
88 | elements up to it. */ | |
79a45b7d | 89 | if (options->stop_print_at_null) |
373a8247 PM |
90 | { |
91 | unsigned int temp_len; | |
92 | ||
0df8b418 | 93 | /* Look for a NULL char. */ |
373a8247 | 94 | for (temp_len = 0; |
58159490 | 95 | extract_unsigned_integer (valaddr + embedded_offset + |
e17a4113 UW |
96 | temp_len * eltlen, eltlen, |
97 | byte_order) | |
79a45b7d | 98 | && temp_len < len && temp_len < options->print_max; |
373a8247 PM |
99 | temp_len++); |
100 | len = temp_len; | |
101 | } | |
102 | ||
6c7a06a3 | 103 | LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type), |
be759fcf | 104 | valaddr + embedded_offset, len, NULL, 0, |
6c7a06a3 | 105 | options); |
373a8247 PM |
106 | i = len; |
107 | } | |
108 | else | |
109 | { | |
110 | fprintf_filtered (stream, "{"); | |
111 | /* If this is a virtual function table, print the 0th | |
112 | entry specially, and the rest of the members normally. */ | |
113 | if (pascal_object_is_vtbl_ptr_type (elttype)) | |
114 | { | |
115 | i = 1; | |
116 | fprintf_filtered (stream, "%d vtable entries", len - 1); | |
117 | } | |
118 | else | |
119 | { | |
120 | i = 0; | |
121 | } | |
490f124f | 122 | val_print_array_elements (type, valaddr, embedded_offset, |
3e43a32a MS |
123 | address, stream, recurse, |
124 | original_value, options, i); | |
373a8247 PM |
125 | fprintf_filtered (stream, "}"); |
126 | } | |
127 | break; | |
128 | } | |
129 | /* Array of unspecified length: treat like pointer to first elt. */ | |
130 | addr = address; | |
131 | goto print_unpacked_pointer; | |
132 | ||
133 | case TYPE_CODE_PTR: | |
79a45b7d | 134 | if (options->format && options->format != 's') |
373a8247 | 135 | { |
ab2188aa PA |
136 | val_print_scalar_formatted (type, valaddr, embedded_offset, |
137 | original_value, options, 0, stream); | |
373a8247 PM |
138 | break; |
139 | } | |
79a45b7d | 140 | if (options->vtblprint && pascal_object_is_vtbl_ptr_type (type)) |
373a8247 PM |
141 | { |
142 | /* Print the unmangled name if desired. */ | |
143 | /* Print vtable entry - we only get here if we ARE using | |
0df8b418 | 144 | -fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */ |
b276f1bb | 145 | /* Extract the address, assume that it is unsigned. */ |
e17a4113 UW |
146 | addr = extract_unsigned_integer (valaddr + embedded_offset, |
147 | TYPE_LENGTH (type), byte_order); | |
148 | print_address_demangle (gdbarch, addr, stream, demangle); | |
373a8247 PM |
149 | break; |
150 | } | |
151 | elttype = check_typedef (TYPE_TARGET_TYPE (type)); | |
e13eedd5 PM |
152 | |
153 | addr = unpack_pointer (type, valaddr + embedded_offset); | |
154 | print_unpacked_pointer: | |
155 | elttype = check_typedef (TYPE_TARGET_TYPE (type)); | |
156 | ||
157 | if (TYPE_CODE (elttype) == TYPE_CODE_FUNC) | |
373a8247 | 158 | { |
e13eedd5 PM |
159 | /* Try to print what function it points to. */ |
160 | print_address_demangle (gdbarch, addr, stream, demangle); | |
161 | /* Return value is irrelevant except for string pointers. */ | |
162 | return (0); | |
163 | } | |
373a8247 | 164 | |
e13eedd5 PM |
165 | if (options->addressprint && options->format != 's') |
166 | { | |
167 | fputs_filtered (paddress (gdbarch, addr), stream); | |
168 | } | |
373a8247 | 169 | |
e13eedd5 PM |
170 | /* For a pointer to char or unsigned char, also print the string |
171 | pointed to, unless pointer is null. */ | |
172 | if (((TYPE_LENGTH (elttype) == 1 | |
173 | && (TYPE_CODE (elttype) == TYPE_CODE_INT | |
174 | || TYPE_CODE (elttype) == TYPE_CODE_CHAR)) | |
175 | || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4) | |
176 | && TYPE_CODE (elttype) == TYPE_CODE_CHAR)) | |
177 | && (options->format == 0 || options->format == 's') | |
178 | && addr != 0) | |
179 | { | |
0df8b418 | 180 | /* No wide string yet. */ |
09ca9e2e | 181 | i = val_print_string (elttype, NULL, addr, -1, stream, options); |
e13eedd5 | 182 | } |
0df8b418 | 183 | /* Also for pointers to pascal strings. */ |
e13eedd5 PM |
184 | /* Note: this is Free Pascal specific: |
185 | as GDB does not recognize stabs pascal strings | |
186 | Pascal strings are mapped to records | |
0df8b418 | 187 | with lowercase names PM. */ |
e13eedd5 PM |
188 | if (is_pascal_string_type (elttype, &length_pos, &length_size, |
189 | &string_pos, &char_type, NULL) | |
190 | && addr != 0) | |
191 | { | |
192 | ULONGEST string_length; | |
193 | void *buffer; | |
ad3bbd48 | 194 | |
e13eedd5 PM |
195 | buffer = xmalloc (length_size); |
196 | read_memory (addr + length_pos, buffer, length_size); | |
197 | string_length = extract_unsigned_integer (buffer, length_size, | |
198 | byte_order); | |
199 | xfree (buffer); | |
09ca9e2e TT |
200 | i = val_print_string (char_type, NULL, |
201 | addr + string_pos, string_length, | |
202 | stream, options); | |
e13eedd5 PM |
203 | } |
204 | else if (pascal_object_is_vtbl_member (type)) | |
205 | { | |
0df8b418 | 206 | /* Print vtbl's nicely. */ |
3e43a32a MS |
207 | CORE_ADDR vt_address = unpack_pointer (type, |
208 | valaddr + embedded_offset); | |
e13eedd5 | 209 | struct minimal_symbol *msymbol = |
ad3bbd48 MS |
210 | lookup_minimal_symbol_by_pc (vt_address); |
211 | ||
e13eedd5 PM |
212 | if ((msymbol != NULL) |
213 | && (vt_address == SYMBOL_VALUE_ADDRESS (msymbol))) | |
373a8247 | 214 | { |
e13eedd5 PM |
215 | fputs_filtered (" <", stream); |
216 | fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream); | |
217 | fputs_filtered (">", stream); | |
373a8247 | 218 | } |
e13eedd5 | 219 | if (vt_address && options->vtblprint) |
373a8247 | 220 | { |
e13eedd5 PM |
221 | struct value *vt_val; |
222 | struct symbol *wsym = (struct symbol *) NULL; | |
223 | struct type *wtype; | |
224 | struct block *block = (struct block *) NULL; | |
225 | int is_this_fld; | |
373a8247 | 226 | |
e13eedd5 PM |
227 | if (msymbol != NULL) |
228 | wsym = lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol), block, | |
229 | VAR_DOMAIN, &is_this_fld); | |
230 | ||
231 | if (wsym) | |
373a8247 | 232 | { |
e13eedd5 | 233 | wtype = SYMBOL_TYPE (wsym); |
373a8247 | 234 | } |
e13eedd5 | 235 | else |
373a8247 | 236 | { |
e13eedd5 PM |
237 | wtype = TYPE_TARGET_TYPE (type); |
238 | } | |
239 | vt_val = value_at (wtype, vt_address); | |
240 | common_val_print (vt_val, stream, recurse + 1, options, | |
241 | current_language); | |
242 | if (options->pretty) | |
243 | { | |
244 | fprintf_filtered (stream, "\n"); | |
245 | print_spaces_filtered (2 + 2 * recurse, stream); | |
373a8247 PM |
246 | } |
247 | } | |
373a8247 | 248 | } |
e13eedd5 PM |
249 | |
250 | /* Return number of characters printed, including the terminating | |
251 | '\0' if we reached the end. val_print_string takes care including | |
252 | the terminating '\0' if necessary. */ | |
253 | return i; | |
254 | ||
373a8247 PM |
255 | break; |
256 | ||
373a8247 PM |
257 | case TYPE_CODE_REF: |
258 | elttype = check_typedef (TYPE_TARGET_TYPE (type)); | |
79a45b7d | 259 | if (options->addressprint) |
373a8247 | 260 | { |
830bb937 UW |
261 | CORE_ADDR addr |
262 | = extract_typed_address (valaddr + embedded_offset, type); | |
ad3bbd48 | 263 | |
373a8247 | 264 | fprintf_filtered (stream, "@"); |
5af949e3 | 265 | fputs_filtered (paddress (gdbarch, addr), stream); |
79a45b7d | 266 | if (options->deref_ref) |
373a8247 PM |
267 | fputs_filtered (": ", stream); |
268 | } | |
269 | /* De-reference the reference. */ | |
79a45b7d | 270 | if (options->deref_ref) |
373a8247 PM |
271 | { |
272 | if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF) | |
273 | { | |
6943961c | 274 | struct value *deref_val = |
ad3bbd48 MS |
275 | value_at |
276 | (TYPE_TARGET_TYPE (type), | |
277 | unpack_pointer (type, valaddr + embedded_offset)); | |
278 | ||
79a45b7d TT |
279 | common_val_print (deref_val, stream, recurse + 1, options, |
280 | current_language); | |
373a8247 PM |
281 | } |
282 | else | |
283 | fputs_filtered ("???", stream); | |
284 | } | |
285 | break; | |
286 | ||
287 | case TYPE_CODE_UNION: | |
79a45b7d | 288 | if (recurse && !options->unionprint) |
373a8247 PM |
289 | { |
290 | fprintf_filtered (stream, "{...}"); | |
291 | break; | |
292 | } | |
293 | /* Fall through. */ | |
294 | case TYPE_CODE_STRUCT: | |
79a45b7d | 295 | if (options->vtblprint && pascal_object_is_vtbl_ptr_type (type)) |
373a8247 PM |
296 | { |
297 | /* Print the unmangled name if desired. */ | |
298 | /* Print vtable entry - we only get here if NOT using | |
0df8b418 | 299 | -fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */ |
b276f1bb AC |
300 | /* Extract the address, assume that it is unsigned. */ |
301 | print_address_demangle | |
5af949e3 | 302 | (gdbarch, |
3e43a32a MS |
303 | extract_unsigned_integer (valaddr + embedded_offset |
304 | + TYPE_FIELD_BITPOS (type, | |
305 | VTBL_FNADDR_OFFSET) / 8, | |
306 | TYPE_LENGTH (TYPE_FIELD_TYPE (type, | |
307 | VTBL_FNADDR_OFFSET)), | |
308 | byte_order), | |
b276f1bb | 309 | stream, demangle); |
373a8247 PM |
310 | } |
311 | else | |
312 | { | |
5598ce11 | 313 | if (is_pascal_string_type (type, &length_pos, &length_size, |
6c7a06a3 | 314 | &string_pos, &char_type, NULL)) |
373a8247 | 315 | { |
3e43a32a MS |
316 | len = extract_unsigned_integer (valaddr + embedded_offset |
317 | + length_pos, length_size, | |
318 | byte_order); | |
be759fcf PM |
319 | LA_PRINT_STRING (stream, char_type, |
320 | valaddr + embedded_offset + string_pos, | |
321 | len, NULL, 0, options); | |
373a8247 PM |
322 | } |
323 | else | |
490f124f | 324 | pascal_object_print_value_fields (type, valaddr, embedded_offset, |
3e43a32a MS |
325 | address, stream, recurse, |
326 | original_value, options, | |
327 | NULL, 0); | |
373a8247 PM |
328 | } |
329 | break; | |
330 | ||
331 | case TYPE_CODE_ENUM: | |
79a45b7d | 332 | if (options->format) |
373a8247 | 333 | { |
ab2188aa PA |
334 | val_print_scalar_formatted (type, valaddr, embedded_offset, |
335 | original_value, options, 0, stream); | |
373a8247 PM |
336 | break; |
337 | } | |
338 | len = TYPE_NFIELDS (type); | |
339 | val = unpack_long (type, valaddr + embedded_offset); | |
340 | for (i = 0; i < len; i++) | |
341 | { | |
342 | QUIT; | |
343 | if (val == TYPE_FIELD_BITPOS (type, i)) | |
344 | { | |
345 | break; | |
346 | } | |
347 | } | |
348 | if (i < len) | |
349 | { | |
350 | fputs_filtered (TYPE_FIELD_NAME (type, i), stream); | |
351 | } | |
352 | else | |
353 | { | |
354 | print_longest (stream, 'd', 0, val); | |
355 | } | |
356 | break; | |
357 | ||
4f2aea11 | 358 | case TYPE_CODE_FLAGS: |
79a45b7d | 359 | if (options->format) |
ab2188aa PA |
360 | val_print_scalar_formatted (type, valaddr, embedded_offset, |
361 | original_value, options, 0, stream); | |
4f2aea11 MK |
362 | else |
363 | val_print_type_code_flags (type, valaddr + embedded_offset, stream); | |
364 | break; | |
365 | ||
373a8247 | 366 | case TYPE_CODE_FUNC: |
79a45b7d | 367 | if (options->format) |
373a8247 | 368 | { |
ab2188aa PA |
369 | val_print_scalar_formatted (type, valaddr, embedded_offset, |
370 | original_value, options, 0, stream); | |
373a8247 PM |
371 | break; |
372 | } | |
373 | /* FIXME, we should consider, at least for ANSI C language, eliminating | |
374 | the distinction made between FUNCs and POINTERs to FUNCs. */ | |
375 | fprintf_filtered (stream, "{"); | |
376 | type_print (type, "", stream, -1); | |
377 | fprintf_filtered (stream, "} "); | |
378 | /* Try to print what function it points to, and its address. */ | |
5af949e3 | 379 | print_address_demangle (gdbarch, address, stream, demangle); |
373a8247 PM |
380 | break; |
381 | ||
382 | case TYPE_CODE_BOOL: | |
79a45b7d TT |
383 | if (options->format || options->output_format) |
384 | { | |
385 | struct value_print_options opts = *options; | |
ad3bbd48 | 386 | |
79a45b7d TT |
387 | opts.format = (options->format ? options->format |
388 | : options->output_format); | |
ab2188aa PA |
389 | val_print_scalar_formatted (type, valaddr, embedded_offset, |
390 | original_value, &opts, 0, stream); | |
79a45b7d | 391 | } |
373a8247 PM |
392 | else |
393 | { | |
394 | val = unpack_long (type, valaddr + embedded_offset); | |
395 | if (val == 0) | |
396 | fputs_filtered ("false", stream); | |
397 | else if (val == 1) | |
398 | fputs_filtered ("true", stream); | |
399 | else | |
400 | { | |
401 | fputs_filtered ("true (", stream); | |
402 | fprintf_filtered (stream, "%ld)", (long int) val); | |
403 | } | |
404 | } | |
405 | break; | |
406 | ||
407 | case TYPE_CODE_RANGE: | |
408 | /* FIXME: create_range_type does not set the unsigned bit in a | |
409 | range type (I think it probably should copy it from the target | |
410 | type), so we won't print values which are too large to | |
411 | fit in a signed integer correctly. */ | |
412 | /* FIXME: Doesn't handle ranges of enums correctly. (Can't just | |
413 | print with the target type, though, because the size of our type | |
414 | and the target type might differ). */ | |
415 | /* FALLTHROUGH */ | |
416 | ||
417 | case TYPE_CODE_INT: | |
79a45b7d | 418 | if (options->format || options->output_format) |
373a8247 | 419 | { |
79a45b7d | 420 | struct value_print_options opts = *options; |
ad3bbd48 | 421 | |
79a45b7d TT |
422 | opts.format = (options->format ? options->format |
423 | : options->output_format); | |
ab2188aa PA |
424 | val_print_scalar_formatted (type, valaddr, embedded_offset, |
425 | original_value, &opts, 0, stream); | |
373a8247 PM |
426 | } |
427 | else | |
428 | { | |
429 | val_print_type_code_int (type, valaddr + embedded_offset, stream); | |
430 | } | |
431 | break; | |
432 | ||
433 | case TYPE_CODE_CHAR: | |
79a45b7d | 434 | if (options->format || options->output_format) |
373a8247 | 435 | { |
79a45b7d | 436 | struct value_print_options opts = *options; |
ad3bbd48 | 437 | |
79a45b7d TT |
438 | opts.format = (options->format ? options->format |
439 | : options->output_format); | |
ab2188aa PA |
440 | val_print_scalar_formatted (type, valaddr, embedded_offset, |
441 | original_value, &opts, 0, stream); | |
373a8247 PM |
442 | } |
443 | else | |
444 | { | |
445 | val = unpack_long (type, valaddr + embedded_offset); | |
446 | if (TYPE_UNSIGNED (type)) | |
447 | fprintf_filtered (stream, "%u", (unsigned int) val); | |
448 | else | |
449 | fprintf_filtered (stream, "%d", (int) val); | |
450 | fputs_filtered (" ", stream); | |
6c7a06a3 | 451 | LA_PRINT_CHAR ((unsigned char) val, type, stream); |
373a8247 PM |
452 | } |
453 | break; | |
454 | ||
455 | case TYPE_CODE_FLT: | |
79a45b7d | 456 | if (options->format) |
373a8247 | 457 | { |
ab2188aa PA |
458 | val_print_scalar_formatted (type, valaddr, embedded_offset, |
459 | original_value, options, 0, stream); | |
373a8247 PM |
460 | } |
461 | else | |
462 | { | |
463 | print_floating (valaddr + embedded_offset, type, stream); | |
464 | } | |
465 | break; | |
466 | ||
467 | case TYPE_CODE_BITSTRING: | |
468 | case TYPE_CODE_SET: | |
469 | elttype = TYPE_INDEX_TYPE (type); | |
470 | CHECK_TYPEDEF (elttype); | |
74a9bb82 | 471 | if (TYPE_STUB (elttype)) |
373a8247 PM |
472 | { |
473 | fprintf_filtered (stream, "<incomplete type>"); | |
474 | gdb_flush (stream); | |
475 | break; | |
476 | } | |
477 | else | |
478 | { | |
479 | struct type *range = elttype; | |
480 | LONGEST low_bound, high_bound; | |
481 | int i; | |
482 | int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING; | |
483 | int need_comma = 0; | |
484 | ||
485 | if (is_bitstring) | |
486 | fputs_filtered ("B'", stream); | |
487 | else | |
488 | fputs_filtered ("[", stream); | |
489 | ||
490 | i = get_discrete_bounds (range, &low_bound, &high_bound); | |
7a081a30 PM |
491 | if (low_bound == 0 && high_bound == -1 && TYPE_LENGTH (type) > 0) |
492 | { | |
493 | /* If we know the size of the set type, we can figure out the | |
494 | maximum value. */ | |
495 | i = 0; | |
496 | high_bound = TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1; | |
497 | TYPE_HIGH_BOUND (range) = high_bound; | |
498 | } | |
373a8247 PM |
499 | maybe_bad_bstring: |
500 | if (i < 0) | |
501 | { | |
502 | fputs_filtered ("<error value>", stream); | |
503 | goto done; | |
504 | } | |
505 | ||
506 | for (i = low_bound; i <= high_bound; i++) | |
507 | { | |
3e43a32a MS |
508 | int element = value_bit_index (type, |
509 | valaddr + embedded_offset, i); | |
ad3bbd48 | 510 | |
373a8247 PM |
511 | if (element < 0) |
512 | { | |
513 | i = element; | |
514 | goto maybe_bad_bstring; | |
515 | } | |
516 | if (is_bitstring) | |
517 | fprintf_filtered (stream, "%d", element); | |
518 | else if (element) | |
519 | { | |
520 | if (need_comma) | |
521 | fputs_filtered (", ", stream); | |
522 | print_type_scalar (range, i, stream); | |
523 | need_comma = 1; | |
524 | ||
3e43a32a MS |
525 | if (i + 1 <= high_bound |
526 | && value_bit_index (type, | |
527 | valaddr + embedded_offset, ++i)) | |
373a8247 PM |
528 | { |
529 | int j = i; | |
ad3bbd48 | 530 | |
373a8247 PM |
531 | fputs_filtered ("..", stream); |
532 | while (i + 1 <= high_bound | |
3e43a32a MS |
533 | && value_bit_index (type, |
534 | valaddr + embedded_offset, | |
535 | ++i)) | |
373a8247 PM |
536 | j = i; |
537 | print_type_scalar (range, j, stream); | |
538 | } | |
539 | } | |
540 | } | |
541 | done: | |
542 | if (is_bitstring) | |
543 | fputs_filtered ("'", stream); | |
544 | else | |
545 | fputs_filtered ("]", stream); | |
546 | } | |
547 | break; | |
548 | ||
549 | case TYPE_CODE_VOID: | |
550 | fprintf_filtered (stream, "void"); | |
551 | break; | |
552 | ||
553 | case TYPE_CODE_ERROR: | |
b00fdb78 | 554 | fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type)); |
373a8247 PM |
555 | break; |
556 | ||
557 | case TYPE_CODE_UNDEF: | |
558 | /* This happens (without TYPE_FLAG_STUB set) on systems which don't use | |
559 | dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar" | |
560 | and no complete type for struct foo in that file. */ | |
561 | fprintf_filtered (stream, "<incomplete type>"); | |
562 | break; | |
563 | ||
564 | default: | |
3e43a32a MS |
565 | error (_("Invalid pascal type code %d in symbol table."), |
566 | TYPE_CODE (type)); | |
373a8247 PM |
567 | } |
568 | gdb_flush (stream); | |
569 | return (0); | |
570 | } | |
571 | \f | |
572 | int | |
79a45b7d TT |
573 | pascal_value_print (struct value *val, struct ui_file *stream, |
574 | const struct value_print_options *options) | |
373a8247 | 575 | { |
df407dfe | 576 | struct type *type = value_type (val); |
278582cb PM |
577 | struct value_print_options opts = *options; |
578 | ||
579 | opts.deref_ref = 1; | |
373a8247 PM |
580 | |
581 | /* If it is a pointer, indicate what it points to. | |
582 | ||
583 | Print type also if it is a reference. | |
584 | ||
585 | Object pascal: if it is a member pointer, we will take care | |
586 | of that when we print it. */ | |
b20a3440 PM |
587 | if (TYPE_CODE (type) == TYPE_CODE_PTR |
588 | || TYPE_CODE (type) == TYPE_CODE_REF) | |
373a8247 PM |
589 | { |
590 | /* Hack: remove (char *) for char strings. Their | |
0df8b418 | 591 | type is indicated by the quoted string anyway. */ |
b20a3440 PM |
592 | if (TYPE_CODE (type) == TYPE_CODE_PTR |
593 | && TYPE_NAME (type) == NULL | |
594 | && TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL | |
6314a349 | 595 | && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0) |
373a8247 | 596 | { |
0df8b418 | 597 | /* Print nothing. */ |
373a8247 PM |
598 | } |
599 | else | |
600 | { | |
601 | fprintf_filtered (stream, "("); | |
602 | type_print (type, "", stream, -1); | |
603 | fprintf_filtered (stream, ") "); | |
604 | } | |
605 | } | |
278582cb | 606 | return common_val_print (val, stream, 0, &opts, current_language); |
373a8247 PM |
607 | } |
608 | ||
609 | ||
920d2a44 AC |
610 | static void |
611 | show_pascal_static_field_print (struct ui_file *file, int from_tty, | |
612 | struct cmd_list_element *c, const char *value) | |
613 | { | |
614 | fprintf_filtered (file, _("Printing of pascal static members is %s.\n"), | |
615 | value); | |
616 | } | |
373a8247 PM |
617 | |
618 | static struct obstack dont_print_vb_obstack; | |
619 | static struct obstack dont_print_statmem_obstack; | |
620 | ||
806048c6 | 621 | static void pascal_object_print_static_field (struct value *, |
79a45b7d TT |
622 | struct ui_file *, int, |
623 | const struct value_print_options *); | |
373a8247 | 624 | |
fc1a4b47 | 625 | static void pascal_object_print_value (struct type *, const gdb_byte *, |
490f124f | 626 | int, |
79a45b7d | 627 | CORE_ADDR, struct ui_file *, int, |
0e03807e | 628 | const struct value *, |
79a45b7d | 629 | const struct value_print_options *, |
a2bd3dcd | 630 | struct type **); |
373a8247 | 631 | |
373a8247 PM |
632 | /* It was changed to this after 2.4.5. */ |
633 | const char pascal_vtbl_ptr_name[] = | |
634 | {'_', '_', 'v', 't', 'b', 'l', '_', 'p', 't', 'r', '_', 't', 'y', 'p', 'e', 0}; | |
635 | ||
636 | /* Return truth value for assertion that TYPE is of the type | |
637 | "pointer to virtual function". */ | |
638 | ||
639 | int | |
fba45db2 | 640 | pascal_object_is_vtbl_ptr_type (struct type *type) |
373a8247 PM |
641 | { |
642 | char *typename = type_name_no_tag (type); | |
643 | ||
644 | return (typename != NULL | |
6314a349 | 645 | && strcmp (typename, pascal_vtbl_ptr_name) == 0); |
373a8247 PM |
646 | } |
647 | ||
648 | /* Return truth value for the assertion that TYPE is of the type | |
649 | "pointer to virtual function table". */ | |
650 | ||
651 | int | |
fba45db2 | 652 | pascal_object_is_vtbl_member (struct type *type) |
373a8247 PM |
653 | { |
654 | if (TYPE_CODE (type) == TYPE_CODE_PTR) | |
655 | { | |
656 | type = TYPE_TARGET_TYPE (type); | |
657 | if (TYPE_CODE (type) == TYPE_CODE_ARRAY) | |
658 | { | |
659 | type = TYPE_TARGET_TYPE (type); | |
0df8b418 MS |
660 | if (TYPE_CODE (type) == TYPE_CODE_STRUCT /* If not using |
661 | thunks. */ | |
662 | || TYPE_CODE (type) == TYPE_CODE_PTR) /* If using thunks. */ | |
373a8247 PM |
663 | { |
664 | /* Virtual functions tables are full of pointers | |
0df8b418 | 665 | to virtual functions. */ |
373a8247 PM |
666 | return pascal_object_is_vtbl_ptr_type (type); |
667 | } | |
668 | } | |
669 | } | |
670 | return 0; | |
671 | } | |
672 | ||
a2bd3dcd AC |
673 | /* Mutually recursive subroutines of pascal_object_print_value and |
674 | c_val_print to print out a structure's fields: | |
675 | pascal_object_print_value_fields and pascal_object_print_value. | |
373a8247 | 676 | |
79a45b7d | 677 | TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and OPTIONS have the |
373a8247 PM |
678 | same meanings as in pascal_object_print_value and c_val_print. |
679 | ||
680 | DONT_PRINT is an array of baseclass types that we | |
681 | should not print, or zero if called from top level. */ | |
682 | ||
683 | void | |
fc1a4b47 | 684 | pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, |
490f124f | 685 | int offset, |
fba45db2 | 686 | CORE_ADDR address, struct ui_file *stream, |
79a45b7d | 687 | int recurse, |
0e03807e | 688 | const struct value *val, |
79a45b7d | 689 | const struct value_print_options *options, |
fba45db2 KB |
690 | struct type **dont_print_vb, |
691 | int dont_print_statmem) | |
373a8247 PM |
692 | { |
693 | int i, len, n_baseclasses; | |
373a8247 PM |
694 | char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack); |
695 | ||
696 | CHECK_TYPEDEF (type); | |
697 | ||
698 | fprintf_filtered (stream, "{"); | |
699 | len = TYPE_NFIELDS (type); | |
700 | n_baseclasses = TYPE_N_BASECLASSES (type); | |
701 | ||
702 | /* Print out baseclasses such that we don't print | |
703 | duplicates of virtual baseclasses. */ | |
704 | if (n_baseclasses > 0) | |
490f124f PA |
705 | pascal_object_print_value (type, valaddr, offset, address, |
706 | stream, recurse + 1, val, | |
707 | options, dont_print_vb); | |
373a8247 PM |
708 | |
709 | if (!len && n_baseclasses == 1) | |
710 | fprintf_filtered (stream, "<No data fields>"); | |
711 | else | |
712 | { | |
c1b6e682 | 713 | struct obstack tmp_obstack = dont_print_statmem_obstack; |
373a8247 PM |
714 | int fields_seen = 0; |
715 | ||
716 | if (dont_print_statmem == 0) | |
717 | { | |
718 | /* If we're at top level, carve out a completely fresh | |
719 | chunk of the obstack and use that until this particular | |
720 | invocation returns. */ | |
373a8247 PM |
721 | obstack_finish (&dont_print_statmem_obstack); |
722 | } | |
723 | ||
724 | for (i = n_baseclasses; i < len; i++) | |
725 | { | |
726 | /* If requested, skip printing of static fields. */ | |
79a45b7d | 727 | if (!options->pascal_static_field_print |
d6a843b5 | 728 | && field_is_static (&TYPE_FIELD (type, i))) |
373a8247 PM |
729 | continue; |
730 | if (fields_seen) | |
731 | fprintf_filtered (stream, ", "); | |
732 | else if (n_baseclasses > 0) | |
733 | { | |
79a45b7d | 734 | if (options->pretty) |
373a8247 PM |
735 | { |
736 | fprintf_filtered (stream, "\n"); | |
737 | print_spaces_filtered (2 + 2 * recurse, stream); | |
738 | fputs_filtered ("members of ", stream); | |
739 | fputs_filtered (type_name_no_tag (type), stream); | |
740 | fputs_filtered (": ", stream); | |
741 | } | |
742 | } | |
743 | fields_seen = 1; | |
744 | ||
79a45b7d | 745 | if (options->pretty) |
373a8247 PM |
746 | { |
747 | fprintf_filtered (stream, "\n"); | |
748 | print_spaces_filtered (2 + 2 * recurse, stream); | |
749 | } | |
750 | else | |
751 | { | |
752 | wrap_here (n_spaces (2 + 2 * recurse)); | |
753 | } | |
79a45b7d | 754 | if (options->inspect_it) |
373a8247 PM |
755 | { |
756 | if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR) | |
757 | fputs_filtered ("\"( ptr \"", stream); | |
758 | else | |
759 | fputs_filtered ("\"( nodef \"", stream); | |
d6a843b5 | 760 | if (field_is_static (&TYPE_FIELD (type, i))) |
373a8247 PM |
761 | fputs_filtered ("static ", stream); |
762 | fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), | |
763 | language_cplus, | |
764 | DMGL_PARAMS | DMGL_ANSI); | |
765 | fputs_filtered ("\" \"", stream); | |
766 | fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), | |
767 | language_cplus, | |
768 | DMGL_PARAMS | DMGL_ANSI); | |
769 | fputs_filtered ("\") \"", stream); | |
770 | } | |
771 | else | |
772 | { | |
773 | annotate_field_begin (TYPE_FIELD_TYPE (type, i)); | |
774 | ||
d6a843b5 | 775 | if (field_is_static (&TYPE_FIELD (type, i))) |
373a8247 PM |
776 | fputs_filtered ("static ", stream); |
777 | fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), | |
778 | language_cplus, | |
779 | DMGL_PARAMS | DMGL_ANSI); | |
780 | annotate_field_name_end (); | |
781 | fputs_filtered (" = ", stream); | |
782 | annotate_field_value (); | |
783 | } | |
784 | ||
d6a843b5 JK |
785 | if (!field_is_static (&TYPE_FIELD (type, i)) |
786 | && TYPE_FIELD_PACKED (type, i)) | |
373a8247 | 787 | { |
6943961c | 788 | struct value *v; |
373a8247 PM |
789 | |
790 | /* Bitfields require special handling, especially due to byte | |
791 | order problems. */ | |
792 | if (TYPE_FIELD_IGNORE (type, i)) | |
793 | { | |
794 | fputs_filtered ("<optimized out or zero length>", stream); | |
795 | } | |
8cf6f0b1 TT |
796 | else if (value_bits_synthetic_pointer (val, |
797 | TYPE_FIELD_BITPOS (type, | |
798 | i), | |
799 | TYPE_FIELD_BITSIZE (type, | |
800 | i))) | |
801 | { | |
802 | fputs_filtered (_("<synthetic pointer>"), stream); | |
803 | } | |
0e03807e TT |
804 | else if (!value_bits_valid (val, TYPE_FIELD_BITPOS (type, i), |
805 | TYPE_FIELD_BITSIZE (type, i))) | |
806 | { | |
585fdaa1 | 807 | val_print_optimized_out (stream); |
0e03807e | 808 | } |
373a8247 PM |
809 | else |
810 | { | |
79a45b7d | 811 | struct value_print_options opts = *options; |
ad3bbd48 | 812 | |
373a8247 | 813 | v = value_from_longest (TYPE_FIELD_TYPE (type, i), |
490f124f PA |
814 | unpack_field_as_long (type, |
815 | valaddr + offset, i)); | |
373a8247 | 816 | |
79a45b7d TT |
817 | opts.deref_ref = 0; |
818 | common_val_print (v, stream, recurse + 1, &opts, | |
819 | current_language); | |
373a8247 PM |
820 | } |
821 | } | |
822 | else | |
823 | { | |
824 | if (TYPE_FIELD_IGNORE (type, i)) | |
825 | { | |
826 | fputs_filtered ("<optimized out or zero length>", stream); | |
827 | } | |
d6a843b5 | 828 | else if (field_is_static (&TYPE_FIELD (type, i))) |
373a8247 | 829 | { |
3e43a32a | 830 | /* struct value *v = value_static_field (type, i); |
0df8b418 | 831 | v4.17 specific. */ |
6943961c | 832 | struct value *v; |
ad3bbd48 | 833 | |
490f124f PA |
834 | v = value_from_longest |
835 | (TYPE_FIELD_TYPE (type, i), | |
836 | unpack_field_as_long (type, valaddr + offset, i)); | |
373a8247 PM |
837 | |
838 | if (v == NULL) | |
585fdaa1 | 839 | val_print_optimized_out (stream); |
373a8247 | 840 | else |
79a45b7d TT |
841 | pascal_object_print_static_field (v, stream, recurse + 1, |
842 | options); | |
373a8247 PM |
843 | } |
844 | else | |
845 | { | |
79a45b7d | 846 | struct value_print_options opts = *options; |
ad3bbd48 | 847 | |
79a45b7d | 848 | opts.deref_ref = 0; |
373a8247 PM |
849 | /* val_print (TYPE_FIELD_TYPE (type, i), |
850 | valaddr + TYPE_FIELD_BITPOS (type, i) / 8, | |
851 | address + TYPE_FIELD_BITPOS (type, i) / 8, 0, | |
852 | stream, format, 0, recurse + 1, pretty); */ | |
853 | val_print (TYPE_FIELD_TYPE (type, i), | |
490f124f PA |
854 | valaddr, offset + TYPE_FIELD_BITPOS (type, i) / 8, |
855 | address, stream, recurse + 1, val, &opts, | |
d8ca156b | 856 | current_language); |
373a8247 PM |
857 | } |
858 | } | |
859 | annotate_field_end (); | |
860 | } | |
861 | ||
862 | if (dont_print_statmem == 0) | |
863 | { | |
864 | /* Free the space used to deal with the printing | |
865 | of the members from top level. */ | |
866 | obstack_free (&dont_print_statmem_obstack, last_dont_print); | |
867 | dont_print_statmem_obstack = tmp_obstack; | |
868 | } | |
869 | ||
79a45b7d | 870 | if (options->pretty) |
373a8247 PM |
871 | { |
872 | fprintf_filtered (stream, "\n"); | |
873 | print_spaces_filtered (2 * recurse, stream); | |
874 | } | |
875 | } | |
876 | fprintf_filtered (stream, "}"); | |
877 | } | |
878 | ||
879 | /* Special val_print routine to avoid printing multiple copies of virtual | |
880 | baseclasses. */ | |
881 | ||
7080f20f | 882 | static void |
fc1a4b47 | 883 | pascal_object_print_value (struct type *type, const gdb_byte *valaddr, |
490f124f | 884 | int offset, |
a2bd3dcd | 885 | CORE_ADDR address, struct ui_file *stream, |
79a45b7d | 886 | int recurse, |
0e03807e | 887 | const struct value *val, |
79a45b7d | 888 | const struct value_print_options *options, |
fba45db2 | 889 | struct type **dont_print_vb) |
373a8247 | 890 | { |
373a8247 | 891 | struct type **last_dont_print |
ad3bbd48 | 892 | = (struct type **) obstack_next_free (&dont_print_vb_obstack); |
c1b6e682 | 893 | struct obstack tmp_obstack = dont_print_vb_obstack; |
373a8247 PM |
894 | int i, n_baseclasses = TYPE_N_BASECLASSES (type); |
895 | ||
896 | if (dont_print_vb == 0) | |
897 | { | |
898 | /* If we're at top level, carve out a completely fresh | |
899 | chunk of the obstack and use that until this particular | |
900 | invocation returns. */ | |
373a8247 PM |
901 | /* Bump up the high-water mark. Now alpha is omega. */ |
902 | obstack_finish (&dont_print_vb_obstack); | |
903 | } | |
904 | ||
905 | for (i = 0; i < n_baseclasses; i++) | |
906 | { | |
907 | int boffset; | |
908 | struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); | |
4a52dc15 | 909 | char *basename = type_name_no_tag (baseclass); |
fc1a4b47 | 910 | const gdb_byte *base_valaddr; |
490f124f | 911 | int thisoffset; |
373a8247 PM |
912 | |
913 | if (BASETYPE_VIA_VIRTUAL (type, i)) | |
914 | { | |
915 | struct type **first_dont_print | |
ad3bbd48 | 916 | = (struct type **) obstack_base (&dont_print_vb_obstack); |
373a8247 PM |
917 | |
918 | int j = (struct type **) obstack_next_free (&dont_print_vb_obstack) | |
ad3bbd48 | 919 | - first_dont_print; |
373a8247 PM |
920 | |
921 | while (--j >= 0) | |
922 | if (baseclass == first_dont_print[j]) | |
923 | goto flush_it; | |
924 | ||
925 | obstack_ptr_grow (&dont_print_vb_obstack, baseclass); | |
926 | } | |
927 | ||
490f124f PA |
928 | thisoffset = offset; |
929 | ||
930 | boffset = baseclass_offset (type, i, valaddr + offset, address + offset); | |
373a8247 | 931 | |
79a45b7d | 932 | if (options->pretty) |
373a8247 PM |
933 | { |
934 | fprintf_filtered (stream, "\n"); | |
935 | print_spaces_filtered (2 * recurse, stream); | |
936 | } | |
937 | fputs_filtered ("<", stream); | |
938 | /* Not sure what the best notation is in the case where there is no | |
939 | baseclass name. */ | |
940 | ||
941 | fputs_filtered (basename ? basename : "", stream); | |
942 | fputs_filtered ("> = ", stream); | |
943 | ||
944 | /* The virtual base class pointer might have been clobbered by the | |
0df8b418 | 945 | user program. Make sure that it still points to a valid memory |
373a8247 PM |
946 | location. */ |
947 | ||
948 | if (boffset != -1 && (boffset < 0 || boffset >= TYPE_LENGTH (type))) | |
949 | { | |
0df8b418 | 950 | /* FIXME (alloc): not safe is baseclass is really really big. */ |
fc1a4b47 | 951 | gdb_byte *buf = alloca (TYPE_LENGTH (baseclass)); |
ad3bbd48 | 952 | |
a2bd3dcd AC |
953 | base_valaddr = buf; |
954 | if (target_read_memory (address + boffset, buf, | |
373a8247 PM |
955 | TYPE_LENGTH (baseclass)) != 0) |
956 | boffset = -1; | |
490f124f PA |
957 | address = address + boffset; |
958 | thisoffset = 0; | |
959 | boffset = 0; | |
373a8247 PM |
960 | } |
961 | else | |
490f124f | 962 | base_valaddr = valaddr; |
373a8247 PM |
963 | |
964 | if (boffset == -1) | |
965 | fprintf_filtered (stream, "<invalid address>"); | |
966 | else | |
3e43a32a | 967 | pascal_object_print_value_fields (baseclass, base_valaddr, |
490f124f PA |
968 | thisoffset + boffset, address, |
969 | stream, recurse, val, options, | |
373a8247 PM |
970 | (struct type **) obstack_base (&dont_print_vb_obstack), |
971 | 0); | |
972 | fputs_filtered (", ", stream); | |
973 | ||
974 | flush_it: | |
975 | ; | |
976 | } | |
977 | ||
978 | if (dont_print_vb == 0) | |
979 | { | |
980 | /* Free the space used to deal with the printing | |
981 | of this type from top level. */ | |
982 | obstack_free (&dont_print_vb_obstack, last_dont_print); | |
983 | /* Reset watermark so that we can continue protecting | |
984 | ourselves from whatever we were protecting ourselves. */ | |
985 | dont_print_vb_obstack = tmp_obstack; | |
986 | } | |
987 | } | |
988 | ||
989 | /* Print value of a static member. | |
990 | To avoid infinite recursion when printing a class that contains | |
991 | a static instance of the class, we keep the addresses of all printed | |
992 | static member classes in an obstack and refuse to print them more | |
993 | than once. | |
994 | ||
79a45b7d | 995 | VAL contains the value to print, STREAM, RECURSE, and OPTIONS |
373a8247 PM |
996 | have the same meanings as in c_val_print. */ |
997 | ||
998 | static void | |
806048c6 | 999 | pascal_object_print_static_field (struct value *val, |
79a45b7d TT |
1000 | struct ui_file *stream, |
1001 | int recurse, | |
1002 | const struct value_print_options *options) | |
373a8247 | 1003 | { |
806048c6 | 1004 | struct type *type = value_type (val); |
79a45b7d | 1005 | struct value_print_options opts; |
806048c6 | 1006 | |
373a8247 PM |
1007 | if (TYPE_CODE (type) == TYPE_CODE_STRUCT) |
1008 | { | |
42ae5230 | 1009 | CORE_ADDR *first_dont_print, addr; |
373a8247 PM |
1010 | int i; |
1011 | ||
1012 | first_dont_print | |
1013 | = (CORE_ADDR *) obstack_base (&dont_print_statmem_obstack); | |
1014 | i = (CORE_ADDR *) obstack_next_free (&dont_print_statmem_obstack) | |
1015 | - first_dont_print; | |
1016 | ||
1017 | while (--i >= 0) | |
1018 | { | |
42ae5230 | 1019 | if (value_address (val) == first_dont_print[i]) |
373a8247 | 1020 | { |
3e43a32a MS |
1021 | fputs_filtered ("\ |
1022 | <same as static member of an already seen type>", | |
373a8247 PM |
1023 | stream); |
1024 | return; | |
1025 | } | |
1026 | } | |
1027 | ||
42ae5230 TT |
1028 | addr = value_address (val); |
1029 | obstack_grow (&dont_print_statmem_obstack, (char *) &addr, | |
373a8247 PM |
1030 | sizeof (CORE_ADDR)); |
1031 | ||
1032 | CHECK_TYPEDEF (type); | |
490f124f PA |
1033 | pascal_object_print_value_fields (type, |
1034 | value_contents_for_printing (val), | |
1035 | value_embedded_offset (val), | |
1036 | addr, | |
1037 | stream, recurse, | |
1038 | val, options, NULL, 1); | |
373a8247 PM |
1039 | return; |
1040 | } | |
79a45b7d TT |
1041 | |
1042 | opts = *options; | |
1043 | opts.deref_ref = 0; | |
1044 | common_val_print (val, stream, recurse, &opts, current_language); | |
373a8247 PM |
1045 | } |
1046 | ||
3e43a32a MS |
1047 | /* -Wmissing-prototypes */ |
1048 | extern initialize_file_ftype _initialize_pascal_valprint; | |
373a8247 PM |
1049 | |
1050 | void | |
fba45db2 | 1051 | _initialize_pascal_valprint (void) |
373a8247 | 1052 | { |
5bf193a2 | 1053 | add_setshow_boolean_cmd ("pascal_static-members", class_support, |
79a45b7d | 1054 | &user_print_options.pascal_static_field_print, _("\ |
5bf193a2 AC |
1055 | Set printing of pascal static members."), _("\ |
1056 | Show printing of pascal static members."), NULL, | |
1057 | NULL, | |
920d2a44 | 1058 | show_pascal_static_field_print, |
5bf193a2 | 1059 | &setprintlist, &showprintlist); |
373a8247 | 1060 | } |