diff options
Diffstat (limited to 'gdb/c-lang.c')
-rw-r--r-- | gdb/c-lang.c | 109 |
1 files changed, 68 insertions, 41 deletions
diff --git a/gdb/c-lang.c b/gdb/c-lang.c index ba34540f386..c7eb918ed1a 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -513,39 +513,68 @@ const struct op_print c_op_print_tab[] = {NULL, 0, 0, 0} }; -struct type **const (c_builtin_types[]) = +enum c_primitive_types { + c_primitive_type_int, + c_primitive_type_long, + c_primitive_type_short, + c_primitive_type_char, + c_primitive_type_float, + c_primitive_type_double, + c_primitive_type_void, + c_primitive_type_long_long, + c_primitive_type_signed_char, + c_primitive_type_unsigned_char, + c_primitive_type_unsigned_short, + c_primitive_type_unsigned_int, + c_primitive_type_unsigned_long, + c_primitive_type_unsigned_long_long, + c_primitive_type_long_double, + c_primitive_type_complex, + c_primitive_type_double_complex, + nr_c_primitive_types +}; + +void +c_language_arch_info (struct gdbarch *gdbarch, + struct language_arch_info *lai) { - &builtin_type_int, - &builtin_type_long, - &builtin_type_short, - &builtin_type_char, - &builtin_type_float, - &builtin_type_double, - &builtin_type_void, - &builtin_type_long_long, - &builtin_type_signed_char, - &builtin_type_unsigned_char, - &builtin_type_unsigned_short, - &builtin_type_unsigned_int, - &builtin_type_unsigned_long, - &builtin_type_unsigned_long_long, - &builtin_type_long_double, - &builtin_type_complex, - &builtin_type_double_complex, - 0 + const struct builtin_type *builtin = builtin_type (gdbarch); + lai->string_char_type = builtin->builtin_char; + lai->primitive_type_vector + = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_c_primitive_types + 1, + struct type *); + lai->primitive_type_vector [c_primitive_type_int] = builtin->builtin_int; + lai->primitive_type_vector [c_primitive_type_long] = builtin->builtin_long; + lai->primitive_type_vector [c_primitive_type_short] = builtin->builtin_short; + lai->primitive_type_vector [c_primitive_type_char] = builtin->builtin_char; + lai->primitive_type_vector [c_primitive_type_float] = builtin->builtin_float; + lai->primitive_type_vector [c_primitive_type_double] = builtin->builtin_double; + lai->primitive_type_vector [c_primitive_type_void] = builtin->builtin_void; + lai->primitive_type_vector [c_primitive_type_long_long] = builtin->builtin_long_long; + lai->primitive_type_vector [c_primitive_type_signed_char] = builtin->builtin_signed_char; + lai->primitive_type_vector [c_primitive_type_unsigned_char] = builtin->builtin_unsigned_char; + lai->primitive_type_vector [c_primitive_type_unsigned_short] = builtin->builtin_unsigned_short; + lai->primitive_type_vector [c_primitive_type_unsigned_int] = builtin->builtin_unsigned_int; + lai->primitive_type_vector [c_primitive_type_unsigned_long] = builtin->builtin_unsigned_long; + lai->primitive_type_vector [c_primitive_type_unsigned_long_long] = builtin->builtin_unsigned_long_long; + lai->primitive_type_vector [c_primitive_type_long_double] = builtin->builtin_long_double; + lai->primitive_type_vector [c_primitive_type_complex] = builtin->builtin_complex; + lai->primitive_type_vector [c_primitive_type_double_complex] = builtin->builtin_double_complex; }; const struct language_defn c_language_defn = { "c", /* Language name */ language_c, - c_builtin_types, + NULL, range_check_off, type_check_off, case_sensitive_on, + array_row_major, &exp_descriptor_standard, c_preprocess_and_parse, c_error, + null_post_parser, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ @@ -558,15 +587,13 @@ const struct language_defn c_language_defn = basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ - {"", "", "", ""}, /* Binary format info */ - {"0%lo", "0", "o", ""}, /* Octal format info */ - {"%ld", "", "d", ""}, /* Decimal format info */ - {"0x%lx", "0x", "x", ""}, /* Hex format info */ + NULL, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ 1, /* c-style arrays */ 0, /* String lower bound */ - &builtin_type_char, /* Type of string elements */ + NULL, default_word_break_characters, + c_language_arch_info, LANG_MAGIC }; @@ -601,9 +628,11 @@ const struct language_defn cplus_language_defn = range_check_off, type_check_off, case_sensitive_on, + array_row_major, &exp_descriptor_standard, c_preprocess_and_parse, c_error, + null_post_parser, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ @@ -616,15 +645,13 @@ const struct language_defn cplus_language_defn = cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ cp_lookup_transparent_type, /* lookup_transparent_type */ cplus_demangle, /* Language specific symbol demangler */ - {"", "", "", ""}, /* Binary format info */ - {"0%lo", "0", "o", ""}, /* Octal format info */ - {"%ld", "", "d", ""}, /* Decimal format info */ - {"0x%lx", "0x", "x", ""}, /* Hex format info */ + cp_class_name_from_physname, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ 1, /* c-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ default_word_break_characters, + NULL, /* FIXME: la_language_arch_info. */ LANG_MAGIC }; @@ -632,13 +659,15 @@ const struct language_defn asm_language_defn = { "asm", /* Language name */ language_asm, - c_builtin_types, + NULL, range_check_off, type_check_off, case_sensitive_on, + array_row_major, &exp_descriptor_standard, c_preprocess_and_parse, c_error, + null_post_parser, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ @@ -651,15 +680,13 @@ const struct language_defn asm_language_defn = basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ - {"", "", "", ""}, /* Binary format info */ - {"0%lo", "0", "o", ""}, /* Octal format info */ - {"%ld", "", "d", ""}, /* Decimal format info */ - {"0x%lx", "0x", "x", ""}, /* Hex format info */ + NULL, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ 1, /* c-style arrays */ 0, /* String lower bound */ - &builtin_type_char, /* Type of string elements */ + NULL, default_word_break_characters, + c_language_arch_info, /* FIXME: la_language_arch_info. */ LANG_MAGIC }; @@ -672,13 +699,15 @@ const struct language_defn minimal_language_defn = { "minimal", /* Language name */ language_minimal, - c_builtin_types, + NULL, range_check_off, type_check_off, case_sensitive_on, + array_row_major, &exp_descriptor_standard, c_preprocess_and_parse, c_error, + null_post_parser, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ @@ -691,15 +720,13 @@ const struct language_defn minimal_language_defn = basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ - {"", "", "", ""}, /* Binary format info */ - {"0%lo", "0", "o", ""}, /* Octal format info */ - {"%ld", "", "d", ""}, /* Decimal format info */ - {"0x%lx", "0x", "x", ""}, /* Hex format info */ + NULL, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ 1, /* c-style arrays */ 0, /* String lower bound */ - &builtin_type_char, /* Type of string elements */ + NULL, default_word_break_characters, + c_language_arch_info, LANG_MAGIC }; |