1 /* Support for printing Chill values for GDB, the GNU debugger.
2 Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
25 #include "expression.h"
29 /* Print data of type TYPE located at VALADDR (within GDB), which came from
30 the inferior at address ADDRESS, onto stdio stream STREAM according to
31 FORMAT (a letter or 0 for natural format). The data at VALADDR is in
34 If the data are a string pointer, returns the number of string characters
37 If DEREF_REF is nonzero, then dereference references, otherwise just print
40 The PRETTY parameter controls prettyprinting. */
43 chill_val_print (type
, valaddr
, address
, stream
, format
, deref_ref
, recurse
,
52 enum val_prettyprint pretty
;
59 switch (TYPE_CODE (type
))
62 if (TYPE_LENGTH (type
) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type
)) > 0)
64 elttype
= TYPE_TARGET_TYPE (type
);
65 eltlen
= TYPE_LENGTH (elttype
);
66 len
= TYPE_LENGTH (type
) / eltlen
;
67 if (prettyprint_arrays
)
69 print_spaces_filtered (2 + 2 * recurse
, stream
);
71 fprintf_filtered (stream
, "[");
72 /* For an array of chars, print with string syntax. */
73 if (eltlen
== 1 && TYPE_CODE (elttype
) == TYPE_CODE_INT
74 && (format
== 0 || format
== 's') )
76 LA_PRINT_STRING (stream
, valaddr
, len
, 0);
80 val_print_array_elements (type
, valaddr
, address
, stream
,
81 format
, deref_ref
, recurse
, pretty
, 0);
83 fprintf_filtered (stream
, "]");
87 error ("unimplemented in chill_val_print; unspecified array length");
92 format
= format
? format
: output_format
;
95 print_scalar_formatted (valaddr
, type
, format
, 0, stream
);
99 val_print_type_code_int (type
, valaddr
, stream
);
104 format
= format
? format
: output_format
;
107 print_scalar_formatted (valaddr
, type
, format
, 0, stream
);
111 LA_PRINT_CHAR ((unsigned char) unpack_long (type
, valaddr
),
119 print_scalar_formatted (valaddr
, type
, format
, 0, stream
);
123 print_floating (valaddr
, type
, stream
);
128 format
= format
? format
: output_format
;
131 print_scalar_formatted (valaddr
, type
, format
, 0, stream
);
135 val
= unpack_long (builtin_type_chill_bool
, valaddr
);
136 fprintf_filtered (stream
, val
? "TRUE" : "FALSE");
140 case TYPE_CODE_UNDEF
:
141 /* This happens (without TYPE_FLAG_STUB set) on systems which don't use
142 dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
143 and no complete type for struct foo in that file. */
144 fprintf_filtered (stream
, "<incomplete type>");
148 case TYPE_CODE_MEMBER
:
150 case TYPE_CODE_UNION
:
151 case TYPE_CODE_STRUCT
:
155 case TYPE_CODE_ERROR
:
156 case TYPE_CODE_RANGE
:
157 error ("Unimplemented chill_val_print support for type %d",
162 error ("Invalid Chill type code %d in symbol table.", TYPE_CODE (type
));
This page took 0.032181 seconds and 4 git commands to generate.