From 46157d77c324ab6adf52ddf994a6ccb3328b3edb Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Wed, 28 Oct 2020 18:10:01 +0000 Subject: gdb: move pascal_language into p-lang.h Move the pascal_language class declaration into the p-lang.h header file. This allows for the function implementations to be spread over the different p-*.c files without the need for global trampoline functions. As a consequence of this change many of the Pascal value and type printing helper functions have become member functions within the pascal_language class. There should be no user visible changes after this commit. gdb/ChangeLog: * p-exp.y (exp): Update call to pascal_is_string_type. (pascal_parse): Rename to... (pascal_language::parser): ...this. * p-lang.c (is_pascal_string_type): Rename to... (pascal_is_string_type): ...this. (pascal_one_char): Rename to... (pascal_language::print_one_char): ...this. (pascal_printchar): Rename to... (pascal_language::printchar): ...this. Update call to print_one_char member function. (pascal_op_print_tab): Rename to... (pascal_language::op_print_tab): ...this. (class pascal_language): Moved to p-lang.h. (pascal_language::language_arch_info): Function implementation moved out of class declaration. (pascal_language::printstr): Likewise. * p-lang.h (pascal_parse): Delete declaration. (pascal_is_string_type): Declare. (pascal_print_type): Delete declaration. (pascal_print_typedef): Delete declaration. (pascal_value_print_inner): Delete declaration. (pascal_value_print): Delete declaration. (pascal_type_print_method_args): Delete declaration. (is_pascal_string_type): Delete declaration. (pascal_printchar): Delete declaration. (pascal_builtin_types): Delete declaration. (pascal_type_print_base): Delete declaration. (pascal_type_print_varspec_prefix): Delete declaration. (class pascal_language): Moved here from p-lang.c. * p-typeprint.c (pascal_type_print_varspec_suffix): Delete declaration. (pascal_type_print_derivation_info): Delete declaration. (pascal_print_type): Rename to... (pascal_language::print_type): ...this. Update calls to member functions. (pascal_print_typedef): Rename to... (pascal_language::print_typedef): ...this. Update calls to member functions. (pascal_type_print_derivation_info): Rename to... (pascal_language::type_print_derivation_info): ...this. (pascal_type_print_method_args): Rename to... (pascal_language::type_print_method_args): ...this. (pascal_type_print_varspec_prefix): Rename to... (pascal_language::type_print_varspec_prefix): ...this. Update calls to member functions. (pascal_print_func_args): Rename to... (pascal_language::print_func_args): ...this. Update calls to member functions. (pascal_type_print_func_varspec_suffix): Rename to... (pascal_language::type_print_func_varspec_suffix): ...this. Update calls to member functions. (pascal_type_print_varspec_suffix): Rename to... (pascal_language::type_print_varspec_suffix): ...this. Update calls to member functions. (pascal_type_print_base): Rename to... (pascal_language::type_print_base): ...this. Update calls to member functions. * p-valprint.c (pascal_value_print_inner): Rename to... (pascal_language::value_print_inner): ...this. Update calls to member functions. (pascal_value_print): Rename to... (pascal_language::value_print): ...this. Update calls to member functions. --- gdb/p-valprint.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'gdb/p-valprint.c') diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 8f785b7..b748c06 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -64,9 +64,9 @@ static const struct generic_val_print_decorations p_decorations = /* See p-lang.h. */ void -pascal_value_print_inner (struct value *val, struct ui_file *stream, - int recurse, - const struct value_print_options *options) +pascal_language::value_print_inner (struct value *val, + struct ui_file *stream, int recurse, + const struct value_print_options *options) const { struct type *type = check_typedef (value_type (val)); @@ -200,8 +200,8 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream, as GDB does not recognize stabs pascal strings Pascal strings are mapped to records with lowercase names PM. */ - if (is_pascal_string_type (elttype, &length_pos, &length_size, - &string_pos, &char_type, NULL) + if (pascal_is_string_type (elttype, &length_pos, &length_size, + &string_pos, &char_type, NULL) > 0 && addr != 0) { ULONGEST string_length; @@ -313,8 +313,8 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream, } else { - if (is_pascal_string_type (type, &length_pos, &length_size, - &string_pos, &char_type, NULL)) + if (pascal_is_string_type (type, &length_pos, &length_size, + &string_pos, &char_type, NULL) > 0) { len = extract_unsigned_integer (valaddr + length_pos, length_size, byte_order); @@ -402,8 +402,8 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream, void -pascal_value_print (struct value *val, struct ui_file *stream, - const struct value_print_options *options) +pascal_language::value_print (struct value *val, struct ui_file *stream, + const struct value_print_options *options) const { struct type *type = value_type (val); struct value_print_options opts = *options; @@ -499,9 +499,7 @@ pascal_object_is_vtbl_member (struct type *type) return 0; } -/* Mutually recursive subroutines of pascal_object_print_value and - pascal_value_print to print out a structure's fields: - pascal_object_print_value_fields and pascal_object_print_value. +/* Helper function for print pascal objects. VAL, STREAM, RECURSE, and OPTIONS have the same meanings as in pascal_object_print_value and c_value_print. -- cgit v1.1