* dwarf2read.c (dwarf2_get_subprogram_pc_bounds): New function.
[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,
9b254dd1 4 2004, 2005, 2007, 2008 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,
ce27fb25 89 unsigned int length, int width, int force_ellipses)
c906108c 90{
f86f5ca3 91 unsigned int i;
c906108c
SS
92 unsigned int things_printed = 0;
93 int in_quotes = 0;
94 int need_comma = 0;
c906108c
SS
95
96 /* If the string was not truncated due to `set print elements', and
97 the last byte of it is a null, we don't print that, in traditional C
98 style. */
99 if (!force_ellipses
100 && length > 0
78a51202
JB
101 && (extract_unsigned_integer (string + (length - 1) * width, width)
102 == '\0'))
c906108c
SS
103 length--;
104
105 if (length == 0)
106 {
107 fputs_filtered ("\"\"", stream);
108 return;
109 }
110
111 for (i = 0; i < length && things_printed < print_max; ++i)
112 {
113 /* Position of the character we are examining
c5aa993b 114 to see whether it is repeated. */
c906108c
SS
115 unsigned int rep1;
116 /* Number of repetitions we have detected so far. */
117 unsigned int reps;
118 unsigned long current_char;
119
120 QUIT;
121
122 if (need_comma)
123 {
124 fputs_filtered (", ", stream);
125 need_comma = 0;
126 }
127
128 current_char = extract_unsigned_integer (string + i * width, width);
129
130 rep1 = i + 1;
131 reps = 1;
132 while (rep1 < length
133 && extract_unsigned_integer (string + rep1 * width, width)
c5aa993b 134 == current_char)
c906108c
SS
135 {
136 ++rep1;
137 ++reps;
138 }
139
140 if (reps > repeat_count_threshold)
141 {
142 if (in_quotes)
143 {
144 if (inspect_it)
145 fputs_filtered ("\\\", ", stream);
146 else
147 fputs_filtered ("\", ", stream);
148 in_quotes = 0;
149 }
150 LA_PRINT_CHAR (current_char, stream);
3d263c1d 151 fprintf_filtered (stream, _(" <repeats %u times>"), reps);
c906108c
SS
152 i = rep1 - 1;
153 things_printed += repeat_count_threshold;
154 need_comma = 1;
155 }
156 else
157 {
158 if (!in_quotes)
159 {
160 if (inspect_it)
161 fputs_filtered ("\\\"", stream);
162 else
163 fputs_filtered ("\"", stream);
164 in_quotes = 1;
165 }
166 LA_EMIT_CHAR (current_char, stream, '"');
167 ++things_printed;
168 }
169 }
170
171 /* Terminate the quotes if necessary. */
172 if (in_quotes)
173 {
174 if (inspect_it)
175 fputs_filtered ("\\\"", stream);
176 else
177 fputs_filtered ("\"", stream);
178 }
179
180 if (force_ellipses || i < length)
181 fputs_filtered ("...", stream);
182}
c906108c 183\f
84f0252a 184/* Preprocessing and parsing C and C++ expressions. */
c5aa993b 185
84f0252a
JB
186
187/* When we find that lexptr (the global var defined in parse.c) is
188 pointing at a macro invocation, we expand the invocation, and call
189 scan_macro_expansion to save the old lexptr here and point lexptr
190 into the expanded text. When we reach the end of that, we call
191 end_macro_expansion to pop back to the value we saved here. The
192 macro expansion code promises to return only fully-expanded text,
193 so we don't need to "push" more than one level.
194
195 This is disgusting, of course. It would be cleaner to do all macro
196 expansion beforehand, and then hand that to lexptr. But we don't
197 really know where the expression ends. Remember, in a command like
198
199 (gdb) break *ADDRESS if CONDITION
200
201 we evaluate ADDRESS in the scope of the current frame, but we
202 evaluate CONDITION in the scope of the breakpoint's location. So
203 it's simply wrong to try to macro-expand the whole thing at once. */
204static char *macro_original_text;
205static char *macro_expanded_text;
206
207
208void
209scan_macro_expansion (char *expansion)
210{
211 /* We'd better not be trying to push the stack twice. */
212 gdb_assert (! macro_original_text);
213 gdb_assert (! macro_expanded_text);
214
215 /* Save the old lexptr value, so we can return to it when we're done
216 parsing the expanded text. */
217 macro_original_text = lexptr;
218 lexptr = expansion;
219
220 /* Save the expanded text, so we can free it when we're finished. */
221 macro_expanded_text = expansion;
222}
223
224
225int
5ae5f592 226scanning_macro_expansion (void)
84f0252a
JB
227{
228 return macro_original_text != 0;
229}
230
231
232void
5ae5f592 233finished_macro_expansion (void)
84f0252a
JB
234{
235 /* There'd better be something to pop back to, and we better have
236 saved a pointer to the start of the expanded text. */
237 gdb_assert (macro_original_text);
238 gdb_assert (macro_expanded_text);
239
240 /* Pop back to the original text. */
241 lexptr = macro_original_text;
242 macro_original_text = 0;
243
244 /* Free the expanded text. */
245 xfree (macro_expanded_text);
246 macro_expanded_text = 0;
247}
248
249
250static void
251scan_macro_cleanup (void *dummy)
252{
253 if (macro_original_text)
254 finished_macro_expansion ();
255}
256
257
258/* We set these global variables before calling c_parse, to tell it
259 how it to find macro definitions for the expression at hand. */
260macro_lookup_ftype *expression_macro_lookup_func;
261void *expression_macro_lookup_baton;
262
263
84f0252a 264static int
5ae5f592 265c_preprocess_and_parse (void)
84f0252a
JB
266{
267 /* Set up a lookup function for the macro expander. */
268 struct macro_scope *scope = 0;
269 struct cleanup *back_to = make_cleanup (free_current_contents, &scope);
270
271 if (expression_context_block)
272 scope = sal_macro_scope (find_pc_line (expression_context_pc, 0));
273 else
274 scope = default_macro_scope ();
d7d9f01e
TT
275 if (! scope)
276 scope = user_macro_scope ();
84f0252a 277
d7d9f01e
TT
278 expression_macro_lookup_func = standard_macro_lookup;
279 expression_macro_lookup_baton = (void *) scope;
84f0252a
JB
280
281 gdb_assert (! macro_original_text);
282 make_cleanup (scan_macro_cleanup, 0);
283
284 {
285 int result = c_parse ();
286 do_cleanups (back_to);
287 return result;
288 }
289}
290
291
292\f
c906108c
SS
293/* Table mapping opcodes into strings for printing operators
294 and precedences of the operators. */
295
296const struct op_print c_op_print_tab[] =
c5aa993b
JM
297{
298 {",", BINOP_COMMA, PREC_COMMA, 0},
299 {"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
300 {"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
301 {"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
302 {"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
303 {"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
304 {"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
305 {"==", BINOP_EQUAL, PREC_EQUAL, 0},
306 {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
307 {"<=", BINOP_LEQ, PREC_ORDER, 0},
308 {">=", BINOP_GEQ, PREC_ORDER, 0},
309 {">", BINOP_GTR, PREC_ORDER, 0},
310 {"<", BINOP_LESS, PREC_ORDER, 0},
311 {">>", BINOP_RSH, PREC_SHIFT, 0},
312 {"<<", BINOP_LSH, PREC_SHIFT, 0},
313 {"+", BINOP_ADD, PREC_ADD, 0},
314 {"-", BINOP_SUB, PREC_ADD, 0},
315 {"*", BINOP_MUL, PREC_MUL, 0},
316 {"/", BINOP_DIV, PREC_MUL, 0},
317 {"%", BINOP_REM, PREC_MUL, 0},
318 {"@", BINOP_REPEAT, PREC_REPEAT, 0},
319 {"-", UNOP_NEG, PREC_PREFIX, 0},
320 {"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
321 {"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
322 {"*", UNOP_IND, PREC_PREFIX, 0},
323 {"&", UNOP_ADDR, PREC_PREFIX, 0},
324 {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
325 {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
326 {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
c5aa993b 327 {NULL, 0, 0, 0}
c906108c
SS
328};
329\f
685419e2
AC
330enum c_primitive_types {
331 c_primitive_type_int,
332 c_primitive_type_long,
333 c_primitive_type_short,
334 c_primitive_type_char,
335 c_primitive_type_float,
336 c_primitive_type_double,
337 c_primitive_type_void,
338 c_primitive_type_long_long,
339 c_primitive_type_signed_char,
340 c_primitive_type_unsigned_char,
341 c_primitive_type_unsigned_short,
342 c_primitive_type_unsigned_int,
343 c_primitive_type_unsigned_long,
344 c_primitive_type_unsigned_long_long,
345 c_primitive_type_long_double,
346 c_primitive_type_complex,
347 c_primitive_type_double_complex,
213e4dc2
TJB
348 c_primitive_type_decfloat,
349 c_primitive_type_decdouble,
350 c_primitive_type_declong,
685419e2
AC
351 nr_c_primitive_types
352};
353
e9667a65 354void
685419e2
AC
355c_language_arch_info (struct gdbarch *gdbarch,
356 struct language_arch_info *lai)
357{
358 const struct builtin_type *builtin = builtin_type (gdbarch);
e9667a65 359 lai->string_char_type = builtin->builtin_char;
685419e2
AC
360 lai->primitive_type_vector
361 = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_c_primitive_types + 1,
362 struct type *);
363 lai->primitive_type_vector [c_primitive_type_int] = builtin->builtin_int;
364 lai->primitive_type_vector [c_primitive_type_long] = builtin->builtin_long;
365 lai->primitive_type_vector [c_primitive_type_short] = builtin->builtin_short;
366 lai->primitive_type_vector [c_primitive_type_char] = builtin->builtin_char;
367 lai->primitive_type_vector [c_primitive_type_float] = builtin->builtin_float;
368 lai->primitive_type_vector [c_primitive_type_double] = builtin->builtin_double;
369 lai->primitive_type_vector [c_primitive_type_void] = builtin->builtin_void;
370 lai->primitive_type_vector [c_primitive_type_long_long] = builtin->builtin_long_long;
371 lai->primitive_type_vector [c_primitive_type_signed_char] = builtin->builtin_signed_char;
372 lai->primitive_type_vector [c_primitive_type_unsigned_char] = builtin->builtin_unsigned_char;
373 lai->primitive_type_vector [c_primitive_type_unsigned_short] = builtin->builtin_unsigned_short;
374 lai->primitive_type_vector [c_primitive_type_unsigned_int] = builtin->builtin_unsigned_int;
375 lai->primitive_type_vector [c_primitive_type_unsigned_long] = builtin->builtin_unsigned_long;
376 lai->primitive_type_vector [c_primitive_type_unsigned_long_long] = builtin->builtin_unsigned_long_long;
377 lai->primitive_type_vector [c_primitive_type_long_double] = builtin->builtin_long_double;
378 lai->primitive_type_vector [c_primitive_type_complex] = builtin->builtin_complex;
379 lai->primitive_type_vector [c_primitive_type_double_complex] = builtin->builtin_double_complex;
213e4dc2
TJB
380 lai->primitive_type_vector [c_primitive_type_decfloat] = builtin->builtin_decfloat;
381 lai->primitive_type_vector [c_primitive_type_decdouble] = builtin->builtin_decdouble;
382 lai->primitive_type_vector [c_primitive_type_declong] = builtin->builtin_declong;
fbb06eb1
UW
383
384 lai->bool_type_default = builtin->builtin_int;
cad351d1 385}
685419e2 386
c5aa993b
JM
387const struct language_defn c_language_defn =
388{
c906108c
SS
389 "c", /* Language name */
390 language_c,
c906108c
SS
391 range_check_off,
392 type_check_off,
63872f9d 393 case_sensitive_on,
7ca2d3a3 394 array_row_major,
5f9769d1 395 &exp_descriptor_standard,
84f0252a 396 c_preprocess_and_parse,
c906108c 397 c_error,
e85c3284 398 null_post_parser,
c906108c
SS
399 c_printchar, /* Print a character constant */
400 c_printstr, /* Function to print string constant */
401 c_emit_char, /* Print a single char */
c906108c 402 c_print_type, /* Print a type using appropriate syntax */
5c6ce71d 403 c_print_typedef, /* Print a typedef using appropriate syntax */
c906108c
SS
404 c_val_print, /* Print a value using appropriate syntax */
405 c_value_print, /* Print a top-level value */
f636b87d 406 NULL, /* Language specific skip_trampoline */
2b2d9e11 407 NULL, /* name_of_this */
5f9a71c3 408 basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
b368761e 409 basic_lookup_transparent_type,/* lookup_transparent_type */
9a3d7dfd 410 NULL, /* Language specific symbol demangler */
31c27f77 411 NULL, /* Language specific class_name_from_physname */
c906108c
SS
412 c_op_print_tab, /* expression operators for printing */
413 1, /* c-style arrays */
414 0, /* String lower bound */
6084f43a 415 default_word_break_characters,
41d27058 416 default_make_symbol_completion_list,
685419e2 417 c_language_arch_info,
e79af960 418 default_print_array_index,
41f1b697 419 default_pass_by_reference,
c906108c
SS
420 LANG_MAGIC
421};
422
cad351d1
UW
423enum cplus_primitive_types {
424 cplus_primitive_type_int,
425 cplus_primitive_type_long,
426 cplus_primitive_type_short,
427 cplus_primitive_type_char,
428 cplus_primitive_type_float,
429 cplus_primitive_type_double,
430 cplus_primitive_type_void,
431 cplus_primitive_type_long_long,
432 cplus_primitive_type_signed_char,
433 cplus_primitive_type_unsigned_char,
434 cplus_primitive_type_unsigned_short,
435 cplus_primitive_type_unsigned_int,
436 cplus_primitive_type_unsigned_long,
437 cplus_primitive_type_unsigned_long_long,
438 cplus_primitive_type_long_double,
439 cplus_primitive_type_complex,
440 cplus_primitive_type_double_complex,
441 cplus_primitive_type_bool,
213e4dc2
TJB
442 cplus_primitive_type_decfloat,
443 cplus_primitive_type_decdouble,
444 cplus_primitive_type_declong,
cad351d1 445 nr_cplus_primitive_types
c906108c
SS
446};
447
cad351d1
UW
448static void
449cplus_language_arch_info (struct gdbarch *gdbarch,
450 struct language_arch_info *lai)
451{
452 const struct builtin_type *builtin = builtin_type (gdbarch);
453 lai->string_char_type = builtin->builtin_char;
454 lai->primitive_type_vector
455 = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_cplus_primitive_types + 1,
456 struct type *);
457 lai->primitive_type_vector [cplus_primitive_type_int]
458 = builtin->builtin_int;
459 lai->primitive_type_vector [cplus_primitive_type_long]
460 = builtin->builtin_long;
461 lai->primitive_type_vector [cplus_primitive_type_short]
462 = builtin->builtin_short;
463 lai->primitive_type_vector [cplus_primitive_type_char]
464 = builtin->builtin_char;
465 lai->primitive_type_vector [cplus_primitive_type_float]
466 = builtin->builtin_float;
467 lai->primitive_type_vector [cplus_primitive_type_double]
468 = builtin->builtin_double;
469 lai->primitive_type_vector [cplus_primitive_type_void]
470 = builtin->builtin_void;
471 lai->primitive_type_vector [cplus_primitive_type_long_long]
472 = builtin->builtin_long_long;
473 lai->primitive_type_vector [cplus_primitive_type_signed_char]
474 = builtin->builtin_signed_char;
475 lai->primitive_type_vector [cplus_primitive_type_unsigned_char]
476 = builtin->builtin_unsigned_char;
477 lai->primitive_type_vector [cplus_primitive_type_unsigned_short]
478 = builtin->builtin_unsigned_short;
479 lai->primitive_type_vector [cplus_primitive_type_unsigned_int]
480 = builtin->builtin_unsigned_int;
481 lai->primitive_type_vector [cplus_primitive_type_unsigned_long]
482 = builtin->builtin_unsigned_long;
483 lai->primitive_type_vector [cplus_primitive_type_unsigned_long_long]
484 = builtin->builtin_unsigned_long_long;
485 lai->primitive_type_vector [cplus_primitive_type_long_double]
486 = builtin->builtin_long_double;
487 lai->primitive_type_vector [cplus_primitive_type_complex]
488 = builtin->builtin_complex;
489 lai->primitive_type_vector [cplus_primitive_type_double_complex]
490 = builtin->builtin_double_complex;
491 lai->primitive_type_vector [cplus_primitive_type_bool]
492 = builtin->builtin_bool;
213e4dc2
TJB
493 lai->primitive_type_vector [cplus_primitive_type_decfloat]
494 = builtin->builtin_decfloat;
495 lai->primitive_type_vector [cplus_primitive_type_decdouble]
496 = builtin->builtin_decdouble;
497 lai->primitive_type_vector [cplus_primitive_type_declong]
498 = builtin->builtin_declong;
fbb06eb1
UW
499
500 lai->bool_type_symbol = "bool";
501 lai->bool_type_default = builtin->builtin_bool;
cad351d1
UW
502}
503
c5aa993b
JM
504const struct language_defn cplus_language_defn =
505{
506 "c++", /* Language name */
c906108c 507 language_cplus,
c906108c
SS
508 range_check_off,
509 type_check_off,
63872f9d 510 case_sensitive_on,
7ca2d3a3 511 array_row_major,
5f9769d1 512 &exp_descriptor_standard,
84f0252a 513 c_preprocess_and_parse,
c906108c 514 c_error,
e85c3284 515 null_post_parser,
c906108c
SS
516 c_printchar, /* Print a character constant */
517 c_printstr, /* Function to print string constant */
518 c_emit_char, /* Print a single char */
c906108c 519 c_print_type, /* Print a type using appropriate syntax */
5c6ce71d 520 c_print_typedef, /* Print a typedef using appropriate syntax */
c906108c
SS
521 c_val_print, /* Print a value using appropriate syntax */
522 c_value_print, /* Print a top-level value */
b18be20d 523 cplus_skip_trampoline, /* Language specific skip_trampoline */
2b2d9e11 524 "this", /* name_of_this */
1fcb5155 525 cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
b368761e 526 cp_lookup_transparent_type, /* lookup_transparent_type */
9a3d7dfd 527 cplus_demangle, /* Language specific symbol demangler */
31c27f77 528 cp_class_name_from_physname, /* Language specific class_name_from_physname */
c906108c
SS
529 c_op_print_tab, /* expression operators for printing */
530 1, /* c-style arrays */
531 0, /* String lower bound */
6084f43a 532 default_word_break_characters,
41d27058 533 default_make_symbol_completion_list,
cad351d1 534 cplus_language_arch_info,
e79af960 535 default_print_array_index,
41f1b697 536 cp_pass_by_reference,
c906108c
SS
537 LANG_MAGIC
538};
539
c5aa993b
JM
540const struct language_defn asm_language_defn =
541{
c906108c
SS
542 "asm", /* Language name */
543 language_asm,
c906108c
SS
544 range_check_off,
545 type_check_off,
63872f9d 546 case_sensitive_on,
7ca2d3a3 547 array_row_major,
5f9769d1 548 &exp_descriptor_standard,
84f0252a 549 c_preprocess_and_parse,
c906108c 550 c_error,
e85c3284 551 null_post_parser,
c906108c
SS
552 c_printchar, /* Print a character constant */
553 c_printstr, /* Function to print string constant */
554 c_emit_char, /* Print a single char */
c906108c 555 c_print_type, /* Print a type using appropriate syntax */
5c6ce71d 556 c_print_typedef, /* Print a typedef using appropriate syntax */
c906108c
SS
557 c_val_print, /* Print a value using appropriate syntax */
558 c_value_print, /* Print a top-level value */
f636b87d 559 NULL, /* Language specific skip_trampoline */
2b2d9e11 560 NULL, /* name_of_this */
5f9a71c3 561 basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
b368761e 562 basic_lookup_transparent_type,/* lookup_transparent_type */
9a3d7dfd 563 NULL, /* Language specific symbol demangler */
31c27f77 564 NULL, /* Language specific class_name_from_physname */
c906108c
SS
565 c_op_print_tab, /* expression operators for printing */
566 1, /* c-style arrays */
567 0, /* String lower bound */
6084f43a 568 default_word_break_characters,
41d27058 569 default_make_symbol_completion_list,
e9667a65 570 c_language_arch_info, /* FIXME: la_language_arch_info. */
e79af960 571 default_print_array_index,
41f1b697 572 default_pass_by_reference,
c906108c
SS
573 LANG_MAGIC
574};
575
20a0e81d
JB
576/* The following language_defn does not represent a real language.
577 It just provides a minimal support a-la-C that should allow users
578 to do some simple operations when debugging applications that use
579 a language currently not supported by GDB. */
580
581const struct language_defn minimal_language_defn =
582{
583 "minimal", /* Language name */
584 language_minimal,
20a0e81d
JB
585 range_check_off,
586 type_check_off,
587 case_sensitive_on,
7ca2d3a3 588 array_row_major,
5f9769d1 589 &exp_descriptor_standard,
20a0e81d
JB
590 c_preprocess_and_parse,
591 c_error,
e85c3284 592 null_post_parser,
20a0e81d
JB
593 c_printchar, /* Print a character constant */
594 c_printstr, /* Function to print string constant */
595 c_emit_char, /* Print a single char */
20a0e81d 596 c_print_type, /* Print a type using appropriate syntax */
5c6ce71d 597 c_print_typedef, /* Print a typedef using appropriate syntax */
20a0e81d
JB
598 c_val_print, /* Print a value using appropriate syntax */
599 c_value_print, /* Print a top-level value */
600 NULL, /* Language specific skip_trampoline */
2b2d9e11 601 NULL, /* name_of_this */
5f9a71c3 602 basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
b368761e 603 basic_lookup_transparent_type,/* lookup_transparent_type */
20a0e81d 604 NULL, /* Language specific symbol demangler */
31c27f77 605 NULL, /* Language specific class_name_from_physname */
20a0e81d
JB
606 c_op_print_tab, /* expression operators for printing */
607 1, /* c-style arrays */
608 0, /* String lower bound */
6084f43a 609 default_word_break_characters,
41d27058 610 default_make_symbol_completion_list,
e9667a65 611 c_language_arch_info,
e79af960 612 default_print_array_index,
41f1b697 613 default_pass_by_reference,
20a0e81d
JB
614 LANG_MAGIC
615};
616
c906108c 617void
fba45db2 618_initialize_c_language (void)
c906108c
SS
619{
620 add_language (&c_language_defn);
621 add_language (&cplus_language_defn);
622 add_language (&asm_language_defn);
20a0e81d 623 add_language (&minimal_language_defn);
c906108c 624}
This page took 0.720534 seconds and 4 git commands to generate.