include/elf/
[deliverable/binutils-gdb.git] / gdb / c-lang.c
CommitLineData
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 37extern void _initialize_c_language (void);
d9fcf2fb 38static 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
44static void
f86f5ca3 45c_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
73void
fba45db2 74c_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
87void
fc1a4b47 88c_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}
ae6a3a4c
TJB
184
185/* Obtain a C string from the inferior storing it in a newly allocated
186 buffer in BUFFER, which should be freed by the caller. The string is
187 read until a null character is found. If VALUE is an array with known
188 length, the function will not read past the end of the array. LENGTH
189 will contain the size of the string in bytes (not counting the null
190 character).
191
192 Assumes strings are terminated by a null character. The size of a character
193 is determined by the length of the target type of the pointer or array.
194 This means that a null byte present in a multi-byte character will not
195 terminate the string unless the whole character is null.
196
197 CHARSET is always set to the target charset. */
198
199void
200c_get_string (struct value *value, gdb_byte **buffer, int *length,
201 const char **charset)
202{
203 int err, width;
204 unsigned int fetchlimit;
205 struct type *type = check_typedef (value_type (value));
206 struct type *element_type = TYPE_TARGET_TYPE (type);
207
208 if (element_type == NULL)
209 goto error;
210
211 if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
212 {
213 /* If we know the size of the array, we can use it as a limit on the
214 number of characters to be fetched. */
215 if (TYPE_NFIELDS (type) == 1
216 && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_RANGE)
217 {
218 LONGEST low_bound, high_bound;
219
220 get_discrete_bounds (TYPE_FIELD_TYPE (type, 0),
221 &low_bound, &high_bound);
222 fetchlimit = high_bound - low_bound + 1;
223 }
224 else
225 fetchlimit = UINT_MAX;
226 }
227 else if (TYPE_CODE (type) == TYPE_CODE_PTR)
228 fetchlimit = UINT_MAX;
229 else
230 /* We work only with arrays and pointers. */
231 goto error;
232
233 element_type = check_typedef (element_type);
234 if (TYPE_CODE (element_type) != TYPE_CODE_INT
235 && TYPE_CODE (element_type) != TYPE_CODE_CHAR)
236 /* If the elements are not integers or characters, we don't consider it
237 a string. */
238 goto error;
239
240 width = TYPE_LENGTH (element_type);
241
242 /* If the string lives in GDB's memory intead of the inferior's, then we
243 just need to copy it to BUFFER. Also, since such strings are arrays
244 with known size, FETCHLIMIT will hold the size of the array. */
245 if ((VALUE_LVAL (value) == not_lval
246 || VALUE_LVAL (value) == lval_internalvar)
247 && fetchlimit != UINT_MAX)
248 {
249 int i;
250 const gdb_byte *contents = value_contents (value);
251
252 /* Look for a null character. */
253 for (i = 0; i < fetchlimit; i++)
254 if (extract_unsigned_integer (contents + i * width, width) == 0)
255 break;
256
257 /* I is now either the number of non-null characters, or FETCHLIMIT. */
258 *length = i * width;
259 *buffer = xmalloc (*length);
260 memcpy (*buffer, contents, *length);
261 err = 0;
262 }
263 else
264 {
265 err = read_string (value_as_address (value), -1, width, fetchlimit,
266 buffer, length);
267 if (err)
268 {
269 xfree (buffer);
270 error (_("Error reading string from inferior: %s"),
271 safe_strerror (err));
272 }
273 }
274
275 /* If the last character is null, subtract it from LENGTH. */
276 if (*length > 0
277 && extract_unsigned_integer (*buffer + *length - width, width) == 0)
278 *length -= width;
279
280 *charset = target_charset ();
281
282 return;
283
284 error:
285 {
286 char *type_str;
287
288 type_str = type_to_string (type);
289 if (type_str)
290 {
291 make_cleanup (xfree, type_str);
292 error (_("Trying to read string with inappropriate type `%s'."),
293 type_str);
294 }
295 else
296 error (_("Trying to read string with inappropriate type."));
297 }
298}
299
c906108c 300\f
84f0252a 301/* Preprocessing and parsing C and C++ expressions. */
c5aa993b 302
84f0252a 303
84f0252a 304\f
c906108c
SS
305/* Table mapping opcodes into strings for printing operators
306 and precedences of the operators. */
307
308const struct op_print c_op_print_tab[] =
c5aa993b
JM
309{
310 {",", BINOP_COMMA, PREC_COMMA, 0},
311 {"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
312 {"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
313 {"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
314 {"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
315 {"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
316 {"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
317 {"==", BINOP_EQUAL, PREC_EQUAL, 0},
318 {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
319 {"<=", BINOP_LEQ, PREC_ORDER, 0},
320 {">=", BINOP_GEQ, PREC_ORDER, 0},
321 {">", BINOP_GTR, PREC_ORDER, 0},
322 {"<", BINOP_LESS, PREC_ORDER, 0},
323 {">>", BINOP_RSH, PREC_SHIFT, 0},
324 {"<<", BINOP_LSH, PREC_SHIFT, 0},
325 {"+", BINOP_ADD, PREC_ADD, 0},
326 {"-", BINOP_SUB, PREC_ADD, 0},
327 {"*", BINOP_MUL, PREC_MUL, 0},
328 {"/", BINOP_DIV, PREC_MUL, 0},
329 {"%", BINOP_REM, PREC_MUL, 0},
330 {"@", BINOP_REPEAT, PREC_REPEAT, 0},
331 {"-", UNOP_NEG, PREC_PREFIX, 0},
332 {"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
333 {"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
334 {"*", UNOP_IND, PREC_PREFIX, 0},
335 {"&", UNOP_ADDR, PREC_PREFIX, 0},
336 {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
337 {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
338 {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
c5aa993b 339 {NULL, 0, 0, 0}
c906108c
SS
340};
341\f
685419e2
AC
342enum c_primitive_types {
343 c_primitive_type_int,
344 c_primitive_type_long,
345 c_primitive_type_short,
346 c_primitive_type_char,
347 c_primitive_type_float,
348 c_primitive_type_double,
349 c_primitive_type_void,
350 c_primitive_type_long_long,
351 c_primitive_type_signed_char,
352 c_primitive_type_unsigned_char,
353 c_primitive_type_unsigned_short,
354 c_primitive_type_unsigned_int,
355 c_primitive_type_unsigned_long,
356 c_primitive_type_unsigned_long_long,
357 c_primitive_type_long_double,
358 c_primitive_type_complex,
359 c_primitive_type_double_complex,
213e4dc2
TJB
360 c_primitive_type_decfloat,
361 c_primitive_type_decdouble,
362 c_primitive_type_declong,
685419e2
AC
363 nr_c_primitive_types
364};
365
e9667a65 366void
685419e2
AC
367c_language_arch_info (struct gdbarch *gdbarch,
368 struct language_arch_info *lai)
369{
370 const struct builtin_type *builtin = builtin_type (gdbarch);
e9667a65 371 lai->string_char_type = builtin->builtin_char;
685419e2
AC
372 lai->primitive_type_vector
373 = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_c_primitive_types + 1,
374 struct type *);
375 lai->primitive_type_vector [c_primitive_type_int] = builtin->builtin_int;
376 lai->primitive_type_vector [c_primitive_type_long] = builtin->builtin_long;
377 lai->primitive_type_vector [c_primitive_type_short] = builtin->builtin_short;
378 lai->primitive_type_vector [c_primitive_type_char] = builtin->builtin_char;
379 lai->primitive_type_vector [c_primitive_type_float] = builtin->builtin_float;
380 lai->primitive_type_vector [c_primitive_type_double] = builtin->builtin_double;
381 lai->primitive_type_vector [c_primitive_type_void] = builtin->builtin_void;
382 lai->primitive_type_vector [c_primitive_type_long_long] = builtin->builtin_long_long;
383 lai->primitive_type_vector [c_primitive_type_signed_char] = builtin->builtin_signed_char;
384 lai->primitive_type_vector [c_primitive_type_unsigned_char] = builtin->builtin_unsigned_char;
385 lai->primitive_type_vector [c_primitive_type_unsigned_short] = builtin->builtin_unsigned_short;
386 lai->primitive_type_vector [c_primitive_type_unsigned_int] = builtin->builtin_unsigned_int;
387 lai->primitive_type_vector [c_primitive_type_unsigned_long] = builtin->builtin_unsigned_long;
388 lai->primitive_type_vector [c_primitive_type_unsigned_long_long] = builtin->builtin_unsigned_long_long;
389 lai->primitive_type_vector [c_primitive_type_long_double] = builtin->builtin_long_double;
390 lai->primitive_type_vector [c_primitive_type_complex] = builtin->builtin_complex;
391 lai->primitive_type_vector [c_primitive_type_double_complex] = builtin->builtin_double_complex;
213e4dc2
TJB
392 lai->primitive_type_vector [c_primitive_type_decfloat] = builtin->builtin_decfloat;
393 lai->primitive_type_vector [c_primitive_type_decdouble] = builtin->builtin_decdouble;
394 lai->primitive_type_vector [c_primitive_type_declong] = builtin->builtin_declong;
fbb06eb1
UW
395
396 lai->bool_type_default = builtin->builtin_int;
cad351d1 397}
685419e2 398
c5aa993b
JM
399const struct language_defn c_language_defn =
400{
c906108c
SS
401 "c", /* Language name */
402 language_c,
c906108c
SS
403 range_check_off,
404 type_check_off,
63872f9d 405 case_sensitive_on,
7ca2d3a3 406 array_row_major,
9a044a89 407 macro_expansion_c,
5f9769d1 408 &exp_descriptor_standard,
7c8adf68 409 c_parse,
c906108c 410 c_error,
e85c3284 411 null_post_parser,
c906108c
SS
412 c_printchar, /* Print a character constant */
413 c_printstr, /* Function to print string constant */
414 c_emit_char, /* Print a single char */
c906108c 415 c_print_type, /* Print a type using appropriate syntax */
5c6ce71d 416 c_print_typedef, /* Print a typedef using appropriate syntax */
c906108c
SS
417 c_val_print, /* Print a value using appropriate syntax */
418 c_value_print, /* Print a top-level value */
f636b87d 419 NULL, /* Language specific skip_trampoline */
2b2d9e11 420 NULL, /* name_of_this */
5f9a71c3 421 basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
b368761e 422 basic_lookup_transparent_type,/* lookup_transparent_type */
9a3d7dfd 423 NULL, /* Language specific symbol demangler */
31c27f77 424 NULL, /* Language specific class_name_from_physname */
c906108c
SS
425 c_op_print_tab, /* expression operators for printing */
426 1, /* c-style arrays */
427 0, /* String lower bound */
6084f43a 428 default_word_break_characters,
41d27058 429 default_make_symbol_completion_list,
685419e2 430 c_language_arch_info,
e79af960 431 default_print_array_index,
41f1b697 432 default_pass_by_reference,
ae6a3a4c 433 c_get_string,
c906108c
SS
434 LANG_MAGIC
435};
436
cad351d1
UW
437enum cplus_primitive_types {
438 cplus_primitive_type_int,
439 cplus_primitive_type_long,
440 cplus_primitive_type_short,
441 cplus_primitive_type_char,
442 cplus_primitive_type_float,
443 cplus_primitive_type_double,
444 cplus_primitive_type_void,
445 cplus_primitive_type_long_long,
446 cplus_primitive_type_signed_char,
447 cplus_primitive_type_unsigned_char,
448 cplus_primitive_type_unsigned_short,
449 cplus_primitive_type_unsigned_int,
450 cplus_primitive_type_unsigned_long,
451 cplus_primitive_type_unsigned_long_long,
452 cplus_primitive_type_long_double,
453 cplus_primitive_type_complex,
454 cplus_primitive_type_double_complex,
455 cplus_primitive_type_bool,
213e4dc2
TJB
456 cplus_primitive_type_decfloat,
457 cplus_primitive_type_decdouble,
458 cplus_primitive_type_declong,
cad351d1 459 nr_cplus_primitive_types
c906108c
SS
460};
461
cad351d1
UW
462static void
463cplus_language_arch_info (struct gdbarch *gdbarch,
464 struct language_arch_info *lai)
465{
466 const struct builtin_type *builtin = builtin_type (gdbarch);
467 lai->string_char_type = builtin->builtin_char;
468 lai->primitive_type_vector
469 = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_cplus_primitive_types + 1,
470 struct type *);
471 lai->primitive_type_vector [cplus_primitive_type_int]
472 = builtin->builtin_int;
473 lai->primitive_type_vector [cplus_primitive_type_long]
474 = builtin->builtin_long;
475 lai->primitive_type_vector [cplus_primitive_type_short]
476 = builtin->builtin_short;
477 lai->primitive_type_vector [cplus_primitive_type_char]
478 = builtin->builtin_char;
479 lai->primitive_type_vector [cplus_primitive_type_float]
480 = builtin->builtin_float;
481 lai->primitive_type_vector [cplus_primitive_type_double]
482 = builtin->builtin_double;
483 lai->primitive_type_vector [cplus_primitive_type_void]
484 = builtin->builtin_void;
485 lai->primitive_type_vector [cplus_primitive_type_long_long]
486 = builtin->builtin_long_long;
487 lai->primitive_type_vector [cplus_primitive_type_signed_char]
488 = builtin->builtin_signed_char;
489 lai->primitive_type_vector [cplus_primitive_type_unsigned_char]
490 = builtin->builtin_unsigned_char;
491 lai->primitive_type_vector [cplus_primitive_type_unsigned_short]
492 = builtin->builtin_unsigned_short;
493 lai->primitive_type_vector [cplus_primitive_type_unsigned_int]
494 = builtin->builtin_unsigned_int;
495 lai->primitive_type_vector [cplus_primitive_type_unsigned_long]
496 = builtin->builtin_unsigned_long;
497 lai->primitive_type_vector [cplus_primitive_type_unsigned_long_long]
498 = builtin->builtin_unsigned_long_long;
499 lai->primitive_type_vector [cplus_primitive_type_long_double]
500 = builtin->builtin_long_double;
501 lai->primitive_type_vector [cplus_primitive_type_complex]
502 = builtin->builtin_complex;
503 lai->primitive_type_vector [cplus_primitive_type_double_complex]
504 = builtin->builtin_double_complex;
505 lai->primitive_type_vector [cplus_primitive_type_bool]
506 = builtin->builtin_bool;
213e4dc2
TJB
507 lai->primitive_type_vector [cplus_primitive_type_decfloat]
508 = builtin->builtin_decfloat;
509 lai->primitive_type_vector [cplus_primitive_type_decdouble]
510 = builtin->builtin_decdouble;
511 lai->primitive_type_vector [cplus_primitive_type_declong]
512 = builtin->builtin_declong;
fbb06eb1
UW
513
514 lai->bool_type_symbol = "bool";
515 lai->bool_type_default = builtin->builtin_bool;
cad351d1
UW
516}
517
c5aa993b
JM
518const struct language_defn cplus_language_defn =
519{
520 "c++", /* Language name */
c906108c 521 language_cplus,
c906108c
SS
522 range_check_off,
523 type_check_off,
63872f9d 524 case_sensitive_on,
7ca2d3a3 525 array_row_major,
9a044a89 526 macro_expansion_c,
5f9769d1 527 &exp_descriptor_standard,
7c8adf68 528 c_parse,
c906108c 529 c_error,
e85c3284 530 null_post_parser,
c906108c
SS
531 c_printchar, /* Print a character constant */
532 c_printstr, /* Function to print string constant */
533 c_emit_char, /* Print a single char */
c906108c 534 c_print_type, /* Print a type using appropriate syntax */
5c6ce71d 535 c_print_typedef, /* Print a typedef using appropriate syntax */
c906108c
SS
536 c_val_print, /* Print a value using appropriate syntax */
537 c_value_print, /* Print a top-level value */
b18be20d 538 cplus_skip_trampoline, /* Language specific skip_trampoline */
2b2d9e11 539 "this", /* name_of_this */
1fcb5155 540 cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
b368761e 541 cp_lookup_transparent_type, /* lookup_transparent_type */
9a3d7dfd 542 cplus_demangle, /* Language specific symbol demangler */
31c27f77 543 cp_class_name_from_physname, /* Language specific class_name_from_physname */
c906108c
SS
544 c_op_print_tab, /* expression operators for printing */
545 1, /* c-style arrays */
546 0, /* String lower bound */
6084f43a 547 default_word_break_characters,
41d27058 548 default_make_symbol_completion_list,
cad351d1 549 cplus_language_arch_info,
e79af960 550 default_print_array_index,
41f1b697 551 cp_pass_by_reference,
ae6a3a4c 552 c_get_string,
c906108c
SS
553 LANG_MAGIC
554};
555
c5aa993b
JM
556const struct language_defn asm_language_defn =
557{
c906108c
SS
558 "asm", /* Language name */
559 language_asm,
c906108c
SS
560 range_check_off,
561 type_check_off,
63872f9d 562 case_sensitive_on,
7ca2d3a3 563 array_row_major,
9a044a89 564 macro_expansion_c,
5f9769d1 565 &exp_descriptor_standard,
7c8adf68 566 c_parse,
c906108c 567 c_error,
e85c3284 568 null_post_parser,
c906108c
SS
569 c_printchar, /* Print a character constant */
570 c_printstr, /* Function to print string constant */
571 c_emit_char, /* Print a single char */
c906108c 572 c_print_type, /* Print a type using appropriate syntax */
5c6ce71d 573 c_print_typedef, /* Print a typedef using appropriate syntax */
c906108c
SS
574 c_val_print, /* Print a value using appropriate syntax */
575 c_value_print, /* Print a top-level value */
f636b87d 576 NULL, /* Language specific skip_trampoline */
2b2d9e11 577 NULL, /* name_of_this */
5f9a71c3 578 basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
b368761e 579 basic_lookup_transparent_type,/* lookup_transparent_type */
9a3d7dfd 580 NULL, /* Language specific symbol demangler */
31c27f77 581 NULL, /* Language specific class_name_from_physname */
c906108c
SS
582 c_op_print_tab, /* expression operators for printing */
583 1, /* c-style arrays */
584 0, /* String lower bound */
6084f43a 585 default_word_break_characters,
41d27058 586 default_make_symbol_completion_list,
e9667a65 587 c_language_arch_info, /* FIXME: la_language_arch_info. */
e79af960 588 default_print_array_index,
41f1b697 589 default_pass_by_reference,
ae6a3a4c 590 c_get_string,
c906108c
SS
591 LANG_MAGIC
592};
593
20a0e81d
JB
594/* The following language_defn does not represent a real language.
595 It just provides a minimal support a-la-C that should allow users
596 to do some simple operations when debugging applications that use
597 a language currently not supported by GDB. */
598
599const struct language_defn minimal_language_defn =
600{
601 "minimal", /* Language name */
602 language_minimal,
20a0e81d
JB
603 range_check_off,
604 type_check_off,
605 case_sensitive_on,
7ca2d3a3 606 array_row_major,
9a044a89 607 macro_expansion_c,
5f9769d1 608 &exp_descriptor_standard,
7c8adf68 609 c_parse,
20a0e81d 610 c_error,
e85c3284 611 null_post_parser,
20a0e81d
JB
612 c_printchar, /* Print a character constant */
613 c_printstr, /* Function to print string constant */
614 c_emit_char, /* Print a single char */
20a0e81d 615 c_print_type, /* Print a type using appropriate syntax */
5c6ce71d 616 c_print_typedef, /* Print a typedef using appropriate syntax */
20a0e81d
JB
617 c_val_print, /* Print a value using appropriate syntax */
618 c_value_print, /* Print a top-level value */
619 NULL, /* Language specific skip_trampoline */
2b2d9e11 620 NULL, /* name_of_this */
5f9a71c3 621 basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
b368761e 622 basic_lookup_transparent_type,/* lookup_transparent_type */
20a0e81d 623 NULL, /* Language specific symbol demangler */
31c27f77 624 NULL, /* Language specific class_name_from_physname */
20a0e81d
JB
625 c_op_print_tab, /* expression operators for printing */
626 1, /* c-style arrays */
627 0, /* String lower bound */
6084f43a 628 default_word_break_characters,
41d27058 629 default_make_symbol_completion_list,
e9667a65 630 c_language_arch_info,
e79af960 631 default_print_array_index,
41f1b697 632 default_pass_by_reference,
ae6a3a4c 633 c_get_string,
20a0e81d
JB
634 LANG_MAGIC
635};
636
c906108c 637void
fba45db2 638_initialize_c_language (void)
c906108c
SS
639{
640 add_language (&c_language_defn);
641 add_language (&cplus_language_defn);
642 add_language (&asm_language_defn);
20a0e81d 643 add_language (&minimal_language_defn);
c906108c 644}
This page took 0.577333 seconds and 4 git commands to generate.