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.
This commit is contained in:
Andrew Burgess 2020-05-01 21:51:15 +01:00
parent 48448202d7
commit 1fb314aaa3
13 changed files with 538 additions and 449 deletions

View file

@ -1,3 +1,71 @@
2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com>
* 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.
2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com> 2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_language_data): Delete la_pass_by_reference * ada-lang.c (ada_language_data): Delete la_pass_by_reference

View file

@ -215,9 +215,6 @@ static int ada_resolve_function (struct block_symbol *, int,
static int ada_is_direct_array_type (struct type *); 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, static struct value *ada_index_struct_field (int, struct value *, int,
struct type *); struct type *);
@ -13783,70 +13780,6 @@ enum ada_primitive_types {
nr_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 */ /* Language vector */
@ -14065,7 +13998,6 @@ extern const struct language_data ada_language_data =
1, /* String lower bound */ 1, /* String lower bound */
ada_get_gdb_completer_word_break_characters, ada_get_gdb_completer_word_break_characters,
ada_collect_symbol_completion_matches, ada_collect_symbol_completion_matches,
ada_language_arch_info,
ada_watch_location_expression, ada_watch_location_expression,
ada_get_symbol_name_matcher, /* la_get_symbol_name_matcher */ ada_get_symbol_name_matcher, /* la_get_symbol_name_matcher */
ada_iterate_over_symbols, ada_iterate_over_symbols,
@ -14118,6 +14050,71 @@ public:
function to work. */ function to work. */
return language_defn::read_var_value (var, var_block, frame); 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. */ /* Single instance of the Ada language class. */

View file

@ -921,7 +921,6 @@ extern const struct language_data c_language_data =
0, /* String lower bound */ 0, /* String lower bound */
default_word_break_characters, default_word_break_characters,
default_collect_symbol_completion_matches, default_collect_symbol_completion_matches,
c_language_arch_info,
c_watch_location_expression, c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */ NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols, iterate_over_symbols,
@ -941,6 +940,13 @@ public:
c_language () c_language ()
: language_defn (language_c, c_language_data) : language_defn (language_c, c_language_data)
{ /* Nothing. */ } { /* Nothing. */ }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{
c_language_arch_info (gdbarch, lai);
}
}; };
/* Single instance of the C language class. */ /* Single instance of the C language class. */
@ -975,9 +981,78 @@ enum cplus_primitive_types {
nr_cplus_primitive_types nr_cplus_primitive_types
}; };
static void static const char *cplus_extensions[] =
cplus_language_arch_info (struct gdbarch *gdbarch, {
struct language_arch_info *lai) ".C", ".cc", ".cp", ".cpp", ".cxx", ".c++", NULL
};
/* Constant data that describes the C++ language. */
extern const struct language_data cplus_language_data =
{
"c++", /* Language name */
"C++",
language_cplus,
range_check_off,
case_sensitive_on,
array_row_major,
macro_expansion_c,
cplus_extensions,
&exp_descriptor_c,
c_parse,
null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
cplus_skip_trampoline, /* Language specific skip_trampoline */
"this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
cp_lookup_transparent_type, /* lookup_transparent_type */
gdb_demangle, /* Language specific symbol demangler */
gdb_sniff_from_mangled_name,
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 */
default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
cp_get_symbol_name_matcher,
iterate_over_symbols,
cp_search_name_hash,
&cplus_varobj_ops,
cplus_get_compile_context,
cplus_compute_program,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
};
/* A class for the C++ language. */
class cplus_language : public language_defn
{
public:
cplus_language ()
: language_defn (language_cplus, cplus_language_data)
{ /* Nothing. */ }
/* See language.h. */
struct language_pass_by_ref_info pass_by_reference_info
(struct type *type) const override
{
return cp_pass_by_reference (type);
}
/* 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); const struct builtin_type *builtin = builtin_type (gdbarch);
@ -1037,76 +1112,6 @@ cplus_language_arch_info (struct gdbarch *gdbarch,
lai->bool_type_symbol = "bool"; lai->bool_type_symbol = "bool";
lai->bool_type_default = builtin->builtin_bool; lai->bool_type_default = builtin->builtin_bool;
} }
static const char *cplus_extensions[] =
{
".C", ".cc", ".cp", ".cpp", ".cxx", ".c++", NULL
};
/* Constant data that describes the C++ language. */
extern const struct language_data cplus_language_data =
{
"c++", /* Language name */
"C++",
language_cplus,
range_check_off,
case_sensitive_on,
array_row_major,
macro_expansion_c,
cplus_extensions,
&exp_descriptor_c,
c_parse,
null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
cplus_skip_trampoline, /* Language specific skip_trampoline */
"this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
cp_lookup_transparent_type, /* lookup_transparent_type */
gdb_demangle, /* Language specific symbol demangler */
gdb_sniff_from_mangled_name,
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 */
default_word_break_characters,
default_collect_symbol_completion_matches,
cplus_language_arch_info,
c_watch_location_expression,
cp_get_symbol_name_matcher,
iterate_over_symbols,
cp_search_name_hash,
&cplus_varobj_ops,
cplus_get_compile_context,
cplus_compute_program,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
};
/* A class for the C++ language. */
class cplus_language : public language_defn
{
public:
cplus_language ()
: language_defn (language_cplus, cplus_language_data)
{ /* Nothing. */ }
/* See language.h. */
struct language_pass_by_ref_info pass_by_reference_info
(struct type *type) const override
{
return cp_pass_by_reference (type);
}
}; };
/* The single instance of the C++ language class. */ /* The single instance of the C++ language class. */
@ -1154,7 +1159,6 @@ extern const struct language_data asm_language_data =
0, /* String lower bound */ 0, /* String lower bound */
default_word_break_characters, default_word_break_characters,
default_collect_symbol_completion_matches, default_collect_symbol_completion_matches,
c_language_arch_info, /* FIXME: la_language_arch_info. */
c_watch_location_expression, c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */ NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols, iterate_over_symbols,
@ -1174,6 +1178,15 @@ public:
asm_language () asm_language ()
: language_defn (language_asm, asm_language_data) : language_defn (language_asm, asm_language_data)
{ /* Nothing. */ } { /* Nothing. */ }
/* See language.h.
FIXME: Should this have its own arch info method? */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{
c_language_arch_info (gdbarch, lai);
}
}; };
/* The single instance of the ASM language class. */ /* The single instance of the ASM language class. */
@ -1218,7 +1231,6 @@ extern const struct language_data minimal_language_data =
0, /* String lower bound */ 0, /* String lower bound */
default_word_break_characters, default_word_break_characters,
default_collect_symbol_completion_matches, default_collect_symbol_completion_matches,
c_language_arch_info,
c_watch_location_expression, c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */ NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols, iterate_over_symbols,
@ -1238,6 +1250,13 @@ public:
minimal_language () minimal_language ()
: language_defn (language_minimal, minimal_language_data) : language_defn (language_minimal, minimal_language_data)
{ /* Nothing. */ } { /* Nothing. */ }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{
c_language_arch_info (gdbarch, lai);
}
}; };
/* The single instance of the minimal language class. */ /* The single instance of the minimal language class. */

View file

@ -133,12 +133,71 @@ enum d_primitive_types {
nr_d_primitive_types nr_d_primitive_types
}; };
/* Implements the la_language_arch_info language_defn routine static const char *d_extensions[] =
for language D. */ {
".d", NULL
};
static void /* Constant data that describes the D language. */
d_language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) extern const struct language_data d_language_data =
{
"d",
"D",
language_d,
range_check_off,
case_sensitive_on,
array_row_major,
macro_expansion_no,
d_extensions,
&exp_descriptor_c,
d_parse,
null_post_parser,
c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
c_emit_char, /* Print a single char. */
c_print_type, /* Print a type using appropriate syntax. */
c_print_typedef, /* Print a typedef using appropriate
syntax. */
d_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value. */
NULL, /* Language specific skip_trampoline. */
"this",
false, /* la_store_sym_names_in_linkage_form_p */
d_lookup_symbol_nonlocal,
basic_lookup_transparent_type,
d_demangle, /* Language specific symbol demangler. */
d_sniff_from_mangled_name,
NULL, /* Language specific
class_name_from_physname. */
d_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols,
default_search_name_hash,
&default_varobj_ops,
NULL,
NULL,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the D language. */
class d_language : public language_defn
{
public:
d_language ()
: language_defn (language_d, d_language_data)
{ /* Nothing. */ }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{ {
const struct builtin_d_type *builtin = builtin_d_type (gdbarch); const struct builtin_d_type *builtin = builtin_d_type (gdbarch);
@ -199,69 +258,6 @@ d_language_arch_info (struct gdbarch *gdbarch,
lai->bool_type_symbol = "bool"; lai->bool_type_symbol = "bool";
lai->bool_type_default = builtin->builtin_bool; lai->bool_type_default = builtin->builtin_bool;
} }
static const char *d_extensions[] =
{
".d", NULL
};
/* Constant data that describes the D language. */
extern const struct language_data d_language_data =
{
"d",
"D",
language_d,
range_check_off,
case_sensitive_on,
array_row_major,
macro_expansion_no,
d_extensions,
&exp_descriptor_c,
d_parse,
null_post_parser,
c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
c_emit_char, /* Print a single char. */
c_print_type, /* Print a type using appropriate syntax. */
c_print_typedef, /* Print a typedef using appropriate
syntax. */
d_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value. */
NULL, /* Language specific skip_trampoline. */
"this",
false, /* la_store_sym_names_in_linkage_form_p */
d_lookup_symbol_nonlocal,
basic_lookup_transparent_type,
d_demangle, /* Language specific symbol demangler. */
d_sniff_from_mangled_name,
NULL, /* Language specific
class_name_from_physname. */
d_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
default_word_break_characters,
default_collect_symbol_completion_matches,
d_language_arch_info,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols,
default_search_name_hash,
&default_varobj_ops,
NULL,
NULL,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the D language. */
class d_language : public language_defn
{
public:
d_language ()
: language_defn (language_d, d_language_data)
{ /* Nothing. */ }
}; };
/* Single instance of the D language class. */ /* Single instance of the D language class. */

View file

@ -165,44 +165,6 @@ enum f_primitive_types {
nr_f_primitive_types nr_f_primitive_types
}; };
static void
f_language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai)
{
const struct builtin_f_type *builtin = builtin_f_type (gdbarch);
lai->string_char_type = builtin->builtin_character;
lai->primitive_type_vector
= GDBARCH_OBSTACK_CALLOC (gdbarch, nr_f_primitive_types + 1,
struct type *);
lai->primitive_type_vector [f_primitive_type_character]
= builtin->builtin_character;
lai->primitive_type_vector [f_primitive_type_logical]
= builtin->builtin_logical;
lai->primitive_type_vector [f_primitive_type_logical_s1]
= builtin->builtin_logical_s1;
lai->primitive_type_vector [f_primitive_type_logical_s2]
= builtin->builtin_logical_s2;
lai->primitive_type_vector [f_primitive_type_logical_s8]
= builtin->builtin_logical_s8;
lai->primitive_type_vector [f_primitive_type_real]
= builtin->builtin_real;
lai->primitive_type_vector [f_primitive_type_real_s8]
= builtin->builtin_real_s8;
lai->primitive_type_vector [f_primitive_type_real_s16]
= builtin->builtin_real_s16;
lai->primitive_type_vector [f_primitive_type_complex_s8]
= builtin->builtin_complex_s8;
lai->primitive_type_vector [f_primitive_type_complex_s16]
= builtin->builtin_complex_s16;
lai->primitive_type_vector [f_primitive_type_void]
= builtin->builtin_void;
lai->bool_type_symbol = "logical";
lai->bool_type_default = builtin->builtin_logical_s2;
}
/* Remove the modules separator :: from the default break list. */ /* Remove the modules separator :: from the default break list. */
static const char * static const char *
@ -670,7 +632,6 @@ extern const struct language_data f_language_data =
1, /* String lower bound */ 1, /* String lower bound */
f_word_break_characters, f_word_break_characters,
f_collect_symbol_completion_matches, f_collect_symbol_completion_matches,
f_language_arch_info,
c_watch_location_expression, c_watch_location_expression,
cp_get_symbol_name_matcher, /* la_get_symbol_name_matcher */ cp_get_symbol_name_matcher, /* la_get_symbol_name_matcher */
iterate_over_symbols, iterate_over_symbols,
@ -690,6 +651,44 @@ public:
f_language () f_language ()
: language_defn (language_fortran, f_language_data) : language_defn (language_fortran, f_language_data)
{ /* Nothing. */ } { /* Nothing. */ }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{
const struct builtin_f_type *builtin = builtin_f_type (gdbarch);
lai->string_char_type = builtin->builtin_character;
lai->primitive_type_vector
= GDBARCH_OBSTACK_CALLOC (gdbarch, nr_f_primitive_types + 1,
struct type *);
lai->primitive_type_vector [f_primitive_type_character]
= builtin->builtin_character;
lai->primitive_type_vector [f_primitive_type_logical]
= builtin->builtin_logical;
lai->primitive_type_vector [f_primitive_type_logical_s1]
= builtin->builtin_logical_s1;
lai->primitive_type_vector [f_primitive_type_logical_s2]
= builtin->builtin_logical_s2;
lai->primitive_type_vector [f_primitive_type_logical_s8]
= builtin->builtin_logical_s8;
lai->primitive_type_vector [f_primitive_type_real]
= builtin->builtin_real;
lai->primitive_type_vector [f_primitive_type_real_s8]
= builtin->builtin_real_s8;
lai->primitive_type_vector [f_primitive_type_real_s16]
= builtin->builtin_real_s16;
lai->primitive_type_vector [f_primitive_type_complex_s8]
= builtin->builtin_complex_s8;
lai->primitive_type_vector [f_primitive_type_complex_s16]
= builtin->builtin_complex_s16;
lai->primitive_type_vector [f_primitive_type_void]
= builtin->builtin_void;
lai->bool_type_symbol = "logical";
lai->bool_type_default = builtin->builtin_logical_s2;
}
}; };
/* Single instance of the Fortran language class. */ /* Single instance of the Fortran language class. */

View file

@ -523,9 +523,66 @@ enum go_primitive_types {
nr_go_primitive_types nr_go_primitive_types
}; };
static void /* Constant data that describes the Go language. */
go_language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) extern const struct language_data go_language_data =
{
"go",
"Go",
language_go,
range_check_off,
case_sensitive_on,
array_row_major,
macro_expansion_no,
NULL,
&exp_descriptor_c,
go_parse,
null_post_parser,
c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
c_emit_char, /* Print a single char. */
go_print_type, /* Print a type using appropriate syntax. */
c_print_typedef, /* Print a typedef using appropriate
syntax. */
go_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value. */
NULL, /* Language specific skip_trampoline. */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal,
basic_lookup_transparent_type,
go_demangle, /* Language specific symbol demangler. */
go_sniff_from_mangled_name,
NULL, /* Language specific
class_name_from_physname. */
go_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols,
default_search_name_hash,
&default_varobj_ops,
NULL,
NULL,
go_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the Go language. */
class go_language : public language_defn
{
public:
go_language ()
: language_defn (language_go, go_language_data)
{ /* Nothing. */ }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{ {
const struct builtin_go_type *builtin = builtin_go_type (gdbarch); const struct builtin_go_type *builtin = builtin_go_type (gdbarch);
@ -575,64 +632,6 @@ go_language_arch_info (struct gdbarch *gdbarch,
lai->bool_type_symbol = "bool"; lai->bool_type_symbol = "bool";
lai->bool_type_default = builtin->builtin_bool; lai->bool_type_default = builtin->builtin_bool;
} }
/* Constant data that describes the Go language. */
extern const struct language_data go_language_data =
{
"go",
"Go",
language_go,
range_check_off,
case_sensitive_on,
array_row_major,
macro_expansion_no,
NULL,
&exp_descriptor_c,
go_parse,
null_post_parser,
c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
c_emit_char, /* Print a single char. */
go_print_type, /* Print a type using appropriate syntax. */
c_print_typedef, /* Print a typedef using appropriate
syntax. */
go_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value. */
NULL, /* Language specific skip_trampoline. */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal,
basic_lookup_transparent_type,
go_demangle, /* Language specific symbol demangler. */
go_sniff_from_mangled_name,
NULL, /* Language specific
class_name_from_physname. */
go_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
default_word_break_characters,
default_collect_symbol_completion_matches,
go_language_arch_info,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols,
default_search_name_hash,
&default_varobj_ops,
NULL,
NULL,
go_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the Go language. */
class go_language : public language_defn
{
public:
go_language ()
: language_defn (language_go, go_language_data)
{ /* Nothing. */ }
}; };
/* Single instance of the Go language class. */ /* Single instance of the Go language class. */

View file

@ -837,7 +837,6 @@ extern const struct language_data unknown_language_data =
0, /* String lower bound */ 0, /* String lower bound */
default_word_break_characters, default_word_break_characters,
default_collect_symbol_completion_matches, default_collect_symbol_completion_matches,
unknown_language_arch_info, /* la_language_arch_info. */
c_watch_location_expression, c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */ NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols, iterate_over_symbols,
@ -857,6 +856,13 @@ public:
unknown_language () unknown_language ()
: language_defn (language_unknown, unknown_language_data) : language_defn (language_unknown, unknown_language_data)
{ /* Nothing. */ } { /* Nothing. */ }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{
unknown_language_arch_info (gdbarch, lai);
}
}; };
/* Single instance of the unknown language class. */ /* Single instance of the unknown language class. */
@ -899,7 +905,6 @@ extern const struct language_data auto_language_data =
0, /* String lower bound */ 0, /* String lower bound */
default_word_break_characters, default_word_break_characters,
default_collect_symbol_completion_matches, default_collect_symbol_completion_matches,
unknown_language_arch_info, /* la_language_arch_info. */
c_watch_location_expression, c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */ NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols, iterate_over_symbols,
@ -919,6 +924,13 @@ public:
auto_language () auto_language ()
: language_defn (language_auto, auto_language_data) : language_defn (language_auto, auto_language_data)
{ /* Nothing. */ } { /* Nothing. */ }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{
unknown_language_arch_info (gdbarch, lai);
}
}; };
/* Single instance of the fake "auto" language. */ /* Single instance of the fake "auto" language. */
@ -944,9 +956,9 @@ language_gdbarch_post_init (struct gdbarch *gdbarch)
l = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct language_gdbarch); l = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct language_gdbarch);
for (const auto &lang : language_defn::languages) for (const auto &lang : language_defn::languages)
if (lang != NULL && lang->la_language_arch_info != NULL)
{ {
lang->la_language_arch_info (gdbarch, gdb_assert (lang != nullptr);
lang->language_arch_info (gdbarch,
l->arch_info + lang->la_language); l->arch_info + lang->la_language);
} }

View file

@ -368,10 +368,6 @@ struct language_data
const char *word, const char *word,
enum type_code code); enum type_code code);
/* The per-architecture (OS/ABI) language information. */
void (*la_language_arch_info) (struct gdbarch *,
struct language_arch_info *);
/* Return an expression that can be used for a location /* Return an expression that can be used for a location
watchpoint. TYPE is a pointer type that points to the memory watchpoint. TYPE is a pointer type that points to the memory
to watch, and ADDR is the address of the watched memory. */ to watch, and ADDR is the address of the watched memory. */
@ -503,6 +499,11 @@ struct language_defn : language_data
return {}; return {};
} }
/* The per-architecture (OS/ABI) language information. */
virtual void language_arch_info (struct gdbarch *,
struct language_arch_info *) const = 0;
/* List of all known languages. */ /* List of all known languages. */
static const struct language_defn *languages[nr_languages]; static const struct language_defn *languages[nr_languages];
}; };

View file

@ -339,32 +339,6 @@ enum m2_primitive_types {
nr_m2_primitive_types nr_m2_primitive_types
}; };
static void
m2_language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai)
{
const struct builtin_m2_type *builtin = builtin_m2_type (gdbarch);
lai->string_char_type = builtin->builtin_char;
lai->primitive_type_vector
= GDBARCH_OBSTACK_CALLOC (gdbarch, nr_m2_primitive_types + 1,
struct type *);
lai->primitive_type_vector [m2_primitive_type_char]
= builtin->builtin_char;
lai->primitive_type_vector [m2_primitive_type_int]
= builtin->builtin_int;
lai->primitive_type_vector [m2_primitive_type_card]
= builtin->builtin_card;
lai->primitive_type_vector [m2_primitive_type_real]
= builtin->builtin_real;
lai->primitive_type_vector [m2_primitive_type_bool]
= builtin->builtin_bool;
lai->bool_type_symbol = "BOOLEAN";
lai->bool_type_default = builtin->builtin_bool;
}
const struct exp_descriptor exp_descriptor_modula2 = const struct exp_descriptor exp_descriptor_modula2 =
{ {
print_subexp_standard, print_subexp_standard,
@ -411,7 +385,6 @@ extern const struct language_data m2_language_data =
0, /* String lower bound */ 0, /* String lower bound */
default_word_break_characters, default_word_break_characters,
default_collect_symbol_completion_matches, default_collect_symbol_completion_matches,
m2_language_arch_info,
c_watch_location_expression, c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */ NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols, iterate_over_symbols,
@ -431,6 +404,32 @@ public:
m2_language () m2_language ()
: language_defn (language_m2, m2_language_data) : language_defn (language_m2, m2_language_data)
{ /* Nothing. */ } { /* Nothing. */ }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{
const struct builtin_m2_type *builtin = builtin_m2_type (gdbarch);
lai->string_char_type = builtin->builtin_char;
lai->primitive_type_vector
= GDBARCH_OBSTACK_CALLOC (gdbarch, nr_m2_primitive_types + 1,
struct type *);
lai->primitive_type_vector [m2_primitive_type_char]
= builtin->builtin_char;
lai->primitive_type_vector [m2_primitive_type_int]
= builtin->builtin_int;
lai->primitive_type_vector [m2_primitive_type_card]
= builtin->builtin_card;
lai->primitive_type_vector [m2_primitive_type_real]
= builtin->builtin_real;
lai->primitive_type_vector [m2_primitive_type_bool]
= builtin->builtin_bool;
lai->bool_type_symbol = "BOOLEAN";
lai->bool_type_default = builtin->builtin_bool;
}
}; };
/* Single instance of the M2 language. */ /* Single instance of the M2 language. */

View file

@ -400,7 +400,6 @@ extern const struct language_data objc_language_data =
0, /* String lower bound */ 0, /* String lower bound */
default_word_break_characters, default_word_break_characters,
default_collect_symbol_completion_matches, default_collect_symbol_completion_matches,
c_language_arch_info,
c_watch_location_expression, c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */ NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols, iterate_over_symbols,
@ -420,6 +419,13 @@ public:
objc_language () objc_language ()
: language_defn (language_objc, objc_language_data) : language_defn (language_objc, objc_language_data)
{ /* Nothing. */ } { /* Nothing. */ }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{
c_language_arch_info (gdbarch, lai);
}
}; };
/* Single instance of the class representing the Objective-C language. */ /* Single instance of the class representing the Objective-C language. */

View file

@ -1015,23 +1015,6 @@ opencl_print_type (struct type *type, const char *varstring,
c_print_type (type, varstring, stream, show, level, flags); c_print_type (type, varstring, stream, show, level, flags);
} }
static void
opencl_language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai)
{
struct type **types = builtin_opencl_type (gdbarch);
/* Copy primitive types vector from gdbarch. */
lai->primitive_type_vector = types;
/* Type of elements of strings. */
lai->string_char_type = types [opencl_primitive_type_char];
/* Specifies the return type of logical and relational operations. */
lai->bool_type_symbol = "int";
lai->bool_type_default = types [opencl_primitive_type_int];
}
const struct exp_descriptor exp_descriptor_opencl = const struct exp_descriptor exp_descriptor_opencl =
{ {
print_subexp_standard, print_subexp_standard,
@ -1077,7 +1060,6 @@ extern const struct language_data opencl_language_data =
0, /* String lower bound */ 0, /* String lower bound */
default_word_break_characters, default_word_break_characters,
default_collect_symbol_completion_matches, default_collect_symbol_completion_matches,
opencl_language_arch_info,
c_watch_location_expression, c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */ NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols, iterate_over_symbols,
@ -1097,6 +1079,23 @@ public:
opencl_language () opencl_language ()
: language_defn (language_opencl, opencl_language_data) : language_defn (language_opencl, opencl_language_data)
{ /* Nothing. */ } { /* Nothing. */ }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{
struct type **types = builtin_opencl_type (gdbarch);
/* Copy primitive types vector from gdbarch. */
lai->primitive_type_vector = types;
/* Type of elements of strings. */
lai->string_char_type = types [opencl_primitive_type_char];
/* Specifies the return type of logical and relational operations. */
lai->bool_type_symbol = "int";
lai->bool_type_default = types [opencl_primitive_type_int];
}
}; };
/* Single instance of the OpenCL language class. */ /* Single instance of the OpenCL language class. */

View file

@ -375,9 +375,69 @@ enum pascal_primitive_types {
nr_pascal_primitive_types nr_pascal_primitive_types
}; };
static void static const char *p_extensions[] =
pascal_language_arch_info (struct gdbarch *gdbarch, {
struct language_arch_info *lai) ".pas", ".p", ".pp", NULL
};
/* Constant data representing the Pascal language. */
extern const struct language_data pascal_language_data =
{
"pascal", /* Language name */
"Pascal",
language_pascal,
range_check_on,
case_sensitive_on,
array_row_major,
macro_expansion_no,
p_extensions,
&exp_descriptor_standard,
pascal_parse,
null_post_parser,
pascal_printchar, /* Print a character constant */
pascal_printstr, /* Function to print string constant */
pascal_emit_char, /* Print a single char */
pascal_print_type, /* Print a type using appropriate syntax */
pascal_print_typedef, /* Print a typedef using appropriate syntax */
pascal_value_print_inner, /* la_value_print_inner */
pascal_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
"this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
NULL,
NULL, /* Language specific class_name_from_physname */
pascal_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_compare_symbol_for_completion */
iterate_over_symbols,
default_search_name_hash,
&default_varobj_ops,
NULL,
NULL,
pascal_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the Pascal language. */
class pascal_language : public language_defn
{
public:
pascal_language ()
: language_defn (language_pascal, pascal_language_data)
{ /* Nothing. */ }
/* 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); const struct builtin_type *builtin = builtin_type (gdbarch);
@ -423,67 +483,6 @@ pascal_language_arch_info (struct gdbarch *gdbarch,
lai->bool_type_symbol = "boolean"; lai->bool_type_symbol = "boolean";
lai->bool_type_default = builtin->builtin_bool; lai->bool_type_default = builtin->builtin_bool;
} }
static const char *p_extensions[] =
{
".pas", ".p", ".pp", NULL
};
/* Constant data representing the Pascal language. */
extern const struct language_data pascal_language_data =
{
"pascal", /* Language name */
"Pascal",
language_pascal,
range_check_on,
case_sensitive_on,
array_row_major,
macro_expansion_no,
p_extensions,
&exp_descriptor_standard,
pascal_parse,
null_post_parser,
pascal_printchar, /* Print a character constant */
pascal_printstr, /* Function to print string constant */
pascal_emit_char, /* Print a single char */
pascal_print_type, /* Print a type using appropriate syntax */
pascal_print_typedef, /* Print a typedef using appropriate syntax */
pascal_value_print_inner, /* la_value_print_inner */
pascal_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
"this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
NULL,
NULL, /* Language specific class_name_from_physname */
pascal_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
default_word_break_characters,
default_collect_symbol_completion_matches,
pascal_language_arch_info,
c_watch_location_expression,
NULL, /* la_compare_symbol_for_completion */
iterate_over_symbols,
default_search_name_hash,
&default_varobj_ops,
NULL,
NULL,
pascal_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the Pascal language. */
class pascal_language : public language_defn
{
public:
pascal_language ()
: language_defn (language_pascal, pascal_language_data)
{ /* Nothing. */ }
}; };
/* Single instance of the Pascal language class. */ /* Single instance of the Pascal language class. */

View file

@ -1066,51 +1066,6 @@ enum rust_primitive_types
nr_rust_primitive_types nr_rust_primitive_types
}; };
/* la_language_arch_info implementation for Rust. */
static void
rust_language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai)
{
const struct builtin_type *builtin = builtin_type (gdbarch);
struct type *tem;
struct type **types;
unsigned int length;
types = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_rust_primitive_types + 1,
struct type *);
types[rust_primitive_bool] = arch_boolean_type (gdbarch, 8, 1, "bool");
types[rust_primitive_char] = arch_character_type (gdbarch, 32, 1, "char");
types[rust_primitive_i8] = arch_integer_type (gdbarch, 8, 0, "i8");
types[rust_primitive_u8] = arch_integer_type (gdbarch, 8, 1, "u8");
types[rust_primitive_i16] = arch_integer_type (gdbarch, 16, 0, "i16");
types[rust_primitive_u16] = arch_integer_type (gdbarch, 16, 1, "u16");
types[rust_primitive_i32] = arch_integer_type (gdbarch, 32, 0, "i32");
types[rust_primitive_u32] = arch_integer_type (gdbarch, 32, 1, "u32");
types[rust_primitive_i64] = arch_integer_type (gdbarch, 64, 0, "i64");
types[rust_primitive_u64] = arch_integer_type (gdbarch, 64, 1, "u64");
length = 8 * TYPE_LENGTH (builtin->builtin_data_ptr);
types[rust_primitive_isize] = arch_integer_type (gdbarch, length, 0, "isize");
types[rust_primitive_usize] = arch_integer_type (gdbarch, length, 1, "usize");
types[rust_primitive_f32] = arch_float_type (gdbarch, 32, "f32",
floatformats_ieee_single);
types[rust_primitive_f64] = arch_float_type (gdbarch, 64, "f64",
floatformats_ieee_double);
types[rust_primitive_unit] = arch_integer_type (gdbarch, 0, 1, "()");
tem = make_cv_type (1, 0, types[rust_primitive_u8], NULL);
types[rust_primitive_str] = rust_slice_type ("&str", tem,
types[rust_primitive_usize]);
lai->primitive_type_vector = types;
lai->bool_type_default = types[rust_primitive_bool];
lai->string_char_type = types[rust_primitive_u8];
}
/* A helper for rust_evaluate_subexp that handles OP_FUNCALL. */ /* A helper for rust_evaluate_subexp that handles OP_FUNCALL. */
@ -2137,7 +2092,6 @@ extern const struct language_data rust_language_data =
0, /* String lower bound */ 0, /* String lower bound */
default_word_break_characters, default_word_break_characters,
default_collect_symbol_completion_matches, default_collect_symbol_completion_matches,
rust_language_arch_info,
rust_watch_location_expression, rust_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */ NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols, iterate_over_symbols,
@ -2157,6 +2111,47 @@ public:
rust_language () rust_language ()
: language_defn (language_rust, rust_language_data) : language_defn (language_rust, rust_language_data)
{ /* Nothing. */ } { /* Nothing. */ }
/* 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);
struct type **types
= GDBARCH_OBSTACK_CALLOC (gdbarch, nr_rust_primitive_types + 1,
struct type *);
types[rust_primitive_bool] = arch_boolean_type (gdbarch, 8, 1, "bool");
types[rust_primitive_char] = arch_character_type (gdbarch, 32, 1, "char");
types[rust_primitive_i8] = arch_integer_type (gdbarch, 8, 0, "i8");
types[rust_primitive_u8] = arch_integer_type (gdbarch, 8, 1, "u8");
types[rust_primitive_i16] = arch_integer_type (gdbarch, 16, 0, "i16");
types[rust_primitive_u16] = arch_integer_type (gdbarch, 16, 1, "u16");
types[rust_primitive_i32] = arch_integer_type (gdbarch, 32, 0, "i32");
types[rust_primitive_u32] = arch_integer_type (gdbarch, 32, 1, "u32");
types[rust_primitive_i64] = arch_integer_type (gdbarch, 64, 0, "i64");
types[rust_primitive_u64] = arch_integer_type (gdbarch, 64, 1, "u64");
unsigned int length = 8 * TYPE_LENGTH (builtin->builtin_data_ptr);
types[rust_primitive_isize] = arch_integer_type (gdbarch, length, 0, "isize");
types[rust_primitive_usize] = arch_integer_type (gdbarch, length, 1, "usize");
types[rust_primitive_f32] = arch_float_type (gdbarch, 32, "f32",
floatformats_ieee_single);
types[rust_primitive_f64] = arch_float_type (gdbarch, 64, "f64",
floatformats_ieee_double);
types[rust_primitive_unit] = arch_integer_type (gdbarch, 0, 1, "()");
struct type *tem = make_cv_type (1, 0, types[rust_primitive_u8], NULL);
types[rust_primitive_str] = rust_slice_type ("&str", tem,
types[rust_primitive_usize]);
lai->primitive_type_vector = types;
lai->bool_type_default = types[rust_primitive_bool];
lai->string_char_type = types[rust_primitive_u8];
}
}; };
/* Single instance of the Rust language class. */ /* Single instance of the Rust language class. */