From 1fb314aaa3142711e452e66c2dced781a4d1ef87 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Fri, 1 May 2020 21:51:15 +0100 Subject: gdb: Convert language la_language_arch_info field to a method This commit changes the language_data::la_language_arch_info function pointer member variable into a member function of language_defn. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_arch_info): Delete function, move implementation to... (ada_language::language_arch_info): ...here, a new member function. (ada_language_data): Delete la_language_arch_info. * c-lang.c (c_language_data): Likewise. (c_language::language_arch_info): New member function. (cplus_language_arch_info): Delete function, move implementation to... (cplus_language::language_arch_info): ...here, a new member function. (cplus_language_data): Delete la_language_arch_info. (asm_language_data): Likewise. (asm_language::language_arch_info): New member function. (minimal_language_data): Delete la_language_arch_info. (minimal_language::language_arch_info): New member function. * d-lang.c (d_language_arch_info): Delete function, move implementation to... (d_language::language_arch_info): ...here, a new member function. (d_language_data): Delete la_language_arch_info. * f-lang.c (f_language_arch_info): Delete function, move implementation to... (f_language::language_arch_info): ...here, a new member function. (f_language_data): Delete la_language_arch_info. * go-lang.c (go_language_arch_info): Delete function, move implementation to... (go_language::language_arch_info): ...here, a new member function. (go_language_data): Delete la_language_arch_info. * language.c (unknown_language_data): Likewise. (unknown_language::language_arch_info): New member function. (auto_language_data): Delete la_language_arch_info. (auto_language::language_arch_info): New member function. (language_gdbarch_post_init): Update call to la_language_arch_info. * language.h (language_data): Delete la_language_arch_info function pointer. (language_defn::language_arch_info): New function. * m2-lang.c (m2_language_arch_info): Delete function, move implementation to... (m2_language::language_arch_info): ...here, a new member function. (m2_language_data): Delete la_language_arch_info. * objc-lang.c (objc_language_arch_info): Delete function, move implementation to... (objc_language::language_arch_info): ...here, a new member function. (objc_language_data): Delete la_language_arch_info. * opencl-lang.c (opencl_language_arch_info): Delete function, move implementation to... (opencl_language::language_arch_info): ...here, a new member function. (opencl_language_data): Delete la_language_arch_info. * p-lang.c (pascal_language_arch_info): Delete function, move implementation to... (pascal_language::language_arch_info): ...here, a new member function. (pascal_language_data): Delete la_language_arch_info. * rust-lang.c (rust_language_arch_info): Delete function, move implementation to... (rust_language::language_arch_info): ...here, a new member function. (rust_language_data): Delete la_language_arch_info. --- gdb/ada-lang.c | 133 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 65 insertions(+), 68 deletions(-) (limited to 'gdb/ada-lang.c') diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 6544479..a1cd04b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -215,9 +215,6 @@ static int ada_resolve_function (struct block_symbol *, int, static int ada_is_direct_array_type (struct type *); -static void ada_language_arch_info (struct gdbarch *, - struct language_arch_info *); - static struct value *ada_index_struct_field (int, struct value *, int, struct type *); @@ -13783,70 +13780,6 @@ enum ada_primitive_types { nr_ada_primitive_types }; -static void -ada_language_arch_info (struct gdbarch *gdbarch, - struct language_arch_info *lai) -{ - const struct builtin_type *builtin = builtin_type (gdbarch); - - lai->primitive_type_vector - = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_ada_primitive_types + 1, - struct type *); - - lai->primitive_type_vector [ada_primitive_type_int] - = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), - 0, "integer"); - lai->primitive_type_vector [ada_primitive_type_long] - = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), - 0, "long_integer"); - lai->primitive_type_vector [ada_primitive_type_short] - = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), - 0, "short_integer"); - lai->string_char_type - = lai->primitive_type_vector [ada_primitive_type_char] - = arch_character_type (gdbarch, TARGET_CHAR_BIT, 0, "character"); - lai->primitive_type_vector [ada_primitive_type_float] - = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), - "float", gdbarch_float_format (gdbarch)); - lai->primitive_type_vector [ada_primitive_type_double] - = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), - "long_float", gdbarch_double_format (gdbarch)); - lai->primitive_type_vector [ada_primitive_type_long_long] - = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), - 0, "long_long_integer"); - lai->primitive_type_vector [ada_primitive_type_long_double] - = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), - "long_long_float", gdbarch_long_double_format (gdbarch)); - lai->primitive_type_vector [ada_primitive_type_natural] - = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), - 0, "natural"); - lai->primitive_type_vector [ada_primitive_type_positive] - = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), - 0, "positive"); - lai->primitive_type_vector [ada_primitive_type_void] - = builtin->builtin_void; - - lai->primitive_type_vector [ada_primitive_type_system_address] - = lookup_pointer_type (arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, - "void")); - lai->primitive_type_vector [ada_primitive_type_system_address] - ->set_name ("system__address"); - - /* Create the equivalent of the System.Storage_Elements.Storage_Offset - type. This is a signed integral type whose size is the same as - the size of addresses. */ - { - unsigned int addr_length = TYPE_LENGTH - (lai->primitive_type_vector [ada_primitive_type_system_address]); - - lai->primitive_type_vector [ada_primitive_type_storage_offset] - = arch_integer_type (gdbarch, addr_length * HOST_CHAR_BIT, 0, - "storage_offset"); - } - - lai->bool_type_symbol = NULL; - lai->bool_type_default = builtin->builtin_bool; -} /* Language vector */ @@ -14065,7 +13998,6 @@ extern const struct language_data ada_language_data = 1, /* String lower bound */ ada_get_gdb_completer_word_break_characters, ada_collect_symbol_completion_matches, - ada_language_arch_info, ada_watch_location_expression, ada_get_symbol_name_matcher, /* la_get_symbol_name_matcher */ ada_iterate_over_symbols, @@ -14118,6 +14050,71 @@ public: function to work. */ return language_defn::read_var_value (var, var_block, frame); } + + /* See language.h. */ + void language_arch_info (struct gdbarch *gdbarch, + struct language_arch_info *lai) const override + { + const struct builtin_type *builtin = builtin_type (gdbarch); + + lai->primitive_type_vector + = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_ada_primitive_types + 1, + struct type *); + + lai->primitive_type_vector [ada_primitive_type_int] + = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + 0, "integer"); + lai->primitive_type_vector [ada_primitive_type_long] + = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), + 0, "long_integer"); + lai->primitive_type_vector [ada_primitive_type_short] + = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), + 0, "short_integer"); + lai->string_char_type + = lai->primitive_type_vector [ada_primitive_type_char] + = arch_character_type (gdbarch, TARGET_CHAR_BIT, 0, "character"); + lai->primitive_type_vector [ada_primitive_type_float] + = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), + "float", gdbarch_float_format (gdbarch)); + lai->primitive_type_vector [ada_primitive_type_double] + = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), + "long_float", gdbarch_double_format (gdbarch)); + lai->primitive_type_vector [ada_primitive_type_long_long] + = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), + 0, "long_long_integer"); + lai->primitive_type_vector [ada_primitive_type_long_double] + = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), + "long_long_float", gdbarch_long_double_format (gdbarch)); + lai->primitive_type_vector [ada_primitive_type_natural] + = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + 0, "natural"); + lai->primitive_type_vector [ada_primitive_type_positive] + = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + 0, "positive"); + lai->primitive_type_vector [ada_primitive_type_void] + = builtin->builtin_void; + + lai->primitive_type_vector [ada_primitive_type_system_address] + = lookup_pointer_type (arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, + "void")); + lai->primitive_type_vector [ada_primitive_type_system_address] + ->set_name ("system__address"); + + /* Create the equivalent of the System.Storage_Elements.Storage_Offset + type. This is a signed integral type whose size is the same as + the size of addresses. */ + { + unsigned int addr_length = TYPE_LENGTH + (lai->primitive_type_vector [ada_primitive_type_system_address]); + + lai->primitive_type_vector [ada_primitive_type_storage_offset] + = arch_integer_type (gdbarch, addr_length * HOST_CHAR_BIT, 0, + "storage_offset"); + } + + lai->bool_type_symbol = NULL; + lai->bool_type_default = builtin->builtin_bool; + } }; /* Single instance of the Ada language class. */ -- cgit v1.1