1 /* C language support routines for GDB, the GNU debugger.
3 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003,
4 2004, 2005, 2007 Free Software Foundation, Inc.
6 This file is part of GDB.
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
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
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.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 #include "expression.h"
25 #include "parser-defs.h"
29 #include "macroscope.h"
30 #include "gdb_assert.h"
32 #include "gdb_string.h"
35 #include "cp-support.h"
37 extern void _initialize_c_language (void);
38 static void c_emit_char (int c
, struct ui_file
* stream
, int quoter
);
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. */
45 c_emit_char (int c
, struct ui_file
*stream
, int quoter
)
50 c
&= 0xFF; /* Avoid sign bit follies */
52 escape
= c_target_char_has_backslash_escape (c
);
55 if (quoter
== '"' && strcmp (escape
, "0") == 0)
56 /* Print nulls embedded in double quoted strings as \000 to
58 fprintf_filtered (stream
, "\\000");
60 fprintf_filtered (stream
, "\\%s", escape
);
62 else if (target_char_to_host (c
, &host_char
)
63 && host_char_print_literally (host_char
))
65 if (host_char
== '\\' || host_char
== quoter
)
66 fputs_filtered ("\\", stream
);
67 fprintf_filtered (stream
, "%c", host_char
);
70 fprintf_filtered (stream
, "\\%.3o", (unsigned int) c
);
74 c_printchar (int c
, struct ui_file
*stream
)
76 fputc_filtered ('\'', stream
);
77 LA_EMIT_CHAR (c
, stream
, '\'');
78 fputc_filtered ('\'', stream
);
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. */
88 c_printstr (struct ui_file
*stream
, const gdb_byte
*string
,
89 unsigned int length
, int width
, int force_ellipses
)
92 unsigned int things_printed
= 0;
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
101 && (extract_unsigned_integer (string
+ (length
- 1) * width
, width
)
107 fputs_filtered ("\"\"", stream
);
111 for (i
= 0; i
< length
&& things_printed
< print_max
; ++i
)
113 /* Position of the character we are examining
114 to see whether it is repeated. */
116 /* Number of repetitions we have detected so far. */
118 unsigned long current_char
;
124 fputs_filtered (", ", stream
);
128 current_char
= extract_unsigned_integer (string
+ i
* width
, width
);
133 && extract_unsigned_integer (string
+ rep1
* width
, width
)
140 if (reps
> repeat_count_threshold
)
145 fputs_filtered ("\\\", ", stream
);
147 fputs_filtered ("\", ", stream
);
150 LA_PRINT_CHAR (current_char
, stream
);
151 fprintf_filtered (stream
, _(" <repeats %u times>"), reps
);
153 things_printed
+= repeat_count_threshold
;
161 fputs_filtered ("\\\"", stream
);
163 fputs_filtered ("\"", stream
);
166 LA_EMIT_CHAR (current_char
, stream
, '"');
171 /* Terminate the quotes if necessary. */
175 fputs_filtered ("\\\"", stream
);
177 fputs_filtered ("\"", stream
);
180 if (force_ellipses
|| i
< length
)
181 fputs_filtered ("...", stream
);
184 /* Create a fundamental C type using default reasonable for the current
187 Some object/debugging file formats (DWARF version 1, COFF, etc) do not
188 define fundamental types such as "int" or "double". Others (stabs or
189 DWARF version 2, etc) do define fundamental types. For the formats which
190 don't provide fundamental types, gdb can create such types using this
193 FIXME: Some compilers distinguish explicitly signed integral types
194 (signed short, signed int, signed long) from "regular" integral types
195 (short, int, long) in the debugging information. There is some dis-
196 agreement as to how useful this feature is. In particular, gcc does
197 not support this. Also, only some debugging formats allow the
198 distinction to be passed on to a debugger. For now, we always just
199 use "short", "int", or "long" as the type name, for both the implicit
200 and explicitly signed types. This also makes life easier for the
201 gdb test suite since we don't have to account for the differences
202 in output depending upon what the compiler and debugging format
203 support. We will probably have to re-examine the issue when gdb
204 starts taking its fundamental type information directly from the
205 debugging information supplied by the compiler. fnf@cygnus.com */
208 c_create_fundamental_type (struct objfile
*objfile
, int typeid)
210 struct type
*type
= NULL
;
215 /* FIXME: For now, if we are asked to produce a type not in this
216 language, create the equivalent of a C integer type with the
217 name "<?type?>". When all the dust settles from the type
218 reconstruction work, this should probably become an error. */
219 type
= init_type (TYPE_CODE_INT
,
220 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
221 0, "<?type?>", objfile
);
222 warning (_("internal error: no C/C++ fundamental type %d"), typeid);
225 type
= init_type (TYPE_CODE_VOID
,
226 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
230 type
= init_type (TYPE_CODE_BOOL
,
231 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
235 type
= init_type (TYPE_CODE_INT
,
236 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
237 TYPE_FLAG_NOSIGN
, "char", objfile
);
240 type
= init_type (TYPE_CODE_INT
,
241 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
242 0, "signed char", objfile
);
244 case FT_UNSIGNED_CHAR
:
245 type
= init_type (TYPE_CODE_INT
,
246 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
247 TYPE_FLAG_UNSIGNED
, "unsigned char", objfile
);
250 type
= init_type (TYPE_CODE_INT
,
251 gdbarch_short_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
252 0, "short", objfile
);
254 case FT_SIGNED_SHORT
:
255 type
= init_type (TYPE_CODE_INT
,
256 gdbarch_short_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
257 0, "short", objfile
); /* FIXME-fnf */
259 case FT_UNSIGNED_SHORT
:
260 type
= init_type (TYPE_CODE_INT
,
261 gdbarch_short_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
262 TYPE_FLAG_UNSIGNED
, "unsigned short", objfile
);
265 type
= init_type (TYPE_CODE_INT
,
266 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
269 case FT_SIGNED_INTEGER
:
270 type
= init_type (TYPE_CODE_INT
,
271 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
272 0, "int", objfile
); /* FIXME -fnf */
274 case FT_UNSIGNED_INTEGER
:
275 type
= init_type (TYPE_CODE_INT
,
276 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
277 TYPE_FLAG_UNSIGNED
, "unsigned int", objfile
);
280 type
= init_type (TYPE_CODE_INT
,
281 gdbarch_long_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
285 type
= init_type (TYPE_CODE_INT
,
286 gdbarch_long_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
287 0, "long", objfile
); /* FIXME -fnf */
289 case FT_UNSIGNED_LONG
:
290 type
= init_type (TYPE_CODE_INT
,
291 gdbarch_long_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
292 TYPE_FLAG_UNSIGNED
, "unsigned long", objfile
);
295 type
= init_type (TYPE_CODE_INT
,
296 gdbarch_long_long_bit (current_gdbarch
)
298 0, "long long", objfile
);
300 case FT_SIGNED_LONG_LONG
:
301 type
= init_type (TYPE_CODE_INT
,
302 gdbarch_long_long_bit (current_gdbarch
)
304 0, "signed long long", objfile
);
306 case FT_UNSIGNED_LONG_LONG
:
307 type
= init_type (TYPE_CODE_INT
,
308 gdbarch_long_long_bit (current_gdbarch
)
310 TYPE_FLAG_UNSIGNED
, "unsigned long long", objfile
);
313 type
= init_type (TYPE_CODE_FLT
,
314 gdbarch_float_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
315 0, "float", objfile
);
317 case FT_DBL_PREC_FLOAT
:
318 type
= init_type (TYPE_CODE_FLT
,
319 gdbarch_double_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
320 0, "double", objfile
);
322 case FT_EXT_PREC_FLOAT
:
323 type
= init_type (TYPE_CODE_FLT
,
324 gdbarch_long_double_bit (current_gdbarch
)
326 0, "long double", objfile
);
329 type
= init_type (TYPE_CODE_FLT
,
330 2 * gdbarch_float_bit (current_gdbarch
)
332 0, "complex float", objfile
);
333 TYPE_TARGET_TYPE (type
)
334 = init_type (TYPE_CODE_FLT
,
335 gdbarch_float_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
336 0, "float", objfile
);
338 case FT_DBL_PREC_COMPLEX
:
339 type
= init_type (TYPE_CODE_FLT
,
340 2 * gdbarch_double_bit (current_gdbarch
)
342 0, "complex double", objfile
);
343 TYPE_TARGET_TYPE (type
)
344 = init_type (TYPE_CODE_FLT
,
345 gdbarch_double_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
346 0, "double", objfile
);
348 case FT_EXT_PREC_COMPLEX
:
349 type
= init_type (TYPE_CODE_FLT
,
350 2 * gdbarch_long_double_bit (current_gdbarch
)
352 0, "complex long double", objfile
);
353 TYPE_TARGET_TYPE (type
)
354 = init_type (TYPE_CODE_FLT
,
355 gdbarch_long_double_bit (current_gdbarch
)
357 0, "long double", objfile
);
359 case FT_TEMPLATE_ARG
:
360 type
= init_type (TYPE_CODE_TEMPLATE_ARG
,
362 0, "<template arg>", objfile
);
368 /* Preprocessing and parsing C and C++ expressions. */
371 /* When we find that lexptr (the global var defined in parse.c) is
372 pointing at a macro invocation, we expand the invocation, and call
373 scan_macro_expansion to save the old lexptr here and point lexptr
374 into the expanded text. When we reach the end of that, we call
375 end_macro_expansion to pop back to the value we saved here. The
376 macro expansion code promises to return only fully-expanded text,
377 so we don't need to "push" more than one level.
379 This is disgusting, of course. It would be cleaner to do all macro
380 expansion beforehand, and then hand that to lexptr. But we don't
381 really know where the expression ends. Remember, in a command like
383 (gdb) break *ADDRESS if CONDITION
385 we evaluate ADDRESS in the scope of the current frame, but we
386 evaluate CONDITION in the scope of the breakpoint's location. So
387 it's simply wrong to try to macro-expand the whole thing at once. */
388 static char *macro_original_text
;
389 static char *macro_expanded_text
;
393 scan_macro_expansion (char *expansion
)
395 /* We'd better not be trying to push the stack twice. */
396 gdb_assert (! macro_original_text
);
397 gdb_assert (! macro_expanded_text
);
399 /* Save the old lexptr value, so we can return to it when we're done
400 parsing the expanded text. */
401 macro_original_text
= lexptr
;
404 /* Save the expanded text, so we can free it when we're finished. */
405 macro_expanded_text
= expansion
;
410 scanning_macro_expansion (void)
412 return macro_original_text
!= 0;
417 finished_macro_expansion (void)
419 /* There'd better be something to pop back to, and we better have
420 saved a pointer to the start of the expanded text. */
421 gdb_assert (macro_original_text
);
422 gdb_assert (macro_expanded_text
);
424 /* Pop back to the original text. */
425 lexptr
= macro_original_text
;
426 macro_original_text
= 0;
428 /* Free the expanded text. */
429 xfree (macro_expanded_text
);
430 macro_expanded_text
= 0;
435 scan_macro_cleanup (void *dummy
)
437 if (macro_original_text
)
438 finished_macro_expansion ();
442 /* We set these global variables before calling c_parse, to tell it
443 how it to find macro definitions for the expression at hand. */
444 macro_lookup_ftype
*expression_macro_lookup_func
;
445 void *expression_macro_lookup_baton
;
448 static struct macro_definition
*
449 null_macro_lookup (const char *name
, void *baton
)
456 c_preprocess_and_parse (void)
458 /* Set up a lookup function for the macro expander. */
459 struct macro_scope
*scope
= 0;
460 struct cleanup
*back_to
= make_cleanup (free_current_contents
, &scope
);
462 if (expression_context_block
)
463 scope
= sal_macro_scope (find_pc_line (expression_context_pc
, 0));
465 scope
= default_macro_scope ();
469 expression_macro_lookup_func
= standard_macro_lookup
;
470 expression_macro_lookup_baton
= (void *) scope
;
474 expression_macro_lookup_func
= null_macro_lookup
;
475 expression_macro_lookup_baton
= 0;
478 gdb_assert (! macro_original_text
);
479 make_cleanup (scan_macro_cleanup
, 0);
482 int result
= c_parse ();
483 do_cleanups (back_to
);
490 /* Table mapping opcodes into strings for printing operators
491 and precedences of the operators. */
493 const struct op_print c_op_print_tab
[] =
495 {",", BINOP_COMMA
, PREC_COMMA
, 0},
496 {"=", BINOP_ASSIGN
, PREC_ASSIGN
, 1},
497 {"||", BINOP_LOGICAL_OR
, PREC_LOGICAL_OR
, 0},
498 {"&&", BINOP_LOGICAL_AND
, PREC_LOGICAL_AND
, 0},
499 {"|", BINOP_BITWISE_IOR
, PREC_BITWISE_IOR
, 0},
500 {"^", BINOP_BITWISE_XOR
, PREC_BITWISE_XOR
, 0},
501 {"&", BINOP_BITWISE_AND
, PREC_BITWISE_AND
, 0},
502 {"==", BINOP_EQUAL
, PREC_EQUAL
, 0},
503 {"!=", BINOP_NOTEQUAL
, PREC_EQUAL
, 0},
504 {"<=", BINOP_LEQ
, PREC_ORDER
, 0},
505 {">=", BINOP_GEQ
, PREC_ORDER
, 0},
506 {">", BINOP_GTR
, PREC_ORDER
, 0},
507 {"<", BINOP_LESS
, PREC_ORDER
, 0},
508 {">>", BINOP_RSH
, PREC_SHIFT
, 0},
509 {"<<", BINOP_LSH
, PREC_SHIFT
, 0},
510 {"+", BINOP_ADD
, PREC_ADD
, 0},
511 {"-", BINOP_SUB
, PREC_ADD
, 0},
512 {"*", BINOP_MUL
, PREC_MUL
, 0},
513 {"/", BINOP_DIV
, PREC_MUL
, 0},
514 {"%", BINOP_REM
, PREC_MUL
, 0},
515 {"@", BINOP_REPEAT
, PREC_REPEAT
, 0},
516 {"-", UNOP_NEG
, PREC_PREFIX
, 0},
517 {"!", UNOP_LOGICAL_NOT
, PREC_PREFIX
, 0},
518 {"~", UNOP_COMPLEMENT
, PREC_PREFIX
, 0},
519 {"*", UNOP_IND
, PREC_PREFIX
, 0},
520 {"&", UNOP_ADDR
, PREC_PREFIX
, 0},
521 {"sizeof ", UNOP_SIZEOF
, PREC_PREFIX
, 0},
522 {"++", UNOP_PREINCREMENT
, PREC_PREFIX
, 0},
523 {"--", UNOP_PREDECREMENT
, PREC_PREFIX
, 0},
527 enum c_primitive_types
{
528 c_primitive_type_int
,
529 c_primitive_type_long
,
530 c_primitive_type_short
,
531 c_primitive_type_char
,
532 c_primitive_type_float
,
533 c_primitive_type_double
,
534 c_primitive_type_void
,
535 c_primitive_type_long_long
,
536 c_primitive_type_signed_char
,
537 c_primitive_type_unsigned_char
,
538 c_primitive_type_unsigned_short
,
539 c_primitive_type_unsigned_int
,
540 c_primitive_type_unsigned_long
,
541 c_primitive_type_unsigned_long_long
,
542 c_primitive_type_long_double
,
543 c_primitive_type_complex
,
544 c_primitive_type_double_complex
,
549 c_language_arch_info (struct gdbarch
*gdbarch
,
550 struct language_arch_info
*lai
)
552 const struct builtin_type
*builtin
= builtin_type (gdbarch
);
553 lai
->string_char_type
= builtin
->builtin_char
;
554 lai
->primitive_type_vector
555 = GDBARCH_OBSTACK_CALLOC (gdbarch
, nr_c_primitive_types
+ 1,
557 lai
->primitive_type_vector
[c_primitive_type_int
] = builtin
->builtin_int
;
558 lai
->primitive_type_vector
[c_primitive_type_long
] = builtin
->builtin_long
;
559 lai
->primitive_type_vector
[c_primitive_type_short
] = builtin
->builtin_short
;
560 lai
->primitive_type_vector
[c_primitive_type_char
] = builtin
->builtin_char
;
561 lai
->primitive_type_vector
[c_primitive_type_float
] = builtin
->builtin_float
;
562 lai
->primitive_type_vector
[c_primitive_type_double
] = builtin
->builtin_double
;
563 lai
->primitive_type_vector
[c_primitive_type_void
] = builtin
->builtin_void
;
564 lai
->primitive_type_vector
[c_primitive_type_long_long
] = builtin
->builtin_long_long
;
565 lai
->primitive_type_vector
[c_primitive_type_signed_char
] = builtin
->builtin_signed_char
;
566 lai
->primitive_type_vector
[c_primitive_type_unsigned_char
] = builtin
->builtin_unsigned_char
;
567 lai
->primitive_type_vector
[c_primitive_type_unsigned_short
] = builtin
->builtin_unsigned_short
;
568 lai
->primitive_type_vector
[c_primitive_type_unsigned_int
] = builtin
->builtin_unsigned_int
;
569 lai
->primitive_type_vector
[c_primitive_type_unsigned_long
] = builtin
->builtin_unsigned_long
;
570 lai
->primitive_type_vector
[c_primitive_type_unsigned_long_long
] = builtin
->builtin_unsigned_long_long
;
571 lai
->primitive_type_vector
[c_primitive_type_long_double
] = builtin
->builtin_long_double
;
572 lai
->primitive_type_vector
[c_primitive_type_complex
] = builtin
->builtin_complex
;
573 lai
->primitive_type_vector
[c_primitive_type_double_complex
] = builtin
->builtin_double_complex
;
576 const struct language_defn c_language_defn
=
578 "c", /* Language name */
585 &exp_descriptor_standard
,
586 c_preprocess_and_parse
,
589 c_printchar
, /* Print a character constant */
590 c_printstr
, /* Function to print string constant */
591 c_emit_char
, /* Print a single char */
592 c_create_fundamental_type
, /* Create fundamental type in this language */
593 c_print_type
, /* Print a type using appropriate syntax */
594 c_val_print
, /* Print a value using appropriate syntax */
595 c_value_print
, /* Print a top-level value */
596 NULL
, /* Language specific skip_trampoline */
597 NULL
, /* value_of_this */
598 basic_lookup_symbol_nonlocal
, /* lookup_symbol_nonlocal */
599 basic_lookup_transparent_type
,/* lookup_transparent_type */
600 NULL
, /* Language specific symbol demangler */
601 NULL
, /* Language specific class_name_from_physname */
602 c_op_print_tab
, /* expression operators for printing */
603 1, /* c-style arrays */
604 0, /* String lower bound */
606 default_word_break_characters
,
607 c_language_arch_info
,
608 default_print_array_index
,
612 enum cplus_primitive_types
{
613 cplus_primitive_type_int
,
614 cplus_primitive_type_long
,
615 cplus_primitive_type_short
,
616 cplus_primitive_type_char
,
617 cplus_primitive_type_float
,
618 cplus_primitive_type_double
,
619 cplus_primitive_type_void
,
620 cplus_primitive_type_long_long
,
621 cplus_primitive_type_signed_char
,
622 cplus_primitive_type_unsigned_char
,
623 cplus_primitive_type_unsigned_short
,
624 cplus_primitive_type_unsigned_int
,
625 cplus_primitive_type_unsigned_long
,
626 cplus_primitive_type_unsigned_long_long
,
627 cplus_primitive_type_long_double
,
628 cplus_primitive_type_complex
,
629 cplus_primitive_type_double_complex
,
630 cplus_primitive_type_bool
,
631 nr_cplus_primitive_types
635 cplus_language_arch_info (struct gdbarch
*gdbarch
,
636 struct language_arch_info
*lai
)
638 const struct builtin_type
*builtin
= builtin_type (gdbarch
);
639 lai
->string_char_type
= builtin
->builtin_char
;
640 lai
->primitive_type_vector
641 = GDBARCH_OBSTACK_CALLOC (gdbarch
, nr_cplus_primitive_types
+ 1,
643 lai
->primitive_type_vector
[cplus_primitive_type_int
]
644 = builtin
->builtin_int
;
645 lai
->primitive_type_vector
[cplus_primitive_type_long
]
646 = builtin
->builtin_long
;
647 lai
->primitive_type_vector
[cplus_primitive_type_short
]
648 = builtin
->builtin_short
;
649 lai
->primitive_type_vector
[cplus_primitive_type_char
]
650 = builtin
->builtin_char
;
651 lai
->primitive_type_vector
[cplus_primitive_type_float
]
652 = builtin
->builtin_float
;
653 lai
->primitive_type_vector
[cplus_primitive_type_double
]
654 = builtin
->builtin_double
;
655 lai
->primitive_type_vector
[cplus_primitive_type_void
]
656 = builtin
->builtin_void
;
657 lai
->primitive_type_vector
[cplus_primitive_type_long_long
]
658 = builtin
->builtin_long_long
;
659 lai
->primitive_type_vector
[cplus_primitive_type_signed_char
]
660 = builtin
->builtin_signed_char
;
661 lai
->primitive_type_vector
[cplus_primitive_type_unsigned_char
]
662 = builtin
->builtin_unsigned_char
;
663 lai
->primitive_type_vector
[cplus_primitive_type_unsigned_short
]
664 = builtin
->builtin_unsigned_short
;
665 lai
->primitive_type_vector
[cplus_primitive_type_unsigned_int
]
666 = builtin
->builtin_unsigned_int
;
667 lai
->primitive_type_vector
[cplus_primitive_type_unsigned_long
]
668 = builtin
->builtin_unsigned_long
;
669 lai
->primitive_type_vector
[cplus_primitive_type_unsigned_long_long
]
670 = builtin
->builtin_unsigned_long_long
;
671 lai
->primitive_type_vector
[cplus_primitive_type_long_double
]
672 = builtin
->builtin_long_double
;
673 lai
->primitive_type_vector
[cplus_primitive_type_complex
]
674 = builtin
->builtin_complex
;
675 lai
->primitive_type_vector
[cplus_primitive_type_double_complex
]
676 = builtin
->builtin_double_complex
;
677 lai
->primitive_type_vector
[cplus_primitive_type_bool
]
678 = builtin
->builtin_bool
;
681 const struct language_defn cplus_language_defn
=
683 "c++", /* Language name */
690 &exp_descriptor_standard
,
691 c_preprocess_and_parse
,
694 c_printchar
, /* Print a character constant */
695 c_printstr
, /* Function to print string constant */
696 c_emit_char
, /* Print a single char */
697 c_create_fundamental_type
, /* Create fundamental type in this language */
698 c_print_type
, /* Print a type using appropriate syntax */
699 c_val_print
, /* Print a value using appropriate syntax */
700 c_value_print
, /* Print a top-level value */
701 cplus_skip_trampoline
, /* Language specific skip_trampoline */
702 value_of_this
, /* value_of_this */
703 cp_lookup_symbol_nonlocal
, /* lookup_symbol_nonlocal */
704 cp_lookup_transparent_type
, /* lookup_transparent_type */
705 cplus_demangle
, /* Language specific symbol demangler */
706 cp_class_name_from_physname
, /* Language specific class_name_from_physname */
707 c_op_print_tab
, /* expression operators for printing */
708 1, /* c-style arrays */
709 0, /* String lower bound */
711 default_word_break_characters
,
712 cplus_language_arch_info
,
713 default_print_array_index
,
717 const struct language_defn asm_language_defn
=
719 "asm", /* Language name */
726 &exp_descriptor_standard
,
727 c_preprocess_and_parse
,
730 c_printchar
, /* Print a character constant */
731 c_printstr
, /* Function to print string constant */
732 c_emit_char
, /* Print a single char */
733 c_create_fundamental_type
, /* Create fundamental type in this language */
734 c_print_type
, /* Print a type using appropriate syntax */
735 c_val_print
, /* Print a value using appropriate syntax */
736 c_value_print
, /* Print a top-level value */
737 NULL
, /* Language specific skip_trampoline */
738 NULL
, /* value_of_this */
739 basic_lookup_symbol_nonlocal
, /* lookup_symbol_nonlocal */
740 basic_lookup_transparent_type
,/* lookup_transparent_type */
741 NULL
, /* Language specific symbol demangler */
742 NULL
, /* Language specific class_name_from_physname */
743 c_op_print_tab
, /* expression operators for printing */
744 1, /* c-style arrays */
745 0, /* String lower bound */
747 default_word_break_characters
,
748 c_language_arch_info
, /* FIXME: la_language_arch_info. */
749 default_print_array_index
,
753 /* The following language_defn does not represent a real language.
754 It just provides a minimal support a-la-C that should allow users
755 to do some simple operations when debugging applications that use
756 a language currently not supported by GDB. */
758 const struct language_defn minimal_language_defn
=
760 "minimal", /* Language name */
767 &exp_descriptor_standard
,
768 c_preprocess_and_parse
,
771 c_printchar
, /* Print a character constant */
772 c_printstr
, /* Function to print string constant */
773 c_emit_char
, /* Print a single char */
774 c_create_fundamental_type
, /* Create fundamental type in this language */
775 c_print_type
, /* Print a type using appropriate syntax */
776 c_val_print
, /* Print a value using appropriate syntax */
777 c_value_print
, /* Print a top-level value */
778 NULL
, /* Language specific skip_trampoline */
779 NULL
, /* value_of_this */
780 basic_lookup_symbol_nonlocal
, /* lookup_symbol_nonlocal */
781 basic_lookup_transparent_type
,/* lookup_transparent_type */
782 NULL
, /* Language specific symbol demangler */
783 NULL
, /* Language specific class_name_from_physname */
784 c_op_print_tab
, /* expression operators for printing */
785 1, /* c-style arrays */
786 0, /* String lower bound */
788 default_word_break_characters
,
789 c_language_arch_info
,
790 default_print_array_index
,
795 _initialize_c_language (void)
797 add_language (&c_language_defn
);
798 add_language (&cplus_language_defn
);
799 add_language (&asm_language_defn
);
800 add_language (&minimal_language_defn
);