Commit | Line | Data |
---|---|---|
c906108c | 1 | /* C language support routines for GDB, the GNU debugger. |
ce27fb25 | 2 | |
6aba47ca | 3 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003, |
0fb0cc75 | 4 | 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. |
c906108c | 5 | |
c5aa993b | 6 | This file is part of GDB. |
c906108c | 7 | |
c5aa993b JM |
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 |
c5aa993b | 11 | (at your option) any later version. |
c906108c | 12 | |
c5aa993b JM |
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. | |
c906108c | 17 | |
c5aa993b | 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/>. */ |
c906108c SS |
20 | |
21 | #include "defs.h" | |
22 | #include "symtab.h" | |
23 | #include "gdbtypes.h" | |
24 | #include "expression.h" | |
25 | #include "parser-defs.h" | |
26 | #include "language.h" | |
27 | #include "c-lang.h" | |
745b8ca0 | 28 | #include "valprint.h" |
84f0252a JB |
29 | #include "macroscope.h" |
30 | #include "gdb_assert.h" | |
234b45d4 | 31 | #include "charset.h" |
a15ef5f5 | 32 | #include "gdb_string.h" |
9a3d7dfd | 33 | #include "demangle.h" |
b18be20d | 34 | #include "cp-abi.h" |
1fcb5155 | 35 | #include "cp-support.h" |
c906108c | 36 | |
a14ed312 | 37 | extern void _initialize_c_language (void); |
d9fcf2fb | 38 | static void c_emit_char (int c, struct ui_file * stream, int quoter); |
c906108c SS |
39 | |
40 | /* Print the character C on STREAM as part of the contents of a literal | |
41 | string whose delimiter is QUOTER. Note that that format for printing | |
42 | characters and strings is language specific. */ | |
43 | ||
44 | static void | |
f86f5ca3 | 45 | c_emit_char (int c, struct ui_file *stream, int quoter) |
c906108c | 46 | { |
234b45d4 KB |
47 | const char *escape; |
48 | int host_char; | |
49 | ||
c906108c SS |
50 | c &= 0xFF; /* Avoid sign bit follies */ |
51 | ||
234b45d4 KB |
52 | escape = c_target_char_has_backslash_escape (c); |
53 | if (escape) | |
c906108c | 54 | { |
234b45d4 KB |
55 | if (quoter == '"' && strcmp (escape, "0") == 0) |
56 | /* Print nulls embedded in double quoted strings as \000 to | |
57 | prevent ambiguity. */ | |
58 | fprintf_filtered (stream, "\\000"); | |
59 | else | |
60 | fprintf_filtered (stream, "\\%s", escape); | |
c906108c | 61 | } |
234b45d4 KB |
62 | else if (target_char_to_host (c, &host_char) |
63 | && host_char_print_literally (host_char)) | |
c906108c | 64 | { |
234b45d4 KB |
65 | if (host_char == '\\' || host_char == quoter) |
66 | fputs_filtered ("\\", stream); | |
67 | fprintf_filtered (stream, "%c", host_char); | |
c906108c | 68 | } |
234b45d4 KB |
69 | else |
70 | fprintf_filtered (stream, "\\%.3o", (unsigned int) c); | |
c906108c SS |
71 | } |
72 | ||
73 | void | |
fba45db2 | 74 | c_printchar (int c, struct ui_file *stream) |
c906108c SS |
75 | { |
76 | fputc_filtered ('\'', stream); | |
77 | LA_EMIT_CHAR (c, stream, '\''); | |
78 | fputc_filtered ('\'', stream); | |
79 | } | |
80 | ||
81 | /* Print the character string STRING, printing at most LENGTH characters. | |
82 | LENGTH is -1 if the string is nul terminated. Each character is WIDTH bytes | |
83 | long. Printing stops early if the number hits print_max; repeat counts are | |
84 | printed as appropriate. Print ellipses at the end if we had to stop before | |
85 | printing LENGTH characters, or if FORCE_ELLIPSES. */ | |
86 | ||
87 | void | |
fc1a4b47 | 88 | c_printstr (struct ui_file *stream, const gdb_byte *string, |
79a45b7d TT |
89 | unsigned int length, int width, int force_ellipses, |
90 | const struct value_print_options *options) | |
c906108c | 91 | { |
f86f5ca3 | 92 | unsigned int i; |
c906108c SS |
93 | unsigned int things_printed = 0; |
94 | int in_quotes = 0; | |
95 | int need_comma = 0; | |
c906108c SS |
96 | |
97 | /* If the string was not truncated due to `set print elements', and | |
98 | the last byte of it is a null, we don't print that, in traditional C | |
99 | style. */ | |
100 | if (!force_ellipses | |
101 | && length > 0 | |
78a51202 JB |
102 | && (extract_unsigned_integer (string + (length - 1) * width, width) |
103 | == '\0')) | |
c906108c SS |
104 | length--; |
105 | ||
106 | if (length == 0) | |
107 | { | |
108 | fputs_filtered ("\"\"", stream); | |
109 | return; | |
110 | } | |
111 | ||
79a45b7d | 112 | for (i = 0; i < length && things_printed < options->print_max; ++i) |
c906108c SS |
113 | { |
114 | /* Position of the character we are examining | |
c5aa993b | 115 | to see whether it is repeated. */ |
c906108c SS |
116 | unsigned int rep1; |
117 | /* Number of repetitions we have detected so far. */ | |
118 | unsigned int reps; | |
119 | unsigned long current_char; | |
120 | ||
121 | QUIT; | |
122 | ||
123 | if (need_comma) | |
124 | { | |
125 | fputs_filtered (", ", stream); | |
126 | need_comma = 0; | |
127 | } | |
128 | ||
129 | current_char = extract_unsigned_integer (string + i * width, width); | |
130 | ||
131 | rep1 = i + 1; | |
132 | reps = 1; | |
133 | while (rep1 < length | |
134 | && extract_unsigned_integer (string + rep1 * width, width) | |
c5aa993b | 135 | == current_char) |
c906108c SS |
136 | { |
137 | ++rep1; | |
138 | ++reps; | |
139 | } | |
140 | ||
79a45b7d | 141 | if (reps > options->repeat_count_threshold) |
c906108c SS |
142 | { |
143 | if (in_quotes) | |
144 | { | |
79a45b7d | 145 | if (options->inspect_it) |
c906108c SS |
146 | fputs_filtered ("\\\", ", stream); |
147 | else | |
148 | fputs_filtered ("\", ", stream); | |
149 | in_quotes = 0; | |
150 | } | |
151 | LA_PRINT_CHAR (current_char, stream); | |
3d263c1d | 152 | fprintf_filtered (stream, _(" <repeats %u times>"), reps); |
c906108c | 153 | i = rep1 - 1; |
79a45b7d | 154 | things_printed += options->repeat_count_threshold; |
c906108c SS |
155 | need_comma = 1; |
156 | } | |
157 | else | |
158 | { | |
159 | if (!in_quotes) | |
160 | { | |
79a45b7d | 161 | if (options->inspect_it) |
c906108c SS |
162 | fputs_filtered ("\\\"", stream); |
163 | else | |
164 | fputs_filtered ("\"", stream); | |
165 | in_quotes = 1; | |
166 | } | |
167 | LA_EMIT_CHAR (current_char, stream, '"'); | |
168 | ++things_printed; | |
169 | } | |
170 | } | |
171 | ||
172 | /* Terminate the quotes if necessary. */ | |
173 | if (in_quotes) | |
174 | { | |
79a45b7d | 175 | if (options->inspect_it) |
c906108c SS |
176 | fputs_filtered ("\\\"", stream); |
177 | else | |
178 | fputs_filtered ("\"", stream); | |
179 | } | |
180 | ||
181 | if (force_ellipses || i < length) | |
182 | fputs_filtered ("...", stream); | |
183 | } | |
c906108c | 184 | \f |
84f0252a | 185 | /* Preprocessing and parsing C and C++ expressions. */ |
c5aa993b | 186 | |
84f0252a | 187 | |
84f0252a | 188 | \f |
c906108c SS |
189 | /* Table mapping opcodes into strings for printing operators |
190 | and precedences of the operators. */ | |
191 | ||
192 | const struct op_print c_op_print_tab[] = | |
c5aa993b JM |
193 | { |
194 | {",", BINOP_COMMA, PREC_COMMA, 0}, | |
195 | {"=", BINOP_ASSIGN, PREC_ASSIGN, 1}, | |
196 | {"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0}, | |
197 | {"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0}, | |
198 | {"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0}, | |
199 | {"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0}, | |
200 | {"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0}, | |
201 | {"==", BINOP_EQUAL, PREC_EQUAL, 0}, | |
202 | {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0}, | |
203 | {"<=", BINOP_LEQ, PREC_ORDER, 0}, | |
204 | {">=", BINOP_GEQ, PREC_ORDER, 0}, | |
205 | {">", BINOP_GTR, PREC_ORDER, 0}, | |
206 | {"<", BINOP_LESS, PREC_ORDER, 0}, | |
207 | {">>", BINOP_RSH, PREC_SHIFT, 0}, | |
208 | {"<<", BINOP_LSH, PREC_SHIFT, 0}, | |
209 | {"+", BINOP_ADD, PREC_ADD, 0}, | |
210 | {"-", BINOP_SUB, PREC_ADD, 0}, | |
211 | {"*", BINOP_MUL, PREC_MUL, 0}, | |
212 | {"/", BINOP_DIV, PREC_MUL, 0}, | |
213 | {"%", BINOP_REM, PREC_MUL, 0}, | |
214 | {"@", BINOP_REPEAT, PREC_REPEAT, 0}, | |
215 | {"-", UNOP_NEG, PREC_PREFIX, 0}, | |
216 | {"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0}, | |
217 | {"~", UNOP_COMPLEMENT, PREC_PREFIX, 0}, | |
218 | {"*", UNOP_IND, PREC_PREFIX, 0}, | |
219 | {"&", UNOP_ADDR, PREC_PREFIX, 0}, | |
220 | {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0}, | |
221 | {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0}, | |
222 | {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0}, | |
c5aa993b | 223 | {NULL, 0, 0, 0} |
c906108c SS |
224 | }; |
225 | \f | |
685419e2 AC |
226 | enum c_primitive_types { |
227 | c_primitive_type_int, | |
228 | c_primitive_type_long, | |
229 | c_primitive_type_short, | |
230 | c_primitive_type_char, | |
231 | c_primitive_type_float, | |
232 | c_primitive_type_double, | |
233 | c_primitive_type_void, | |
234 | c_primitive_type_long_long, | |
235 | c_primitive_type_signed_char, | |
236 | c_primitive_type_unsigned_char, | |
237 | c_primitive_type_unsigned_short, | |
238 | c_primitive_type_unsigned_int, | |
239 | c_primitive_type_unsigned_long, | |
240 | c_primitive_type_unsigned_long_long, | |
241 | c_primitive_type_long_double, | |
242 | c_primitive_type_complex, | |
243 | c_primitive_type_double_complex, | |
213e4dc2 TJB |
244 | c_primitive_type_decfloat, |
245 | c_primitive_type_decdouble, | |
246 | c_primitive_type_declong, | |
685419e2 AC |
247 | nr_c_primitive_types |
248 | }; | |
249 | ||
e9667a65 | 250 | void |
685419e2 AC |
251 | c_language_arch_info (struct gdbarch *gdbarch, |
252 | struct language_arch_info *lai) | |
253 | { | |
254 | const struct builtin_type *builtin = builtin_type (gdbarch); | |
e9667a65 | 255 | lai->string_char_type = builtin->builtin_char; |
685419e2 AC |
256 | lai->primitive_type_vector |
257 | = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_c_primitive_types + 1, | |
258 | struct type *); | |
259 | lai->primitive_type_vector [c_primitive_type_int] = builtin->builtin_int; | |
260 | lai->primitive_type_vector [c_primitive_type_long] = builtin->builtin_long; | |
261 | lai->primitive_type_vector [c_primitive_type_short] = builtin->builtin_short; | |
262 | lai->primitive_type_vector [c_primitive_type_char] = builtin->builtin_char; | |
263 | lai->primitive_type_vector [c_primitive_type_float] = builtin->builtin_float; | |
264 | lai->primitive_type_vector [c_primitive_type_double] = builtin->builtin_double; | |
265 | lai->primitive_type_vector [c_primitive_type_void] = builtin->builtin_void; | |
266 | lai->primitive_type_vector [c_primitive_type_long_long] = builtin->builtin_long_long; | |
267 | lai->primitive_type_vector [c_primitive_type_signed_char] = builtin->builtin_signed_char; | |
268 | lai->primitive_type_vector [c_primitive_type_unsigned_char] = builtin->builtin_unsigned_char; | |
269 | lai->primitive_type_vector [c_primitive_type_unsigned_short] = builtin->builtin_unsigned_short; | |
270 | lai->primitive_type_vector [c_primitive_type_unsigned_int] = builtin->builtin_unsigned_int; | |
271 | lai->primitive_type_vector [c_primitive_type_unsigned_long] = builtin->builtin_unsigned_long; | |
272 | lai->primitive_type_vector [c_primitive_type_unsigned_long_long] = builtin->builtin_unsigned_long_long; | |
273 | lai->primitive_type_vector [c_primitive_type_long_double] = builtin->builtin_long_double; | |
274 | lai->primitive_type_vector [c_primitive_type_complex] = builtin->builtin_complex; | |
275 | lai->primitive_type_vector [c_primitive_type_double_complex] = builtin->builtin_double_complex; | |
213e4dc2 TJB |
276 | lai->primitive_type_vector [c_primitive_type_decfloat] = builtin->builtin_decfloat; |
277 | lai->primitive_type_vector [c_primitive_type_decdouble] = builtin->builtin_decdouble; | |
278 | lai->primitive_type_vector [c_primitive_type_declong] = builtin->builtin_declong; | |
fbb06eb1 UW |
279 | |
280 | lai->bool_type_default = builtin->builtin_int; | |
cad351d1 | 281 | } |
685419e2 | 282 | |
c5aa993b JM |
283 | const struct language_defn c_language_defn = |
284 | { | |
c906108c SS |
285 | "c", /* Language name */ |
286 | language_c, | |
c906108c SS |
287 | range_check_off, |
288 | type_check_off, | |
63872f9d | 289 | case_sensitive_on, |
7ca2d3a3 | 290 | array_row_major, |
9a044a89 | 291 | macro_expansion_c, |
5f9769d1 | 292 | &exp_descriptor_standard, |
7c8adf68 | 293 | c_parse, |
c906108c | 294 | c_error, |
e85c3284 | 295 | null_post_parser, |
c906108c SS |
296 | c_printchar, /* Print a character constant */ |
297 | c_printstr, /* Function to print string constant */ | |
298 | c_emit_char, /* Print a single char */ | |
c906108c | 299 | c_print_type, /* Print a type using appropriate syntax */ |
5c6ce71d | 300 | c_print_typedef, /* Print a typedef using appropriate syntax */ |
c906108c SS |
301 | c_val_print, /* Print a value using appropriate syntax */ |
302 | c_value_print, /* Print a top-level value */ | |
f636b87d | 303 | NULL, /* Language specific skip_trampoline */ |
2b2d9e11 | 304 | NULL, /* name_of_this */ |
5f9a71c3 | 305 | basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ |
b368761e | 306 | basic_lookup_transparent_type,/* lookup_transparent_type */ |
9a3d7dfd | 307 | NULL, /* Language specific symbol demangler */ |
31c27f77 | 308 | NULL, /* Language specific class_name_from_physname */ |
c906108c SS |
309 | c_op_print_tab, /* expression operators for printing */ |
310 | 1, /* c-style arrays */ | |
311 | 0, /* String lower bound */ | |
6084f43a | 312 | default_word_break_characters, |
41d27058 | 313 | default_make_symbol_completion_list, |
685419e2 | 314 | c_language_arch_info, |
e79af960 | 315 | default_print_array_index, |
41f1b697 | 316 | default_pass_by_reference, |
c906108c SS |
317 | LANG_MAGIC |
318 | }; | |
319 | ||
cad351d1 UW |
320 | enum cplus_primitive_types { |
321 | cplus_primitive_type_int, | |
322 | cplus_primitive_type_long, | |
323 | cplus_primitive_type_short, | |
324 | cplus_primitive_type_char, | |
325 | cplus_primitive_type_float, | |
326 | cplus_primitive_type_double, | |
327 | cplus_primitive_type_void, | |
328 | cplus_primitive_type_long_long, | |
329 | cplus_primitive_type_signed_char, | |
330 | cplus_primitive_type_unsigned_char, | |
331 | cplus_primitive_type_unsigned_short, | |
332 | cplus_primitive_type_unsigned_int, | |
333 | cplus_primitive_type_unsigned_long, | |
334 | cplus_primitive_type_unsigned_long_long, | |
335 | cplus_primitive_type_long_double, | |
336 | cplus_primitive_type_complex, | |
337 | cplus_primitive_type_double_complex, | |
338 | cplus_primitive_type_bool, | |
213e4dc2 TJB |
339 | cplus_primitive_type_decfloat, |
340 | cplus_primitive_type_decdouble, | |
341 | cplus_primitive_type_declong, | |
cad351d1 | 342 | nr_cplus_primitive_types |
c906108c SS |
343 | }; |
344 | ||
cad351d1 UW |
345 | static void |
346 | cplus_language_arch_info (struct gdbarch *gdbarch, | |
347 | struct language_arch_info *lai) | |
348 | { | |
349 | const struct builtin_type *builtin = builtin_type (gdbarch); | |
350 | lai->string_char_type = builtin->builtin_char; | |
351 | lai->primitive_type_vector | |
352 | = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_cplus_primitive_types + 1, | |
353 | struct type *); | |
354 | lai->primitive_type_vector [cplus_primitive_type_int] | |
355 | = builtin->builtin_int; | |
356 | lai->primitive_type_vector [cplus_primitive_type_long] | |
357 | = builtin->builtin_long; | |
358 | lai->primitive_type_vector [cplus_primitive_type_short] | |
359 | = builtin->builtin_short; | |
360 | lai->primitive_type_vector [cplus_primitive_type_char] | |
361 | = builtin->builtin_char; | |
362 | lai->primitive_type_vector [cplus_primitive_type_float] | |
363 | = builtin->builtin_float; | |
364 | lai->primitive_type_vector [cplus_primitive_type_double] | |
365 | = builtin->builtin_double; | |
366 | lai->primitive_type_vector [cplus_primitive_type_void] | |
367 | = builtin->builtin_void; | |
368 | lai->primitive_type_vector [cplus_primitive_type_long_long] | |
369 | = builtin->builtin_long_long; | |
370 | lai->primitive_type_vector [cplus_primitive_type_signed_char] | |
371 | = builtin->builtin_signed_char; | |
372 | lai->primitive_type_vector [cplus_primitive_type_unsigned_char] | |
373 | = builtin->builtin_unsigned_char; | |
374 | lai->primitive_type_vector [cplus_primitive_type_unsigned_short] | |
375 | = builtin->builtin_unsigned_short; | |
376 | lai->primitive_type_vector [cplus_primitive_type_unsigned_int] | |
377 | = builtin->builtin_unsigned_int; | |
378 | lai->primitive_type_vector [cplus_primitive_type_unsigned_long] | |
379 | = builtin->builtin_unsigned_long; | |
380 | lai->primitive_type_vector [cplus_primitive_type_unsigned_long_long] | |
381 | = builtin->builtin_unsigned_long_long; | |
382 | lai->primitive_type_vector [cplus_primitive_type_long_double] | |
383 | = builtin->builtin_long_double; | |
384 | lai->primitive_type_vector [cplus_primitive_type_complex] | |
385 | = builtin->builtin_complex; | |
386 | lai->primitive_type_vector [cplus_primitive_type_double_complex] | |
387 | = builtin->builtin_double_complex; | |
388 | lai->primitive_type_vector [cplus_primitive_type_bool] | |
389 | = builtin->builtin_bool; | |
213e4dc2 TJB |
390 | lai->primitive_type_vector [cplus_primitive_type_decfloat] |
391 | = builtin->builtin_decfloat; | |
392 | lai->primitive_type_vector [cplus_primitive_type_decdouble] | |
393 | = builtin->builtin_decdouble; | |
394 | lai->primitive_type_vector [cplus_primitive_type_declong] | |
395 | = builtin->builtin_declong; | |
fbb06eb1 UW |
396 | |
397 | lai->bool_type_symbol = "bool"; | |
398 | lai->bool_type_default = builtin->builtin_bool; | |
cad351d1 UW |
399 | } |
400 | ||
c5aa993b JM |
401 | const struct language_defn cplus_language_defn = |
402 | { | |
403 | "c++", /* Language name */ | |
c906108c | 404 | language_cplus, |
c906108c SS |
405 | range_check_off, |
406 | type_check_off, | |
63872f9d | 407 | case_sensitive_on, |
7ca2d3a3 | 408 | array_row_major, |
9a044a89 | 409 | macro_expansion_c, |
5f9769d1 | 410 | &exp_descriptor_standard, |
7c8adf68 | 411 | c_parse, |
c906108c | 412 | c_error, |
e85c3284 | 413 | null_post_parser, |
c906108c SS |
414 | c_printchar, /* Print a character constant */ |
415 | c_printstr, /* Function to print string constant */ | |
416 | c_emit_char, /* Print a single char */ | |
c906108c | 417 | c_print_type, /* Print a type using appropriate syntax */ |
5c6ce71d | 418 | c_print_typedef, /* Print a typedef using appropriate syntax */ |
c906108c SS |
419 | c_val_print, /* Print a value using appropriate syntax */ |
420 | c_value_print, /* Print a top-level value */ | |
b18be20d | 421 | cplus_skip_trampoline, /* Language specific skip_trampoline */ |
2b2d9e11 | 422 | "this", /* name_of_this */ |
1fcb5155 | 423 | cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ |
b368761e | 424 | cp_lookup_transparent_type, /* lookup_transparent_type */ |
9a3d7dfd | 425 | cplus_demangle, /* Language specific symbol demangler */ |
31c27f77 | 426 | cp_class_name_from_physname, /* Language specific class_name_from_physname */ |
c906108c SS |
427 | c_op_print_tab, /* expression operators for printing */ |
428 | 1, /* c-style arrays */ | |
429 | 0, /* String lower bound */ | |
6084f43a | 430 | default_word_break_characters, |
41d27058 | 431 | default_make_symbol_completion_list, |
cad351d1 | 432 | cplus_language_arch_info, |
e79af960 | 433 | default_print_array_index, |
41f1b697 | 434 | cp_pass_by_reference, |
c906108c SS |
435 | LANG_MAGIC |
436 | }; | |
437 | ||
c5aa993b JM |
438 | const struct language_defn asm_language_defn = |
439 | { | |
c906108c SS |
440 | "asm", /* Language name */ |
441 | language_asm, | |
c906108c SS |
442 | range_check_off, |
443 | type_check_off, | |
63872f9d | 444 | case_sensitive_on, |
7ca2d3a3 | 445 | array_row_major, |
9a044a89 | 446 | macro_expansion_c, |
5f9769d1 | 447 | &exp_descriptor_standard, |
7c8adf68 | 448 | c_parse, |
c906108c | 449 | c_error, |
e85c3284 | 450 | null_post_parser, |
c906108c SS |
451 | c_printchar, /* Print a character constant */ |
452 | c_printstr, /* Function to print string constant */ | |
453 | c_emit_char, /* Print a single char */ | |
c906108c | 454 | c_print_type, /* Print a type using appropriate syntax */ |
5c6ce71d | 455 | c_print_typedef, /* Print a typedef using appropriate syntax */ |
c906108c SS |
456 | c_val_print, /* Print a value using appropriate syntax */ |
457 | c_value_print, /* Print a top-level value */ | |
f636b87d | 458 | NULL, /* Language specific skip_trampoline */ |
2b2d9e11 | 459 | NULL, /* name_of_this */ |
5f9a71c3 | 460 | basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ |
b368761e | 461 | basic_lookup_transparent_type,/* lookup_transparent_type */ |
9a3d7dfd | 462 | NULL, /* Language specific symbol demangler */ |
31c27f77 | 463 | NULL, /* Language specific class_name_from_physname */ |
c906108c SS |
464 | c_op_print_tab, /* expression operators for printing */ |
465 | 1, /* c-style arrays */ | |
466 | 0, /* String lower bound */ | |
6084f43a | 467 | default_word_break_characters, |
41d27058 | 468 | default_make_symbol_completion_list, |
e9667a65 | 469 | c_language_arch_info, /* FIXME: la_language_arch_info. */ |
e79af960 | 470 | default_print_array_index, |
41f1b697 | 471 | default_pass_by_reference, |
c906108c SS |
472 | LANG_MAGIC |
473 | }; | |
474 | ||
20a0e81d JB |
475 | /* The following language_defn does not represent a real language. |
476 | It just provides a minimal support a-la-C that should allow users | |
477 | to do some simple operations when debugging applications that use | |
478 | a language currently not supported by GDB. */ | |
479 | ||
480 | const struct language_defn minimal_language_defn = | |
481 | { | |
482 | "minimal", /* Language name */ | |
483 | language_minimal, | |
20a0e81d JB |
484 | range_check_off, |
485 | type_check_off, | |
486 | case_sensitive_on, | |
7ca2d3a3 | 487 | array_row_major, |
9a044a89 | 488 | macro_expansion_c, |
5f9769d1 | 489 | &exp_descriptor_standard, |
7c8adf68 | 490 | c_parse, |
20a0e81d | 491 | c_error, |
e85c3284 | 492 | null_post_parser, |
20a0e81d JB |
493 | c_printchar, /* Print a character constant */ |
494 | c_printstr, /* Function to print string constant */ | |
495 | c_emit_char, /* Print a single char */ | |
20a0e81d | 496 | c_print_type, /* Print a type using appropriate syntax */ |
5c6ce71d | 497 | c_print_typedef, /* Print a typedef using appropriate syntax */ |
20a0e81d JB |
498 | c_val_print, /* Print a value using appropriate syntax */ |
499 | c_value_print, /* Print a top-level value */ | |
500 | NULL, /* Language specific skip_trampoline */ | |
2b2d9e11 | 501 | NULL, /* name_of_this */ |
5f9a71c3 | 502 | basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ |
b368761e | 503 | basic_lookup_transparent_type,/* lookup_transparent_type */ |
20a0e81d | 504 | NULL, /* Language specific symbol demangler */ |
31c27f77 | 505 | NULL, /* Language specific class_name_from_physname */ |
20a0e81d JB |
506 | c_op_print_tab, /* expression operators for printing */ |
507 | 1, /* c-style arrays */ | |
508 | 0, /* String lower bound */ | |
6084f43a | 509 | default_word_break_characters, |
41d27058 | 510 | default_make_symbol_completion_list, |
e9667a65 | 511 | c_language_arch_info, |
e79af960 | 512 | default_print_array_index, |
41f1b697 | 513 | default_pass_by_reference, |
20a0e81d JB |
514 | LANG_MAGIC |
515 | }; | |
516 | ||
c906108c | 517 | void |
fba45db2 | 518 | _initialize_c_language (void) |
c906108c SS |
519 | { |
520 | add_language (&c_language_defn); | |
521 | add_language (&cplus_language_defn); | |
522 | add_language (&asm_language_defn); | |
20a0e81d | 523 | add_language (&minimal_language_defn); |
c906108c | 524 | } |