aboutsummaryrefslogtreecommitdiff
path: root/gdb/p-lang.c
AgeCommit message (Collapse)AuthorFilesLines
2024-04-23gdb: move a bunch of quit-related things to event-top.{c,h}Simon Marchi1-0/+1
Move some declarations related to the "quit" machinery from defs.h to event-top.h. Most of the definitions associated to these declarations are in event-top.c. The exceptions are `quit()` and `maybe_quit()`, that are defined in utils.c. For consistency, move these two definitions to event-top.c. Include "event-top.h" in many files that use these things. Change-Id: I6594f6df9047a9a480e7b9934275d186afb14378 Approved-By: Tom Tromey <tom@tromey.com>
2024-04-22gdb: move store/extract integer functions to extract-store-integer.{c,h}Simon Marchi1-0/+1
Move the declarations out of defs.h, and the implementations out of findvar.c. I opted for a new file, because this functionality of converting integers to bytes and vice-versa seems a bit to generic to live in findvar.c. Change-Id: I524858fca33901ee2150c582bac16042148d2251 Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-03-26gdb, gdbserver, gdbsupport: remove includes of early headersSimon Marchi1-1/+0
Now that defs.h, server.h and common-defs.h are included via the `-include` option, it is no longer necessary for source files to include them. Remove all the inclusions of these files I could find. Update the generation scripts where relevant. Change-Id: Ia026cff269c1b7ae7386dd3619bc9bb6a5332837 Approved-By: Pedro Alves <pedro@palves.net>
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-01-19GDB: Add a character string limiting optionAndrew Burgess1-1/+2
This commit splits the `set/show print elements' option into two. We retain `set/show print elements' for controlling how many elements of an array we print, but a new `set/show print characters' setting is added which is used for controlling how many characters of a string are printed. The motivation behind this change is to allow users a finer level of control over how data is printed, reflecting that, although strings can be thought of as arrays of characters, users often want to treat these two things differently. For compatibility reasons by default the `set/show print characters' option is set to `elements', which makes the limit for character strings follow the setting of the `set/show print elements' option, as it used to. Using `set print characters' with any other value makes the limit independent from the `set/show print elements' setting, however it can be restored to the default with the `set print characters elements' command at any time. A corresponding `-characters' option for the `print' command is added, with the same semantics, i.e. one can use `elements' to make a given `print' invocation follow the limit of elements, be it set with the `-elements' option also given with the same invocation or taken from the `set/show print elements' setting, for characters as well regardless of the current setting of the `set/show print characters' option. The GDB changes are all pretty straightforward, just changing references to the old 'print_max' to use a new `get_print_max_chars' helper which figures out which of the two of `print_max' and `print_max_chars' values to use. Likewise, the documentation is just updated to reference the new setting where appropriate. To make people's life easier the message shown by `show print elements' now indicates if the setting also applies to character strings: (gdb) set print characters elements (gdb) show print elements Limit on string chars or array elements to print is 200. (gdb) set print characters unlimited (gdb) show print elements Limit on array elements to print is 200. (gdb) and the help text shows the dependency as well: (gdb) help set print elements Set limit on array elements to print. "unlimited" causes there to be no limit. This setting also applies to string chars when "print characters" is set to "elements". (gdb) In the testsuite there are two minor updates, one to add `-characters' to the list of completions now shown for the `print' command, and a bare minimum pair of checks for the right handling of `set print characters' and `show print characters', copied from the corresponding checks for `set print elements' and `show print elements' respectively. Co-Authored-By: Maciej W. Rozycki <macro@embecosm.com> Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-09-21gdb: remove TYPE_LENGTHSimon Marchi1-3/+3
Remove the macro, replace all uses with calls to type::length. Change-Id: Ib9bdc954576860b21190886534c99103d6a47afb
2022-09-21gdb: remove TYPE_TARGET_TYPESimon Marchi1-3/+3
Remove the macro, replace all uses by calls to type::target_type. Change-Id: Ie51d3e1e22f94130176d6abd723255282bb6d1ed
2022-03-29Unify gdb printf functionsTom Tromey1-5/+5
Now that filtered and unfiltered output can be treated identically, we can unify the printf family of functions. This is done under the name "gdb_printf". Most of this patch was written by script.
2022-03-29Unify gdb puts functionsTom Tromey1-10/+10
Now that filtered and unfiltered output can be treated identically, we can unify the puts family of functions. This is done under the name "gdb_puts". Most of this patch was written by script.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-10-29gdb: remove TYPE_FIELD_BITPOSSimon Marchi1-4/+4
Remove TYPE_FIELD_BITPOS, replace its uses with type::field + field::loc_bitpos. Change-Id: Iccd8d5a77e5352843a837babaa6bd284162e0320
2021-09-30gdb: remove TYPE_FIELD_NAME and FIELD_NAME macrosSimon Marchi1-10/+10
Remove the `TYPE_FIELD_NAME` and `FIELD_NAME` macros, changing all the call sites to use field::name directly. Change-Id: I6900ae4e1ffab1396e24fb3298e94bf123826ca6
2021-05-27gdb: fix tab after space indentation issuesSimon Marchi1-2/+2
I spotted some indentation issues where we had some spaces followed by tabs at beginning of line, that I wanted to fix. So while at it, I did a quick grep to find and fix all I could find. gdb/ChangeLog: * Fix tab after space indentation issues throughout. Change-Id: I1acb414dd9c593b474ae2b8667496584df4316fd
2021-03-08Remove union exp_elementTom Tromey1-34/+0
This removes union exp_element functions that either create such elements or walk them. struct expression no longer holds exp_elements. A couple of language_defn methods are also removed, as they are obsolete. Note that this patch also removes the print_expression code. The only in-tree caller of this was from dump_prefix_expression, which is only called when expression debugging is enabled. Implementing this would involve a fair amount of code, and it seems to me that prefix dumping is preferable anyway, as it is unambiguous. So, I have not reimplemented this feature. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * value.h (evaluate_subexp_with_coercion): Don't declare. * parse.c (exp_descriptor_standard): Remove. (expr_builder::expr_builder, expr_builder::release): Update. (expression::expression): Remove size_t parameter. (expression::~expression): Simplify. (expression::resize): Remove. (write_exp_elt, write_exp_elt_opcode, write_exp_elt_sym) (write_exp_elt_msym, write_exp_elt_block, write_exp_elt_objfile) (write_exp_elt_longcst, write_exp_elt_floatcst) (write_exp_elt_type, write_exp_elt_intern, write_exp_string) (write_exp_string_vector, write_exp_bitstring): Remove. * p-lang.h (class pascal_language) <opcode_print_table, op_print_tab>: Remove. * p-lang.c (pascal_language::op_print_tab): Remove. * opencl-lang.c (class opencl_language) <opcode_print_table>: Remove. * objc-lang.c (objc_op_print_tab): Remove. (class objc_language) <opcode_print_table>: Remove. * m2-lang.h (class m2_language) <opcode_print_table, op_print_tab>: Remove. * m2-lang.c (m2_language::op_print_tab): Remove. * language.h (struct language_defn) <post_parser, expression_ops, opcode_print_table>: Remove. * language.c (language_defn::expression_ops) (auto_or_unknown_language::opcode_print_table): Remove. * go-lang.h (class go_language) <opcode_print_table, op_print_tab>: Remove. * go-lang.c (go_language::op_print_tab): Remove. * f-lang.h (class f_language) <opcode_print_table>: Remove <op_print_tab>: Remove. * f-lang.c (f_language::op_print_tab): Remove. * expression.h (union exp_element): Remove. (struct expression): Remove size_t parameter from constructor. <resize>: Remove. <first_opcode>: Update. <nelts, elts>: Remove. (EXP_ELEM_TO_BYTES, BYTES_TO_EXP_ELEM): Remove. (evaluate_subexp_standard, print_expression, op_string) (dump_raw_expression): Don't declare. * expprint.c (print_expression, print_subexp) (print_subexp_funcall, print_subexp_standard, op_string) (dump_raw_expression, dump_subexp, dump_subexp_body) (dump_subexp_body_funcall, dump_subexp_body_standard): Remove. (dump_prefix_expression): Update. * eval.c (evaluate_subexp): Remove. (evaluate_expression, evaluate_type): Update. (evaluate_subexpression_type): Remove. (fetch_subexp_value): Remove "pc" parameter. Update. (extract_field_op, evaluate_struct_tuple, evaluate_funcall) (evaluate_subexp_standard, evaluate_subexp_for_address) (evaluate_subexp_with_coercion, evaluate_subexp_for_sizeof) (evaluate_subexp_for_cast): Remove. (parse_and_eval_type): Update. * dtrace-probe.c (dtrace_probe::compile_to_ax): Update. * d-lang.c (d_op_print_tab): Remove. (class d_language) <opcode_print_table>: Remove. * c-lang.h (c_op_print_tab): Don't declare. * c-lang.c (c_op_print_tab): Remove. (class c_language, class cplus_language, class asm_language, class minimal_language) <opcode_print_table>: Remove. * breakpoint.c (update_watchpoint, watchpoint_check) (watchpoint_exp_is_const, watch_command_1): Update. * ax-gdb.h (union exp_element): Don't declare. * ax-gdb.c (const_var_ref, const_expr, maybe_const_expr) (gen_repeat, gen_sizeof, gen_expr_for_cast, gen_expr) (gen_expr_binop_rest): Remove. (gen_trace_for_expr, gen_eval_for_expr, gen_printf): Update. * ada-lang.c (ada_op_print_tab): Remove. (class ada_language) <post_parser, opcode_print_table>: Remove.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-12-23gdb: move pascal_language into p-lang.hAndrew Burgess1-252/+132
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.
2020-11-12gdb: rewrite how per language primitive types are managedAndrew Burgess1-61/+26
Consider the following GDB session: $ gdb (gdb) set language c (gdb) ptype void type = void (gdb) set language fortran (gdb) ptype void No symbol table is loaded. Use the "file" command. (gdb) With no symbol file loaded GDB and the language set to C GDB knows about the type void, while when the language is set to Fortran GDB doesn't know about the void, why is that? In f-lang.c, f_language::language_arch_info, we do have this line: lai->primitive_type_vector [f_primitive_type_void] = builtin->builtin_void; where we add the void type to the list of primitive types that GDB should always know about, so what's going wrong? It turns out that the primitive types are stored in a C style array, indexed by an enum, so Fortran uses `enum f_primitive_types'. The array is allocated and populated in each languages language_arch_info member function. The array is allocated with an extra entry at the end which is left as a NULL value, and this indicates the end of the array of types. Unfortunately for Fortran, a type is not assigned for each element in the enum. As a result the final populated array has gaps in it, gaps which are initialised to NULL, and so every time we iterate over the list (for Fortran) we stop early, and never reach the void type. This has been the case since 2007 when this functionality was added to GDB in commit cad351d11d6c3f6487cd. Obviously I could just fix Fortran by ensuring that either the enum is trimmed, or we create types for the missing types. However, I think a better approach would be to move to C++ data structures and removed the fixed enum indexing into the array approach. After this commit the primitive types are pushed into a vector, and GDB just iterates over the vector in the obvious way when it needs to hunt for a type. After this commit all the currently defined primitive types can be found when the language is set to Fortran, for example: $ gdb (gdb) set language fortran (gdb) ptype void type = void (gdb) A new test checks this functionality. I didn't see any other languages with similar issues, but I could have missed something. gdb/ChangeLog: * ada-exp.y (find_primitive_type): Make parameter const. * ada-lang.c (enum ada_primitive_types): Delete. (ada_language::language_arch_info): Update. * c-lang.c (enum c_primitive_types): Delete. (c_language_arch_info): Update. (enum cplus_primitive_types): Delete. (cplus_language::language_arch_info): Update. * d-lang.c (enum d_primitive_types): Delete. (d_language::language_arch_info): Update. * f-lang.c (enum f_primitive_types): Delete. (f_language::language_arch_info): Update. * go-lang.c (enum go_primitive_types): Delete. (go_language::language_arch_info): Update. * language.c (auto_or_unknown_language::language_arch_info): Update. (language_gdbarch_post_init): Use obstack_new, use array indexing. (language_string_char_type): Add header comment, call function in language_arch_info. (language_bool_type): Likewise (language_arch_info::bool_type): Define. (language_lookup_primitive_type_1): Delete. (language_lookup_primitive_type): Rewrite as a templated function to call function in language_arch_info, then instantiate twice. (language_arch_info::type_and_symbol::alloc_type_symbol): Define. (language_arch_info::lookup_primitive_type_and_symbol): Define. (language_arch_info::lookup_primitive_type): Define twice with different signatures. (language_arch_info::lookup_primitive_type_as_symbol): Define. (language_lookup_primitive_type_as_symbol): Rewrite to call a member function in language_arch_info. * language.h (language_arch_info): Complete rewrite. (language_lookup_primitive_type): Make templated. * m2-lang.c (enum m2_primitive_types): Delete. (m2_language::language_arch_info): Update. * opencl-lang.c (OCL_P_TYPE): Delete. (enum opencl_primitive_types): Delete. (opencl_type_data): Delete. (builtin_opencl_type): Delete. (lookup_opencl_vector_type): Update. (opencl_language::language_arch_info): Update, lots of content moved from... (build_opencl_types): ...here. This function is now deleted. (_initialize_opencl_language): Delete. * p-lang.c (enum pascal_primitive_types): Delete. (pascal_language::language_arch_info): Update. * rust-lang.c (enum rust_primitive_types): Delete. (rust_language::language_arch_info): Update. gdb/testsuite/ChangeLog: * gdb.fortran/types.exp: Add more tests.
2020-11-02gdb, gdbserver, gdbsupport: fix leading space vs tabs issuesSimon Marchi1-14/+14
Many spots incorrectly use only spaces for indentation (for example, there are a lot of spots in ada-lang.c). I've always found it awkward when I needed to edit one of these spots: do I keep the original wrong indentation, or do I fix it? What if the lines around it are also wrong, do I fix them too? I probably don't want to fix them in the same patch, to avoid adding noise to my patch. So I propose to fix as much as possible once and for all (hopefully). One typical counter argument for this is that it makes code archeology more difficult, because git-blame will show this commit as the last change for these lines. My counter counter argument is: when git-blaming, you often need to do "blame the file at the parent commit" anyway, to go past some other refactor that touched the line you are interested in, but is not the change you are looking for. So you already need a somewhat efficient way to do this. Using some interactive tool, rather than plain git-blame, makes this trivial. For example, I use "tig blame <file>", where going back past the commit that changed the currently selected line is one keystroke. It looks like Magit in Emacs does it too (though I've never used it). Web viewers of Github and Gitlab do it too. My point is that it won't really make archeology more difficult. The other typical counter argument is that it will cause conflicts with existing patches. That's true... but it's a one time cost, and those are not conflicts that are difficult to resolve. I have also tried "git rebase --ignore-whitespace", it seems to work well. Although that will re-introduce the faulty indentation, so one needs to take care of fixing the indentation in the patch after that (which is easy). gdb/ChangeLog: * aarch64-linux-tdep.c: Fix indentation. * aarch64-ravenscar-thread.c: Fix indentation. * aarch64-tdep.c: Fix indentation. * aarch64-tdep.h: Fix indentation. * ada-lang.c: Fix indentation. * ada-lang.h: Fix indentation. * ada-tasks.c: Fix indentation. * ada-typeprint.c: Fix indentation. * ada-valprint.c: Fix indentation. * ada-varobj.c: Fix indentation. * addrmap.c: Fix indentation. * addrmap.h: Fix indentation. * agent.c: Fix indentation. * aix-thread.c: Fix indentation. * alpha-bsd-nat.c: Fix indentation. * alpha-linux-tdep.c: Fix indentation. * alpha-mdebug-tdep.c: Fix indentation. * alpha-nbsd-tdep.c: Fix indentation. * alpha-obsd-tdep.c: Fix indentation. * alpha-tdep.c: Fix indentation. * amd64-bsd-nat.c: Fix indentation. * amd64-darwin-tdep.c: Fix indentation. * amd64-linux-nat.c: Fix indentation. * amd64-linux-tdep.c: Fix indentation. * amd64-nat.c: Fix indentation. * amd64-obsd-tdep.c: Fix indentation. * amd64-tdep.c: Fix indentation. * amd64-windows-tdep.c: Fix indentation. * annotate.c: Fix indentation. * arc-tdep.c: Fix indentation. * arch-utils.c: Fix indentation. * arch/arm-get-next-pcs.c: Fix indentation. * arch/arm.c: Fix indentation. * arm-linux-nat.c: Fix indentation. * arm-linux-tdep.c: Fix indentation. * arm-nbsd-tdep.c: Fix indentation. * arm-pikeos-tdep.c: Fix indentation. * arm-tdep.c: Fix indentation. * arm-tdep.h: Fix indentation. * arm-wince-tdep.c: Fix indentation. * auto-load.c: Fix indentation. * auxv.c: Fix indentation. * avr-tdep.c: Fix indentation. * ax-gdb.c: Fix indentation. * ax-general.c: Fix indentation. * bfin-linux-tdep.c: Fix indentation. * block.c: Fix indentation. * block.h: Fix indentation. * blockframe.c: Fix indentation. * bpf-tdep.c: Fix indentation. * break-catch-sig.c: Fix indentation. * break-catch-syscall.c: Fix indentation. * break-catch-throw.c: Fix indentation. * breakpoint.c: Fix indentation. * breakpoint.h: Fix indentation. * bsd-uthread.c: Fix indentation. * btrace.c: Fix indentation. * build-id.c: Fix indentation. * buildsym-legacy.h: Fix indentation. * buildsym.c: Fix indentation. * c-typeprint.c: Fix indentation. * c-valprint.c: Fix indentation. * c-varobj.c: Fix indentation. * charset.c: Fix indentation. * cli/cli-cmds.c: Fix indentation. * cli/cli-decode.c: Fix indentation. * cli/cli-decode.h: Fix indentation. * cli/cli-script.c: Fix indentation. * cli/cli-setshow.c: Fix indentation. * coff-pe-read.c: Fix indentation. * coffread.c: Fix indentation. * compile/compile-cplus-types.c: Fix indentation. * compile/compile-object-load.c: Fix indentation. * compile/compile-object-run.c: Fix indentation. * completer.c: Fix indentation. * corefile.c: Fix indentation. * corelow.c: Fix indentation. * cp-abi.h: Fix indentation. * cp-namespace.c: Fix indentation. * cp-support.c: Fix indentation. * cp-valprint.c: Fix indentation. * cris-linux-tdep.c: Fix indentation. * cris-tdep.c: Fix indentation. * darwin-nat-info.c: Fix indentation. * darwin-nat.c: Fix indentation. * darwin-nat.h: Fix indentation. * dbxread.c: Fix indentation. * dcache.c: Fix indentation. * disasm.c: Fix indentation. * dtrace-probe.c: Fix indentation. * dwarf2/abbrev.c: Fix indentation. * dwarf2/attribute.c: Fix indentation. * dwarf2/expr.c: Fix indentation. * dwarf2/frame.c: Fix indentation. * dwarf2/index-cache.c: Fix indentation. * dwarf2/index-write.c: Fix indentation. * dwarf2/line-header.c: Fix indentation. * dwarf2/loc.c: Fix indentation. * dwarf2/macro.c: Fix indentation. * dwarf2/read.c: Fix indentation. * dwarf2/read.h: Fix indentation. * elfread.c: Fix indentation. * eval.c: Fix indentation. * event-top.c: Fix indentation. * exec.c: Fix indentation. * exec.h: Fix indentation. * expprint.c: Fix indentation. * f-lang.c: Fix indentation. * f-typeprint.c: Fix indentation. * f-valprint.c: Fix indentation. * fbsd-nat.c: Fix indentation. * fbsd-tdep.c: Fix indentation. * findvar.c: Fix indentation. * fork-child.c: Fix indentation. * frame-unwind.c: Fix indentation. * frame-unwind.h: Fix indentation. * frame.c: Fix indentation. * frv-linux-tdep.c: Fix indentation. * frv-tdep.c: Fix indentation. * frv-tdep.h: Fix indentation. * ft32-tdep.c: Fix indentation. * gcore.c: Fix indentation. * gdb_bfd.c: Fix indentation. * gdbarch.sh: Fix indentation. * gdbarch.c: Re-generate * gdbarch.h: Re-generate. * gdbcore.h: Fix indentation. * gdbthread.h: Fix indentation. * gdbtypes.c: Fix indentation. * gdbtypes.h: Fix indentation. * glibc-tdep.c: Fix indentation. * gnu-nat.c: Fix indentation. * gnu-nat.h: Fix indentation. * gnu-v2-abi.c: Fix indentation. * gnu-v3-abi.c: Fix indentation. * go32-nat.c: Fix indentation. * guile/guile-internal.h: Fix indentation. * guile/scm-cmd.c: Fix indentation. * guile/scm-frame.c: Fix indentation. * guile/scm-iterator.c: Fix indentation. * guile/scm-math.c: Fix indentation. * guile/scm-ports.c: Fix indentation. * guile/scm-pretty-print.c: Fix indentation. * guile/scm-value.c: Fix indentation. * h8300-tdep.c: Fix indentation. * hppa-linux-nat.c: Fix indentation. * hppa-linux-tdep.c: Fix indentation. * hppa-nbsd-nat.c: Fix indentation. * hppa-nbsd-tdep.c: Fix indentation. * hppa-obsd-nat.c: Fix indentation. * hppa-tdep.c: Fix indentation. * hppa-tdep.h: Fix indentation. * i386-bsd-nat.c: Fix indentation. * i386-darwin-nat.c: Fix indentation. * i386-darwin-tdep.c: Fix indentation. * i386-dicos-tdep.c: Fix indentation. * i386-gnu-nat.c: Fix indentation. * i386-linux-nat.c: Fix indentation. * i386-linux-tdep.c: Fix indentation. * i386-nto-tdep.c: Fix indentation. * i386-obsd-tdep.c: Fix indentation. * i386-sol2-nat.c: Fix indentation. * i386-tdep.c: Fix indentation. * i386-tdep.h: Fix indentation. * i386-windows-tdep.c: Fix indentation. * i387-tdep.c: Fix indentation. * i387-tdep.h: Fix indentation. * ia64-libunwind-tdep.c: Fix indentation. * ia64-libunwind-tdep.h: Fix indentation. * ia64-linux-nat.c: Fix indentation. * ia64-linux-tdep.c: Fix indentation. * ia64-tdep.c: Fix indentation. * ia64-tdep.h: Fix indentation. * ia64-vms-tdep.c: Fix indentation. * infcall.c: Fix indentation. * infcmd.c: Fix indentation. * inferior.c: Fix indentation. * infrun.c: Fix indentation. * iq2000-tdep.c: Fix indentation. * language.c: Fix indentation. * linespec.c: Fix indentation. * linux-fork.c: Fix indentation. * linux-nat.c: Fix indentation. * linux-tdep.c: Fix indentation. * linux-thread-db.c: Fix indentation. * lm32-tdep.c: Fix indentation. * m2-lang.c: Fix indentation. * m2-typeprint.c: Fix indentation. * m2-valprint.c: Fix indentation. * m32c-tdep.c: Fix indentation. * m32r-linux-tdep.c: Fix indentation. * m32r-tdep.c: Fix indentation. * m68hc11-tdep.c: Fix indentation. * m68k-bsd-nat.c: Fix indentation. * m68k-linux-nat.c: Fix indentation. * m68k-linux-tdep.c: Fix indentation. * m68k-tdep.c: Fix indentation. * machoread.c: Fix indentation. * macrocmd.c: Fix indentation. * macroexp.c: Fix indentation. * macroscope.c: Fix indentation. * macrotab.c: Fix indentation. * macrotab.h: Fix indentation. * main.c: Fix indentation. * mdebugread.c: Fix indentation. * mep-tdep.c: Fix indentation. * mi/mi-cmd-catch.c: Fix indentation. * mi/mi-cmd-disas.c: Fix indentation. * mi/mi-cmd-env.c: Fix indentation. * mi/mi-cmd-stack.c: Fix indentation. * mi/mi-cmd-var.c: Fix indentation. * mi/mi-cmds.c: Fix indentation. * mi/mi-main.c: Fix indentation. * mi/mi-parse.c: Fix indentation. * microblaze-tdep.c: Fix indentation. * minidebug.c: Fix indentation. * minsyms.c: Fix indentation. * mips-linux-nat.c: Fix indentation. * mips-linux-tdep.c: Fix indentation. * mips-nbsd-tdep.c: Fix indentation. * mips-tdep.c: Fix indentation. * mn10300-linux-tdep.c: Fix indentation. * mn10300-tdep.c: Fix indentation. * moxie-tdep.c: Fix indentation. * msp430-tdep.c: Fix indentation. * namespace.h: Fix indentation. * nat/fork-inferior.c: Fix indentation. * nat/gdb_ptrace.h: Fix indentation. * nat/linux-namespaces.c: Fix indentation. * nat/linux-osdata.c: Fix indentation. * nat/netbsd-nat.c: Fix indentation. * nat/x86-dregs.c: Fix indentation. * nbsd-nat.c: Fix indentation. * nbsd-tdep.c: Fix indentation. * nios2-linux-tdep.c: Fix indentation. * nios2-tdep.c: Fix indentation. * nto-procfs.c: Fix indentation. * nto-tdep.c: Fix indentation. * objfiles.c: Fix indentation. * objfiles.h: Fix indentation. * opencl-lang.c: Fix indentation. * or1k-tdep.c: Fix indentation. * osabi.c: Fix indentation. * osabi.h: Fix indentation. * osdata.c: Fix indentation. * p-lang.c: Fix indentation. * p-typeprint.c: Fix indentation. * p-valprint.c: Fix indentation. * parse.c: Fix indentation. * ppc-linux-nat.c: Fix indentation. * ppc-linux-tdep.c: Fix indentation. * ppc-nbsd-nat.c: Fix indentation. * ppc-nbsd-tdep.c: Fix indentation. * ppc-obsd-nat.c: Fix indentation. * ppc-ravenscar-thread.c: Fix indentation. * ppc-sysv-tdep.c: Fix indentation. * ppc64-tdep.c: Fix indentation. * printcmd.c: Fix indentation. * proc-api.c: Fix indentation. * producer.c: Fix indentation. * producer.h: Fix indentation. * prologue-value.c: Fix indentation. * prologue-value.h: Fix indentation. * psymtab.c: Fix indentation. * python/py-arch.c: Fix indentation. * python/py-bpevent.c: Fix indentation. * python/py-event.c: Fix indentation. * python/py-event.h: Fix indentation. * python/py-finishbreakpoint.c: Fix indentation. * python/py-frame.c: Fix indentation. * python/py-framefilter.c: Fix indentation. * python/py-inferior.c: Fix indentation. * python/py-infthread.c: Fix indentation. * python/py-objfile.c: Fix indentation. * python/py-prettyprint.c: Fix indentation. * python/py-registers.c: Fix indentation. * python/py-signalevent.c: Fix indentation. * python/py-stopevent.c: Fix indentation. * python/py-stopevent.h: Fix indentation. * python/py-threadevent.c: Fix indentation. * python/py-tui.c: Fix indentation. * python/py-unwind.c: Fix indentation. * python/py-value.c: Fix indentation. * python/py-xmethods.c: Fix indentation. * python/python-internal.h: Fix indentation. * python/python.c: Fix indentation. * ravenscar-thread.c: Fix indentation. * record-btrace.c: Fix indentation. * record-full.c: Fix indentation. * record.c: Fix indentation. * reggroups.c: Fix indentation. * regset.h: Fix indentation. * remote-fileio.c: Fix indentation. * remote.c: Fix indentation. * reverse.c: Fix indentation. * riscv-linux-tdep.c: Fix indentation. * riscv-ravenscar-thread.c: Fix indentation. * riscv-tdep.c: Fix indentation. * rl78-tdep.c: Fix indentation. * rs6000-aix-tdep.c: Fix indentation. * rs6000-lynx178-tdep.c: Fix indentation. * rs6000-nat.c: Fix indentation. * rs6000-tdep.c: Fix indentation. * rust-lang.c: Fix indentation. * rx-tdep.c: Fix indentation. * s12z-tdep.c: Fix indentation. * s390-linux-tdep.c: Fix indentation. * score-tdep.c: Fix indentation. * ser-base.c: Fix indentation. * ser-mingw.c: Fix indentation. * ser-uds.c: Fix indentation. * ser-unix.c: Fix indentation. * serial.c: Fix indentation. * sh-linux-tdep.c: Fix indentation. * sh-nbsd-tdep.c: Fix indentation. * sh-tdep.c: Fix indentation. * skip.c: Fix indentation. * sol-thread.c: Fix indentation. * solib-aix.c: Fix indentation. * solib-darwin.c: Fix indentation. * solib-frv.c: Fix indentation. * solib-svr4.c: Fix indentation. * solib.c: Fix indentation. * source.c: Fix indentation. * sparc-linux-tdep.c: Fix indentation. * sparc-nbsd-tdep.c: Fix indentation. * sparc-obsd-tdep.c: Fix indentation. * sparc-ravenscar-thread.c: Fix indentation. * sparc-tdep.c: Fix indentation. * sparc64-linux-tdep.c: Fix indentation. * sparc64-nbsd-tdep.c: Fix indentation. * sparc64-obsd-tdep.c: Fix indentation. * sparc64-tdep.c: Fix indentation. * stabsread.c: Fix indentation. * stack.c: Fix indentation. * stap-probe.c: Fix indentation. * stubs/ia64vms-stub.c: Fix indentation. * stubs/m32r-stub.c: Fix indentation. * stubs/m68k-stub.c: Fix indentation. * stubs/sh-stub.c: Fix indentation. * stubs/sparc-stub.c: Fix indentation. * symfile-mem.c: Fix indentation. * symfile.c: Fix indentation. * symfile.h: Fix indentation. * symmisc.c: Fix indentation. * symtab.c: Fix indentation. * symtab.h: Fix indentation. * target-float.c: Fix indentation. * target.c: Fix indentation. * target.h: Fix indentation. * tic6x-tdep.c: Fix indentation. * tilegx-linux-tdep.c: Fix indentation. * tilegx-tdep.c: Fix indentation. * top.c: Fix indentation. * tracefile-tfile.c: Fix indentation. * tracepoint.c: Fix indentation. * tui/tui-disasm.c: Fix indentation. * tui/tui-io.c: Fix indentation. * tui/tui-regs.c: Fix indentation. * tui/tui-stack.c: Fix indentation. * tui/tui-win.c: Fix indentation. * tui/tui-winsource.c: Fix indentation. * tui/tui.c: Fix indentation. * typeprint.c: Fix indentation. * ui-out.h: Fix indentation. * unittests/copy_bitwise-selftests.c: Fix indentation. * unittests/memory-map-selftests.c: Fix indentation. * utils.c: Fix indentation. * v850-tdep.c: Fix indentation. * valarith.c: Fix indentation. * valops.c: Fix indentation. * valprint.c: Fix indentation. * valprint.h: Fix indentation. * value.c: Fix indentation. * value.h: Fix indentation. * varobj.c: Fix indentation. * vax-tdep.c: Fix indentation. * windows-nat.c: Fix indentation. * windows-tdep.c: Fix indentation. * xcoffread.c: Fix indentation. * xml-syscall.c: Fix indentation. * xml-tdesc.c: Fix indentation. * xstormy16-tdep.c: Fix indentation. * xtensa-config.c: Fix indentation. * xtensa-linux-nat.c: Fix indentation. * xtensa-linux-tdep.c: Fix indentation. * xtensa-tdep.c: Fix indentation. gdbserver/ChangeLog: * ax.cc: Fix indentation. * dll.cc: Fix indentation. * inferiors.h: Fix indentation. * linux-low.cc: Fix indentation. * linux-nios2-low.cc: Fix indentation. * linux-ppc-ipa.cc: Fix indentation. * linux-ppc-low.cc: Fix indentation. * linux-x86-low.cc: Fix indentation. * linux-xtensa-low.cc: Fix indentation. * regcache.cc: Fix indentation. * server.cc: Fix indentation. * tracepoint.cc: Fix indentation. gdbsupport/ChangeLog: * common-exceptions.h: Fix indentation. * event-loop.cc: Fix indentation. * fileio.cc: Fix indentation. * filestuff.cc: Fix indentation. * gdb-dlfcn.cc: Fix indentation. * gdb_string_view.h: Fix indentation. * job-control.cc: Fix indentation. * signals.cc: Fix indentation. Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-09-16gdb: Remove language_data structAndrew Burgess1-7/+1
The language_data type, from which language_defn inherits, is now empty, and this commit removes it. Each language is updated to no longer create and use a language_data struct. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Delete. (ada_language): Remove references to ada_language_data. * c-lang.c (c_language_data): Delete. (c_language): Remove references to c_language_data. (cplus_language_data): Delete. (cplus_language): Remove references to cplus_language_data. (asm_language_data): Delete. (asm_language): Remove references to asm_language_data. (minimal_language_data): Delete. (minimal_language): Remove references to minimal_language_data. * d-lang.c (d_language_data): Delete. (d_language): Remove references to d_language_data. * f-lang.c (f_language_data): Delete. (f_language): Remove references to f_language_data. * go-lang.c (go_language_data): Delete. (go_language): Remove references to go_language_data. * language.c (unknown_language_data): Delete. (unknown_language): Remove references to unknown_language_data. (auto_language_data): Delete. (auto_language): Remove references to auto_language_data. * language.h (language_data): Delete struct. (language_defn): No longer inherit from language_data. * m2-lang.c (m2_language_data): Delete. (m2_language): Remove references to m2_language_data. * objc-lang.c (objc_language_data): Delete. (objc_language): Remove references to objc_language_data. * opencl-lang.c (opencl_language_data): Delete. (opencl_language): Remove references to opencl_language_data. * p-lang.c (pascal_language_data): Delete. (pascal_language): Remove references to pascal_language_data. * rust-lang.c (rust_language_data): Delete. (rust_language): Remove references to rust_language_data.
2020-09-16gdb: Convert language_data::la_op_print_tab to a methodAndrew Burgess1-1/+5
Convert language_data::la_op_print_tab member variable to a virtual method language_defn::opcode_print_table. I changed the name in order to make it clearer (I hope) what the method does. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_op_print_tab initializer. (ada_language::opcode_print_table): New member function. * c-lang.c (c_language_data): Remove la_op_print_tab initializer. (c_language::opcode_print_table): New member function. (cplus_language_data): Remove la_op_print_tab initializer. (cplus_language::opcode_print_table): New member function. (asm_language_data): Remove la_op_print_tab initializer. (asm_language::opcode_print_table): New member function. (minimal_language_data): Remove la_op_print_tab initializer. (minimal_language::opcode_print_table): New member function. * d-lang.c (d_language_data): Remove la_op_print_tab initializer. (d_language::opcode_print_table): New member function. * expprint.c (print_subexp_standard): Update call to opcode_print_table. (op_string): Likewise. * f-lang.c (f_language_data): Remove la_op_print_tab initializer. (f_language::opcode_print_table): New member function. * go-lang.c (go_language_data): Remove la_op_print_tab initializer. (go_language::opcode_print_table): New member function. * language.c (unknown_language_data): Remove la_op_print_tab initializer. (unknown_language::opcode_print_table): New member function. (auto_language_data): Remove la_op_print_tab initializer. (auto_language::opcode_print_table): New member function. * language.h (language_data): Remove la_op_print_tab field. (language_defn::opcode_print_table): Declare new member function. * m2-lang.c (m2_language_data): Remove la_op_print_tab initializer. (m2_language::opcode_print_table): New member function. * objc-lang.c (objc_language_data): Remove la_op_print_tab initializer. (objc_language::opcode_print_table): New member function. * opencl-lang.c (opencl_language_data): Remove la_op_print_tab initializer. (opencl_language::opcode_print_table): New member function. * p-lang.c (pascal_language_data): Remove la_op_print_tab initializer. (pascal_language::opcode_print_table): New member function. * rust-lang.c (rust_language_data): Remove la_op_print_tab initializer. (rust_language::opcode_print_table): New member function.
2020-09-16gdb: Convert language_data::la_exp_desc to a methodAndrew Burgess1-1/+0
Convert language_data::la_exp_desc member variable to a virtual method language_defn::expression_ops. The change of names brings this method more into line with the existing varobj_ops method, that also returns a table of function pointers. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_exp_desc initializer. (ada_language::expression_ops): New member function. * c-lang.c (c_language_data): Remove la_exp_desc initializer. (c_language::expression_ops): New member function. (cplus_language_data): Remove la_exp_desc initializer. (cplus_language::expression_ops): New member function. (asm_language_data): Remove la_exp_desc initializer. (asm_language::expression_ops): New member function. (minimal_language_data): Remove la_exp_desc initializer. (minimal_language::expression_ops): New member function. * d-lang.c (d_language_data): Remove la_exp_desc initializer. (d_language::expression_ops): New member function. * eval.c (evaluate_subexp): Update call to expression_ops. * expprint.c (print_subexp): Likewise. (op_name): Likewise. (dump_subexp_body): Likewise. * f-lang.c (f_language_data): Remove la_exp_desc initializer. (f_language::expression_ops): New member function. * go-lang.c (go_language_data): Remove la_exp_desc initializer. (go_language::expression_ops): New member function. * language.c (language_defn::expression_ops): New function. (unknown_language_data): Remove la_exp_desc initializer. (auto_language_data): Likewise. * language.h (language_data): Remove la_exp_desc field. (language_defn::expression_ops): Declare new member function. * m2-lang.c (m2_language_data): Remove la_exp_desc initializer. (m2_language::expression_ops): New member function. * objc-lang.c (objc_language_data): Remove la_exp_desc initializer. * opencl-lang.c (opencl_language_data): Remove la_exp_desc initializer. (opencl_language::expression_ops): New member function. * p-lang.c (pascal_language_data): Remove la_exp_desc initializer. * parse.c (operator_length): Update call to expression_ops. (exp_iterate): Likewise. * rust-lang.c (rust_language_data): Remove la_exp_desc initializer. (ruse_language::expression_ops): New member function.
2020-09-16gdb: Convert language_data::la_varobj_ops to a methodAndrew Burgess1-1/+0
Convert language_data::la_varobj_ops member variable to a virtual method language_defn::varobj_ops. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_varobj_ops initializer. (ada_language::varobj_ops): New member function. * c-lang.c (c_language_data): Remove la_varobj_ops initializer. (cplus_language_data): Likewise. (cplus_language::varobj_ops): New member function. (asm_language_data): Remove la_varobj_ops initializer. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (language_defn::varobj_ops): New function. (unknown_language_data): Remove la_varobj_ops initializer. (auto_language_data): Likewise. * language.h (language_data): Remove la_varobj_ops field. (language_defn::varobj_ops): Declare new member function. * m2-lang.c (m2_language_data): Remove la_varobj_ops initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise. * varobj.c (varobj_create): Update call to varobj_ops. * varobj.h (default_varobj_ops): Delete define.
2020-09-16gdb: Convert language_data::la_macro_expansion to a methodAndrew Burgess1-1/+0
Convert language_data::la_macro_expansion member variable to a virtual method language_defn::macro_expansion. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_macro_expansion initializer. * c-lang.c (c_language_data): Likewise. (c_language::macro_expansion): New member function. (cplus_language_data): Likewise. (cplus_language::macro_expansion): New member function. (asm_language_data): Likewise. (asm_language::macro_expansion): New member function. (minimal_language_data): Likewise. (minimal_language::macro_expansion): New member function. * d-lang.c (d_language_data): Remove la_macro_expansion initializer. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Remove la_macro_expansion field. (language_defn::macro_expansion): New member function. * m2-lang.c (m2_language_data): Remove la_macro_expansion initializer. * objc-lang.c (objc_language_data): Likewise. (objc_language::macro_expansion): New member function. * opencl-lang.c (opencl_language_data): Likewise. (opencl_language::macro_expansion): New member function. * p-lang.c (pascal_language_data): Remove la_macro_expansion initializer. * rust-lang.c (rust_language_data): Likewise. * symtab.c (default_collect_symbol_completion_matches_break_on): Update call to macro_expansion.
2020-09-16gdb: Convert language_data::la_array_ordering to a methodAndrew Burgess1-1/+0
Convert language_data::la_array_ordering member variable to a virtual method language_defn::array_ordering. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_array_ordering initializer. * c-lang.c (c_language_data): Likewise. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * dwarf2/read.c (read_array_order): Update for call to array_ordering. * f-lang.c (f_language_data): Remove la_array_ordering initializer. (f_language::array_ordering): New member function. * go-lang.c (go_language_data): Remove la_array_ordering initializer. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Delete la_array_ordering field. (language_defn::array_ordering): New member function. * m2-lang.c (m2_language_data): Remove la_array_ordering initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise.
2020-09-16gdb: Convert language_data::la_case_sensitivity to a methodAndrew Burgess1-1/+0
Convert language_data::la_case_sensitivity member variable to a virtual method language_defn::case_sensitivity. This is mostly straight forward. The only slight problem is that I ended up deleting this comment from ada-lang.c: /* Yes, Ada is case-insensitive, but that's not quite what this means. */ However, as the comment (which has existed since Ada support was first added to GDB) doesn't explain _why_ Ada sets case sensitivity to on despite being a generally case insensitive language, this doesn't really help me much. If I understood _why_ the setting doesn't quite mean what it seems to mean (at least as far as Ada is concerned) then I would extend the comment on language_defn::case_sensitivity (in language.h) to include the detail, and note how this impacts Ada. But as it stands I've just deleted the comment for now. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_case_sensitivity initializer. * c-lang.c (c_language_data): Likewise. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_language_data): Likewise. (f_language::case_sensitivity): New member function. * go-lang.c (go_language_data): Remove la_case_sensitivity initializer. * language.c (enum case_mode): Moved here from language.h. (case_mode): Make static. (show_case_command): Update for case_sensitivity being a method. (set_case_command): Likewise. (set_range_case): Likewise. (unknown_language_data): Remove la_case_sensitivity initializer. (auto_language_data): Likewise. * language.h (case_mode): Delete, move enum declaration to language.c. (language_data): Delete la_case_sensitivity field. (language_defn::case_sensitivity): New member function. * m2-lang.c (m2_language_data): Remove la_case_sensitivity initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise.
2020-09-16gdb: Convert language_data::la_range_check to a methodAndrew Burgess1-1/+5
Convert language_data::la_range_check member variable to a virtual method language_defn::range_checking_on_by_default. Where the previous member variable was of type 'enum range_check', the new member function returns a boolean that selects between range checking being on or off. This removes the possibility of a language having its default be the third enum state, range_check_warn, which no language currently used. This all makes sense I think, the language's true/false provides the default when the global 'set check range' is set to 'auto'. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_range_check initializer. * c-lang.c (c_language_data): Likewise. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_language_data): Likewise. (f_language::range_checking_on_by_default): New member function. * go-lang.c (go_language_data): Remove la_range_check initializer. * language.c (enum range_mode): Moved here from language.h. (range_mode): Made static. (show_range_command): Update to use range_checking_on_by_default. (set_range_command): Likewise. (set_range_case): Likewise. (unknown_language_data): Remove la_range_check initializer. (auto_language_data): Likewise. * language.h (range_mode): Delete. Enum definition moved to language.c. (language_data): Remove la_range_check field. (language_defn::range_checking_on_by_default): New member function. * m2-lang.c (m2_language_data): Remove la_range_check initializer. (m2_language::range_checking_on_by_default): New member function. * objc-lang.c (objc_language_data): Remove la_range_check initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. (pascal_language::range_checking_on_by_default): New member function. * rust-lang.c (rust_language_data): Remove la_range_check initializer. (rust_language::range_checking_on_by_default): New member function.
2020-09-16gdb: Convert la_store_sym_names_in_linkage_form_p to a methodAndrew Burgess1-1/+0
Convert language_data::la_store_sym_names_in_linkage_form_p member variable to language_defn::store_sym_names_in_linkage_form_p virtual function. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_store_sym_names_in_linkage_form_p initializer. (ada_language::store_sym_names_in_linkage_form_p): New member function. * c-lang.c (c_language_data): Remove la_store_sym_names_in_linkage_form_p initializer. (c_language::store_sym_names_in_linkage_form_p): New member function. (cplus_language_data): Remove la_store_sym_names_in_linkage_form_p initializer. (asm_language_data): Likewise. (asm_language::store_sym_names_in_linkage_form_p): New member function. (minimal_language_data): Remove la_store_sym_names_in_linkage_form_p initializer. (minimal_language::store_sym_names_in_linkage_form_p): New member function. * d-lang.c (d_language_data): Remove la_store_sym_names_in_linkage_form_p initializer. * dwarf2/read.c (dwarf2_physname): Update call to store_sym_names_in_linkage_form_p. * f-lang.c (f_language_data): Remove la_store_sym_names_in_linkage_form_p initializer. * go-lang.c (go_language_data): Remove la_store_sym_names_in_linkage_form_p initializer. * language.c (unknown_language_data): Remove la_store_sym_names_in_linkage_form_p initializer. (unknown_language::store_sym_names_in_linkage_form_p): New member function. (auto_language_data): Remove la_store_sym_names_in_linkage_form_p initializer. (auto_language::store_sym_names_in_linkage_form_p): New member function. * language.h (language_data): Remove la_store_sym_names_in_linkage_form_p member variable. (language_defn::store_sym_names_in_linkage_form_p): New member function. * m2-lang.c (m2_language_data): Remove la_store_sym_names_in_linkage_form_p initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise.
2020-09-16gdb: Convert language_data::string_lower_bound to a methodAndrew Burgess1-1/+0
Convert language_data::string_lower_bound member variable to a virtual method language_defn::string_lower_bound. Over all of the languages we currently support there are currently only two values for the lower bound, 0 or 1. I noticed that in all cases, if a language has C style arrays then the lower bound is 0, otherwise the lower bound is 1. So the default for the virtual method in language.h makes use of this, which means languages don't have to worry about providing a string_lower_bound method at all. Except for Modula2. This language is defined to not have C style arrays, but has a string_lower_bound index of 0, this behaviour is maintained after this commit by having Modula2 be the only language that overrides the string_lower_bound method. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove string_lower_bound initializer. * c-lang.c (c_language_data): Likewise. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Remove string_lower_bound field. (language_defn::string_lower_bound): New member function. * m2-lang.c (m2_language_data): Remove string_lower_bound initializer. (m2_language::string_lower_bound): New member function. * objc-lang.c (objc_language_data): Remove string_lower_bound initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise. * valops.c (value_cstring): Update call to string_lower_bound. (value_string): Likewise. * value.c (allocate_repeated_value): Likewise.
2020-09-16gdb: Convert language_data::c_style_arrays to a methodAndrew Burgess1-1/+0
Convert language_data::c_style_arrays member variable to a virtual method language_defn::c_style_arrays_p. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove c_style_arrays initializer. (ada_language::c_style_arrays_p): New member fuction. * c-lang.c (c_language_data): Remove c_style_arrays initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * eval.c (ptrmath_type_p): Update call to c_style_arrays_p. * f-lang.c (f_language_data): Remove c_style_arrays initializer. (f_language::c_style_arrays_p): New member function. * go-lang.c (go_language_data): Remove c_style_arrays initializer. * infcall.c (value_arg_coerce): Update call to c_style_arrays_p. * language.c (unknown_language_data): Remove c_style_arrays initializer. (auto_language_data): Likewise. * language.h (language_data): Remove c_style_arrays field. (language_defn::c_style_arrays_p): New member function. * m2-lang.c (m2_language_data): Remove c_style_arrays initializer. (m2_language::c_style_arrays_p): New member function. * objc-lang.c (objc_language_data): Remove c_style_arrays initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise. * valarith.c (value_subscript): Update call to c_style_arrays_p, and update local variable to a bool. * valops.c (value_cast): Update call to c_style_arrays_p. (value_array): Likewise. * value.c (coerce_array): Likewise.
2020-09-16gdb: Move la_language into the language_defn classAndrew Burgess1-1/+0
Move the language_data::la_language member variable into the langage_defn class. I have not made the la_language member variable a method of langage_defn simply because of the large number of places that la_language is referenced throughout GDB. I have made the new member variable constant though, so this should prevent accidental assignment. In the future we might consider converting la_language to a method, but right now my goal is to remove the langage_data class, so I'm happy to leave la_language as a constant member variable. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_language initializer. * c-lang.c (c_language_data): Likewise. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Remove la_language field. (language_defn::language_defn): Initialise la_language field. (language_defn::la_language): New member variable. * m2-lang.c (m2_language_data): Remove la_language field. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise.
2020-09-16gdb: Convert la_filename_extensions to a methodAndrew Burgess1-6/+8
Convert language_data::la_filename_extensions member variable to a virtual method language_defn::filename_extensions. The new method returns a vector of filename extensions, which means that where previously we needed a NULL marker on the end of the list, we can now discard this. All of the old arrays that contained the extensions now become static data within each languages filename_extensions method. I've updated the single use of the filename_extensions method to make use of this method returning a vector. And, just in case anyone accidentally adds a NULL marked into a languages extensions list, I've added a new assert in add_filename_language (symtab.c) to catch this. gdb/ChangeLog: * ada-lang.c (ada_extensions): Delete, moved into ada_language::filename_extensions. (ada_language_data): Remove la_filename_extensions initializer. (ada_language::filename_extensions): New member function. * c-lang.c (c_extensions): Delete, moved into c_language::filename_extensions. (c_language_data): Remove la_filename_extensions initializer. (c_language::filename_extensions): New member function. (cplus_extensions): Delete, moved into cplus_language::filename_extensions. (cplus_language_data): Remove la_filename_extensions initializer. (cplus_language::filename_extensions): New member function. (asm_extensions): Delete, moved into asm_language::filename_extensions. (asm_language_data): Remove la_filename_extensions initializer. (asm_language::filename_extensions): New member function. (minimal_language_data): Remove la_filename_extensions initializer. * d-lang.c (d_extensions): Delete, moved into d_language::filename_extensions. (d_language_data): Remove la_filename_extensions initializer. (d_language::filename_extensions): New member function. * f-lang.c (f_extensions): Delete, moved into f_language::filename_extensions. (f_language_data): Remove la_filename_extensions initializer. (f_language::filename_extensions): New member function. * go-lang.c (go_language_data): Remove la_filename_extensions initializer. * language.c (add_set_language_command): Update now that filename_extensions returns a vector. (unknown_language_data): Remove la_filename_extensions initializer. (auto_language_data): Likewise. * language.h (language_data): Remove la_filename_extensions field. (language_defn::filename_extensions): New member function. * m2-lang.c (m2_language_data): Remove la_filename_extensions initializer. * objc-lang.c (objc_extensions): Delete, moved into objc_language::filename_extensions. (objc_language_data): Remove la_filename_extensions initializer. (objc_language::filename_extensions): New member function. * opencl-lang.c (opencl_language_data): Remove la_filename_extensions initializer. * p-lang.c (pascal_extensions): Delete, moved into pascal_language::filename_extensions. (pascal_language_data): Remove la_filename_extensions initializer. (pascal_language::filename_extensions): New member function. * rust-lang.c (rust_extensions): Delete, moved into rust_language::filename_extensions. (rust_language_data): Remove la_filename_extensions initializer. (rust_language::filename_extensions): New member function. * symfile.c (add_filename_language): Add new assert.
2020-09-16gdb: Convert la_name and la_natural_name to methodsAndrew Burgess1-2/+11
Convert the two language_data member variables la_name and la_natural_name to virtual methods in language_defn struct called name and natural_name respectively. The virtual methods in the language_defn base class are pure virtual, as every language must implement these, and as every language has a unique name there's no sensible default here. Given that every language must implement these methods I did wonder about making this data passed into the base class constructor, but in the end I went with the virtual method approach. I'm open to changing this approach if people prefer the constructor approach. During updating the calls to language_defn::name I found in add_set_language_command a place where we took la_name and then capitalised the first letter to create a language name that could be used in the documentation string. I replaced this with a use of natural_name instead as this seemed a better choice, in most cases this will make no difference, as for most languages the natural_name is just the name with the first character in upper case, but for some languages, for example 'Open-CL' and 'Objective-C' this is not the case. In the case of asm_language the name is 'asm', while the natural_name was previously 'assembly'. I changed the natural name to 'Assembly', this makes the documentation string case above cleaner, however, this will change the MI output for -var-info-expression, where the 'lang' field will change from 'assembly' to 'Assembly'. It is possible this could be a breaking change if a front-end is relying on the existing name. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_name and la_natural_name initializers. (ada_language::name): New member function. (ada_language::natural_name): New member function. * c-lang.c (c_language_data): Remove la_name and la_natural_name initializers. (c_language::name): New member function. (c_language::natural_name): New member function. (cplus_language_data): Remove la_name and la_natural_name initializers. (cplus_language::name): New member function. (cplus_language::natural_name): New member function. (asm_language_data): Remove la_name and la_natural_name initializers. (asm_language::name): New member function. (asm_language::natural_name): New member function. (minimal_language_data): Remove la_name and la_natural_name initializers. (minimal_language::name): New member function. (minimal_language::natural_name): New member function. * compile/compile.c (compile_to_object): Update call to lanugage_defn::name. * d-lang.c (d_language_data): Remove la_name and la_natural_name initializers. (d_language::name): New member function. (d_language::natural_name): New member function. * expprint.c (print_subexp_standard): Update call to language_defn::name. (dump_raw_expression): Likewise (dump_prefix_expression): Likewise. * f-lang.c (f_language_data): Remove la_name and la_natural_name initializers. (f_language::name): New member function. (f_language::natural_name): New member function. * go-lang.c (go_language_data): Remove la_name and la_natural_name initializers. (go_language::name): New member function. (go_language::natural_name): New member function. * language.c (show_language_command): Update call to language_defn::name. (set_language_command): Likewise. (language_enum): Likewise. (language_str): Likewise. (add_set_language_command): Likewise, use language_defn::natural_name in the doc string. (unknown_language_data): Remove la_name and la_natural_name initializers. (unknown_language::name): New member function. (unknown_language::natural_name): New member function. (auto_language_data): Remove la_name and la_natural_name initializers. (auto_language::name): New member function. (auto_language::natural_name): New member function. (language_lookup_primitive_type_as_symbol): Update call to language_defn::name. * language.h (language_data): Remove la_name and la_natural_name member variables. (language_defn::name): New member function. (language_defn::natural_name): New member function. * m2-lang.c (m2_language_data): Remove la_name and la_natural_name initializers. (m2_language::name): New member function. (m2_language::natural_name): New member function. * mi/mi-cmd-var.c (mi_cmd_var_info_expression): Update call to language_defn::natural_name. * objc-lang.c (objc_language_data): Remove la_name and la_natural_name initializers. (objc_language::name): New member function. (objc_language::natural_name): New member function. * opencl-lang.c (opencl_language_data): Remove la_name and la_natural_name initializers. (opencl_language::name): New member function. (opencl_language::natural_name): New member function. * p-lang.c (pascal_language_data): Remove la_name and la_natural_name initializers. (pascal_language::name): New member function. (pascal_language::natural_name): New member function. * rust-lang.c (rust_language_data): Remove la_name and la_natural_name initializers. (rust_language::name): New member function. (rust_language::natural_name): New member function. * symtab.c (lookup_language_this): Update call to language_defn::name.
2020-09-16gdb: Convert la_name_of_this to a methodAndrew Burgess1-1/+5
Convert language_data::la_name_of_this member variable to a virtual method language_defn::name_of_this. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_name_of_this initializer. * ax-gdb.c (gen_expr): Update call to name_of_this. * c-exp.y (classify_name): Likewise. * c-lang.c (c_language_data): Remove la_name_of_this initializer. (cplus_language_data): Likewise. (cplus_language::name_of_this): New member function. (asm_language_data): Remove la_name_of_this initializer. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. (d_language::name_of_this): New member function. * expprint.c (print_subexp_standard): Update call to name_of_this. * f-lang.c (f_language_data): Remove la_name_of_this initializer. * go-lang.c (go_language_data): Likewise. * language.c (unknown_language_data): Likewise. (unknown_language::name_of_this): New member function. (auto_language_data): Remove la_name_of_this initializer. (auto_language::name_of_this): New member function. * language.h (language_data): Delete la_name_of_this member variable. (language_defn::name_of_this): New member function. * m2-lang.c (m2_language_data): Remove la_name_of_this initializer. * objc-lang.c (objc_language_data): Likewise. (objc_language::name_of_this): New member function. * opencl-lang.c (opencl_language_data): Remove la_name_of_this initializer. * p-lang.c (pascal_language_data): Likewise. (pascal_language::name_of_this): New member function. * rust-lang.c (rust_language_data): Remove la_name_of_this initializer. * symtab.c (lookup_language_this): Update call to name_of_this. (lookup_symbol_aux): Likewise. * valops.c (value_of_this): Likewise.
2020-09-16gdb: Convert la_struct_too_deep_ellipsis to a methodAndrew Burgess1-1/+0
Convert language_data::la_struct_too_deep_ellipsis member variable to a method in language_defn. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_struct_too_deep_ellipsis initializer. (ada_language::struct_too_deep_ellipsis): New member function. * c-lang.c (c_language_data): Remove la_struct_too_deep_ellipsis initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * cp-valprint.c (cp_print_value): Update call to struct_too_deep_ellipsis. * d-lang.c (d_language_data): Remove la_struct_too_deep_ellipsis initializer. * f-lang.c (f_language_data): Likewise. (f_language::struct_too_deep_ellipsis): New member function. * go-lang.c (go_language_data): Remove la_struct_too_deep_ellipsis initializer. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Delete la_struct_too_deep_ellipsis member variable. (language_defn::struct_too_deep_ellipsis): New member function. * m2-lang.c (m2_language_data): Remove la_struct_too_deep_ellipsis initializer.Q * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise. * valprint.c (val_print_check_max_depth): Update call to struct_too_deep_ellipsis.
2020-09-14Apply 'const' in more placesTom Tromey1-1/+1
Many global arrays in gdb could be marked "const" but are not. This patch changes some of them. (There may be other arrays that could benefit from this treatment. I only examined arrays of strings.) This lets the linker move some symbols to the readonly data section. For example, previously: 0000000000000000 d _ZL18can_use_agent_enum is now: 0000000000000030 r _ZL18can_use_agent_enum 2020-09-14 Tom Tromey <tromey@adacore.com> * x86-tdep.h (x86_in_indirect_branch_thunk): Update. * x86-tdep.c (x86_is_thunk_register_name) (x86_in_indirect_branch_thunk): Update. * sparc64-tdep.c (sparc64_fpu_register_names) (sparc64_cp0_register_names, sparc64_register_names) (sparc64_pseudo_register_names): Now const. * sparc-tdep.h (struct gdbarch_tdep) <fpu_register_names, cp0_registers_num>: Now const. * sparc-tdep.c (sparc_core_register_names) (sparc32_fpu_register_names, sparc32_cp0_register_names) (sparc32_pseudo_register_names): Now const. (validate_tdesc_registers): Update. * rust-lang.c (rust_extensions): Now const. * p-lang.c (p_extensions): Now const. * objc-lang.c (objc_extensions): Now const. * nto-tdep.c (nto_thread_state_str): Now const. * moxie-tdep.c (moxie_register_names): Now const. * mips-tdep.h (struct gdbarch_tdep) <mips_processor_reg_names>: Now const. * mips-tdep.c (mips_generic_reg_names, mips_tx39_reg_names) (mips_linux_reg_names): Now const. (mips_gdbarch_init): Update. * microblaze-tdep.c (microblaze_register_names): Now const. * m68k-tdep.c (m68k_register_names): Now const. * m32r-tdep.c (m32r_register_names): Now const. * ia64-tdep.c (ia64_register_names): Now const. * i386-tdep.h (struct gdbarch_tdep) <register_names, ymmh_register_names, ymm16h_regnum, mpx_register_names, k_register_names, zmmh_register_names, xmm_avx512_register_names, ymm_avx512_register_names, pkeys_register_names>: Now const. * i386-tdep.c (i386_register_names, i386_zmm_names) (i386_zmmh_names, i386_k_names, i386_ymm_names, i386_ymmh_names) (i386_mpx_names, i386_pkeys_names, i386_bnd_names) (i386_mmx_names, i386_byte_names, i386_word_names): Now const. * f-lang.c (f_extensions): Now const. * d-lang.c (d_extensions): Now const. * csky-tdep.c (csky_register_names): Now const. * charset.c (default_charset_names, charset_enum): Now const. (_initialize_charset): Update. * c-lang.c (c_extensions, cplus_extensions, asm_extensions): Now const. * bsd-uthread.c (bsd_uthread_solib_names): Now const. (bsd_uthread_solib_loaded): Update. (bsd_uthread_state): Now const. * amd64-tdep.c (amd64_register_names, amd64_ymm_names) (amd64_ymm_avx512_names, amd64_ymmh_names) (amd64_ymmh_avx512_names, amd64_mpx_names, amd64_k_names) (amd64_zmmh_names, amd64_zmm_names, amd64_xmm_avx512_names) (amd64_pkeys_names, amd64_byte_names, amd64_word_names) (amd64_dword_names): Now const. * agent.c (can_use_agent_enum): Now const. * ada-tasks.c (task_states, long_task_states): Now const. * ada-lang.c (known_runtime_file_name_patterns) (known_auxiliary_function_name_patterns, attribute_names) (standard_exc, ada_extensions): Now const. gdbserver/ChangeLog 2020-09-14 Tom Tromey <tromey@adacore.com> * tracepoint.cc (eval_result_names): Now const. * ax.cc (gdb_agent_op_names): Now const.
2020-06-23gdb: Convert language la_is_string_type_p field to a methodAndrew Burgess1-11/+7
This commit changes the language_data::la_is_string_type_p 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_data): Delete la_is_string_type_p initializer. (ada_language::is_string_type_p): New member function. * c-lang.c (c_language_data): Delete la_is_string_type_p initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_is_string_type_p): Delete function, implementation moved to f_language::is_string_type_p. (f_language_data): Delete la_is_string_type_p initializer. (f_language::is_string_type_p): New member function, implementation from f_is_string_type_p. * go-lang.c (go_is_string_type_p): Delete function, implementation moved to go_language::is_string_type_p. (go_language_data): Delete la_is_string_type_p initializer. (go_language::is_string_type_p): New member function, implementation from go_is_string_type_p. * language.c (language_defn::is_string_type_p): Define new member function. (default_is_string_type_p): Make static, add comment copied from header file. (unknown_language_data): Delete la_is_string_type_p initializer. (unknown_language::is_string_type_p): New member function. (auto_language_data): Delete la_is_string_type_p initializer. (auto_language::is_string_type_p): New member function. * language.h (language_data): Delete la_is_string_type_p field. (language_defn::is_string_type_p): Declare new function. (default_is_string_type_p): Delete desclaration, move comment to definition. * m2-lang.c (m2_is_string_type_p): Delete function, implementation moved to m2_language::is_string_type_p. (m2_language_data): Delete la_is_string_type_p initializer. (m2_language::is_string_type_p): New member function, implementation from m2_is_string_type_p. * objc-lang.c (objc_language_data): Delete la_is_string_type_p initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_is_string_type_p): Delete function, implementation moved to pascal_language::is_string_type_p. (pascal_language_data): Delete la_is_string_type_p initializer. (pascal_language::is_string_type_p): New member function, implementation from pascal_is_string_type_p. * rust-lang.c (rust_is_string_type_p): Delete function, implementation moved to rust_language::is_string_type_p. (rust_language_data): Delete la_is_string_type_p initializer. (rust_language::is_string_type_p): New member function, implementation from rust_is_string_type_p. * valprint.c (val_print_scalar_or_string_type_p): Update call to is_string_type_p.
2020-06-23gdb: Convert language la_print_typedef field to a methodAndrew Burgess1-1/+9
This commit changes the language_data::la_print_typedef 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_data): Delete la_print_typedef initializer. (ada_language::print_typedef): New member function. * c-lang.c (c_language_data): Delete la_print_typedef initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_language_data): Likewise. (f_language::print_typedef): New member function. * go-lang.c (go_language_data): Delete la_print_typedef initializer. * language.c (language_defn::print_typedef): Define member function. (unknown_language_data): Delete la_print_typedef initializer. (unknown_language::print_typedef): New member function. (auto_language_data): Delete la_print_typedef initializer. (auto_language::print_typedef): New member function. * language.h (language_data): Delete la_print_typedef field. (language_defn::print_typedef): Declare new member function. (LA_PRINT_TYPEDEF): Update call to print_typedef. (default_print_typedef): Delete declaration. * m2-lang.c (m2_language_data): Delete la_print_typedef initializer. (m2_language::print_typedef): New member function. * objc-lang.c (objc_language_data): Delete la_print_typedef initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. (pascal_language::print_typedef): New member function. * rust-lang.c (rust_print_typedef): Delete function, implementation moved to rust_language::print_typedef. (rust_language): Delete la_print_typedef initializer. (rust_language::print_typedef): New member function, implementation from rust_print_typedef. * typeprint.c (default_print_typedef): Delete.
2020-06-23gdb: Convert language la_printstr field to a methodAndrew Burgess1-101/+96
This commit changes the language_data::la_printstr 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_data): Delete la_printstr initializer. (ada_language::printstr): New member function. * c-lang.c (c_language_data): Delete la_printstr initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_printstr): Rename to f_language::printstr. (f_language_data): Delete la_printstr initializer. (f_language::printstr): New member function, implementation from f_printstr. * go-lang.c (go_language_data): Delete la_printstr initializer. * language.c (language_defn::printstr): Define new member function. (unk_lang_printstr): Delete. (unknown_language_data): Delete la_printstr initializer. (unknown_language::printstr): New member function. (auto_language_data): Delete la_printstr initializer. (auto_language::printstr): New member function. * language.h (language_data): Delete la_printstr field. (language_defn::printstr): Declare new member function. (LA_PRINT_STRING): Update call to printstr. * m2-lang.c (m2_printstr): Rename to m2_language::printstr. (m2_language_data): Delete la_printstr initializer. (m2_language::printstr): New member function, implementation from m2_printstr. * objc-lang.c (objc_language_data): Delete la_printstr initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_printstr): Rename to pascal_language::printstr. (pascal_language_data): Delete la_printstr initializer. (pascal_language::printstr): New member function, implementation from pascal_printstr. * p-lang.h (pascal_printstr): Delete declaration. * rust-lang.c (rust_printstr): Update header comment. (rust_language_data): Delete la_printstr initializer. (rust_language::printstr): New member function.
2020-06-23gdb: Convert language la_printchar field to a methodAndrew Burgess1-1/+9
This commit changes the language_data::la_printchar 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_data): Delete la_printchar initializer. (ada_language::printchar): New member function. * c-lang.c (c_language_data): Delete la_printchar initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_printchar): Rename to f_language::printchar. (f_language_data): Delete la_printchar initializer. (f_language::printchar): New member function, implementation from f_printchar. * go-lang.c (go_language_data): Delete la_printchar initializer. * language.c (unk_lang_printchar): Delete. (language_defn::printchar): Define new member function. (unknown_language_data): Delete la_printchar initializer. (unknown_language::printchar): New member function. (auto_language_data): Delete la_printchar initializer. (auto_language::printchar): New member function. * language.h (language_data): Delete la_printchar field. (language_defn::printchar): Declare new member function. (LA_PRINT_CHAR): Update call to printchar. * m2-lang.c (m2_language_data): Delete la_printchar initializer. (m2_language::printchar): New member function. * objc-lang.c (objc_language_data): Delete la_printchar initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Delete la_printchar initializer. (pascal_language::printchar): New member function. * rust-lang.c (rust_printchar): Rename to rust_language::printchar. (rust_language_data): Delete la_printchar initializer. (rust_language::printchar): New member function, implementation from rust_printchar.
2020-06-23gdb: Convert language la_emitchar field to a methodAndrew Burgess1-18/+12
This commit changes the language_data::la_emitchar 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 (emit_char): Renamed to ada_language::emitchar. (ada_language_data): Delete la_emitchar initializer. (ada_language::emitchar): New member function, implementation from emit_char. * c-lang.c (c_language_data): Delete la_emitchar initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_emit_char): Rename to f_language::emitchar. (f_language_data): Delete la_emitchar initializer. (f_language::emitchar): New member function, implementation from f_emit_char. * go-lang.c (go_language_data): Delete la_emitchar initializer. * language.c (unk_lang_emit_char): Delete. (language_defn::emitchar): New member function definition. (unknown_language_data): Delete la_emitchar initializer. (unknown_language::emitchar): New member function. (auto_language_data): Delete la_emitchar initializer. (auto_language::emitchar): New member function. * language.h (language_data): Delete la_emitchar field. (language_defn::emitchar): New member field declaration. (LA_EMIT_CHAR): Update call to emitchar. * m2-lang.c (m2_emit_char): Rename to m2_language::emitchar. (m2_language_data): Delete la_emitchar initializer. (m2_language::emitchar): New member function, implementation from m2_emit_char. * objc-lang.c (objc_language_data): Delete la_emitchar initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_emit_char): Rename to pascal_language::emitchar. (pascal_language_data): Delete la_emitchar initializer. (pascal_language::emitchar): New member function, implementation from pascal_emit_char. * rust-lang.c (rust_emitchar): Rename to rust_language::emitchar. (rust_language_data): Delete la_emitchar initializer. (rust_language::emitchar): New member function, implementation from rust_emitchar.
2020-06-23gdb: Convert language la_post_parser field to a methodAndrew Burgess1-1/+0
This commit changes the language_data::la_post_parser 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 (resolve): Rename to ada_language::post_parser. (ada_language_data): Delete la_post_parser initializer. (ada_language::post_parser): New member function. * c-lang.c (c_language_data): Delete la_post_parser initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Delete la_post_parser field. (language_defn::post_parser): New member function. * m2-lang.c (m2_language_data): Delete la_post_parser initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * parse.c (parse_exp_in_context): Update call to post_parser. (null_post_parser): Delete definition. * parser-defs.h (null_post_parser): Delete declaration. * rust-lang.c (rust_language_data): Delete la_post_parser initializer.
2020-06-23gdb: Convert language la_parser field to a methodAndrew Burgess1-1/+7
This commit changes the language_data::la_parser 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 (parse): Rename to ada_language::parser. (ada_language_data): Delete la_parser initializer. (ada_language::parser): New member function, implementation from parse. * c-lang.c (c_language_data): Delete la_parser initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. (d_language::parser): New member function. * f-lang.c (f_language_data): Delete la_parser initializer. (f_language::parser): New member function. * go-lang.c (go_language_data): Delete la_parser initializer. (go_language::parser): New member function. * language.c (unk_lang_parser): Delete. (language_defn::parser): Define new member function. (unknown_language_data): Delete la_parser initializer. (unknown_language::parser): New member function. (auto_language_data): Delete la_parser initializer. (auto_language::parser): New member function. * language.h (language_data): Delete la_parser field. (language_defn::parser): Declare new member function. * m2-lang.c (m2_language_data): Delete la_parser initializer. (m2_language::parser): New member function. * objc-lang.c (objc_language_data): Delete la_parser initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. (pascal_language::parser): New member function. * parse.c (parse_exp_in_context): Update call to parser. * rust-lang.c (rust_language_data): Delete la_parser initializer. (rust_language::parser): New member function.
2020-06-17gdb: Convert language la_lookup_symbol_nonlocal field to a methodAndrew Burgess1-1/+0
This commit changes the language_data::la_lookup_symbol_nonlocal 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_lookup_symbol_nonlocal): Rename to ada_language::lookup_symbol_nonlocal. (ada_language_data): Delete la_lookup_symbol_nonlocal initializer. (ada_language::lookup_symbol_nonlocal): New member function, implementation from ada_lookup_symbol_nonlocal. * c-lang.c (c_language_data): Delete la_lookup_symbol_nonlocal initializer. (cplus_language_data): Delete la_lookup_symbol_nonlocal initializer. (cplus_language::lookup_symbol_nonlocal): New member function. (asm_language_data): Delete la_lookup_symbol_nonlocal initializer. (minimal_language_data) Likewise. * cp-namespace.c (cp_lookup_nested_symbol): Update comment. * d-lang.c (d_language_data): Delete la_lookup_symbol_nonlocal initializer. (d_language::lookup_symbol_nonlocal): New member function. * f-lang.c (f_language_data): Delete la_lookup_symbol_nonlocal initializer. (f_language::lookup_symbol_nonlocal): New member function. * go-lang.c (go_language_data): Delete la_lookup_symbol_nonlocal initializer. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Delete la_lookup_symbol_nonlocal field. (language_defn::lookup_symbol_nonlocal): New member function. * m2-lang.c (m2_language_data): Delete la_lookup_symbol_nonlocal initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_lookup_symbol_nonlocal): Rename to rust_language::lookup_symbol_nonlocal. (rust_language_data): Delete la_lookup_symbol_nonlocal initializer. (rust_language::lookup_symbol_nonlocal): New member function, implementation from rust_lookup_symbol_nonlocal. * symtab.c (lookup_symbol_aux): Update call to lookup_symbol_nonlocal. (basic_lookup_symbol_nonlocal): Rename to... (language_defn::lookup_symbol_nonlocal): ...this, and update header comment. Remove language_defn parameter, and replace with uses of `this'. * symtab.h (basic_lookup_symbol_nonlocal): Delete declaration.
2020-06-17gdb: Convert language la_value_print_inner field to a methodAndrew Burgess1-1/+9
This commit changes the language_data::la_value_print_inner 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_data): Delete la_value_print_inner initializer. (ada_language::value_print_inner): New member function. * c-lang.c (c_language_data): Delete la_value_print_inner initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. (d_language::value_print_inner): New member function. * f-lang.c (f_language_data): Delete la_value_print_inner initializer. (f_language::value_print_inner): New member function. * f-lang.h (f_value_print_innner): Rename to... (f_value_print_inner): ...this (note spelling of 'inner'). * f-valprint.c (f_value_print_innner): Rename to... (f_value_print_inner): ...this (note spelling of 'inner'). * go-lang.c (go_language_data): Delete la_value_print_inner initializer. (go_language::value_print_inner): New member function. * language.c (language_defn::value_print_inner): Define new member function. (unk_lang_value_print_inner): Delete. (unknown_language_data): Delete la_value_print_inner initializer. (unknown_language::value_print_inner): New member function. (auto_language_data): Delete la_value_print_inner initializer. (auto_language::value_print_inner): New member function. * language.h (language_data): Delete la_value_print_inner field. (language_defn::value_print_inner): Delcare new member function. * m2-lang.c (m2_language_data): Delete la_value_print_inner initializer. (m2_language::value_print_inner): New member function. * objc-lang.c (objc_language_data): Delete la_value_print_inner initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. (pascal_language::value_print_inner): New member function. * rust-lang.c (rust_language_data): Delete la_value_print_inner initializer. (rust_language::value_print_inner): New member function. * valprint.c (do_val_print): Update call to value_print_inner.
2020-06-17gdb: Convert language la_value_print field to a methodAndrew Burgess1-1/+8
This commit changes the language_data::la_value_print 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_data): Delete la_value_print initializer. (ada_language::value_print): New member function. * c-lang.c (c_language_data): Delete la_value_print initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (unk_lang_value_print): Delete. (language_defn::value_print): Define new member function. (unknown_language_data): Delete la_value_print initializer. (unknown_language::value_print): New member function. (auto_language_data): Delete la_value_print initializer. (auto_language::value_print): New member function. * language.h (language_data): Delete la_value_print field. (language_defn::value_print): Declare new member function. (LA_VALUE_PRINT): Update call to value_print. * m2-lang.c (m2_language_data): Delete la_value_print initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. (pascal_language::value_print): New member function. * rust-lang.c (rust_language_data): Delete la_value_print initializer.
2020-06-17gdb: Convert language la_watch_location_expression field to a methodAndrew Burgess1-1/+0
This commit changes the language_data::la_watch_location_expression 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_watch_location_expression): Rename to ada_language::watch_location_expression. (ada_language_data): Delete la_watch_location_expression initializer. (ada_language::watch_location_expression): New member function, implementation from ada_watch_location_expression. * breakpoint.c (watch_command_1): Update call to watch_location_expression. * c-lang.c (c_watch_location_expression): Rename to language_defn::watch_location_expression. (c_language_data): Delete la_watch_location_expression initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * c-lang.h (c_watch_location_expression): Delete declaration. * d-lang.c (d_language_data): Delete la_watch_location_expression initializer. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (language_defn::watch_location_expression): Member function implementation from c_watch_location_expression. (unknown_language_data): Delete la_watch_location_expression initializer. (auto_language_data): Likewise. * language.h (language_data): Delete la_watch_location_expression field. (language_defn::watch_location_expression): Declare new member function. * m2-lang.c (m2_language_data): Delete la_watch_location_expression initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_watch_location_expression): Rename to rust_language::watch_location_expression. (rust_language_data): Delete la_watch_location_expression initializer. (rust_language::watch_location_expression): New member function, implementation from rust_watch_location_expression.
2020-06-17gdb: Convert language la_collect_symbol_completion_matches field to a methodAndrew Burgess1-1/+0
This commit changes the language_data::la_collect_symbol_completion_matches 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_collect_symbol_completion_matches): Rename to ada_language::collect_symbol_completion_matches. (ada_language_data): Delete la_collect_symbol_completion_matches initializer. (ada_language::collect_symbol_completion_matches): New member function, implementation from ada_collect_symbol_completion_matches. * c-lang.c (c_language_data): Delete la_collect_symbol_completion_matches initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_collect_symbol_completion_matches): Rename to f_language::collect_symbol_completion_matches. (f_language_data): Delete la_collect_symbol_completion_matches initializer. (f_language::collect_symbol_completion_matches) New member function, implementation from f_collect_symbol_completion_matches. * go-lang.c (go_language_data): Delete la_collect_symbol_completion_matches initializer. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Delete la_collect_symbol_completion_matches field. (language_defn::collect_symbol_completion_matches): New member function. * m2-lang.c (m2_language_data): Delete la_collect_symbol_completion_matches initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise. * symtab.c (default_collect_symbol_completion_matches): Delete. (collect_symbol_completion_matches): Update call to collect_symbol_completion_matches. (collect_symbol_completion_matches_type): Likewise. * symtab.h (default_collect_symbol_completion_matches): Delete declaration.
2020-06-17gdb: Convert language la_word_break_characters field to a methodAndrew Burgess1-1/+0
This commit changes the language_data::la_word_break_characters 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_get_gdb_completer_word_break_characters): Delete. (ada_language_data): Delete la_word_break_characters initializer. (ada_language::word_break_characters): New member function. * c-lang.c (c_language_data): Delete la_word_break_characters initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * completer.c: Update global comment. (advance_to_expression_complete_word_point): Update call to word_break_characters. (complete_files_symbols): Likewise. (complete_line_internal_1): Likewise. (default_completer_handle_brkchars): Likewise. (skip_quoted_chars): Likewise. * d-lang.c (d_language_data): Delete la_word_break_characters initializer. * f-lang.c (f_word_break_characters): Delete. (f_language_data): Delete la_word_break_characters initializer. (f_language::word_break_characters): New member function. * go-lang.c (go_language_data): Delete la_word_break_characters initializer. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (default_word_break_characters): Move declaration to earlier in the file. (language_data): Delete la_word_break_characters field. (language_defn::word_break_characters): New member function. * m2-lang.c (m2_language_data): Delete la_word_break_characters initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise.
2020-06-17gdb: Convert language la_get_symbol_name_matcher field to a methodAndrew Burgess1-1/+0
This commit changes the language_data::la_get_symbol_name_matcher function pointer member variable into a member function of language_defn. There should be no user visible changes after this commit. Before this commit access to the la_get_symbol_name_matcher function pointer was through the get_symbol_name_matcher function, which looked something like this (is pseudo-code): <return-type> get_symbol_name_matcher (language_defn *lang, <other args>) { if (current_language == ada) current_language->la_get_symbol_name_matcher (<other args>); else lang->la_get_symbol_name_matcher (<other args>); } In this commit I moved the get_symbol_name_matcher as a non-virtual function in the language_defn base class, I then add a new virtual method that is only used from within get_symbol_name_matcher, this can then be overridden by specific languages as needed. So we now have: class language_defn { <return-type> get_symbol_name_matcher (<args>) { if (current_language == ada) return current_language->get_symbol_name_matcher_inner (<args>); else return this->get_symbol_name_matcher_inner (<args>); } virtual <return-type> get_symbol_name_matcher_inner (<args>) { .... } } gdb/ChangeLog: * ada-lang.c (ada_get_symbol_name_matcher): Update header comment. (ada_language_data): Delete la_get_symbol_name_matcher initializer. (language_defn::get_symbol_name_matcher_inner): New member function. * c-lang.c (c_language_data): Delete la_get_symbol_name_matcher initializer. (cplus_language_data): Likewise. (cplus_language::get_symbol_name_matcher_inner): New member function. (asm_language_data): Delete la_get_symbol_name_matcher initializer. (minimal_language_data): Likewise. * cp-support.h (cp_get_symbol_name_matcher): Update header comment. * d-lang.c (d_language_data): Delete la_get_symbol_name_matcher initializer. * dictionary.c (iter_match_first_hashed): Update call to get_symbol_name_matcher. (iter_match_next_hashed): Likewise. (iter_match_next_linear): Likewise. * dwarf2/read.c (dw2_expand_symtabs_matching_symbol): Likewise. * f-lang.c (f_language_data): Delete la_get_symbol_name_matcher initializer. (f_language::get_symbol_name_matcher_inner): New member function. * go-lang.c (go_language_data): Delete la_get_symbol_name_matcher initializer. * language.c (default_symbol_name_matcher): Update header comment, make static. (language_defn::get_symbol_name_matcher): New definition. (language_defn::get_symbol_name_matcher_inner): Likewise. (get_symbol_name_matcher): Delete. (unknown_language_data): Delete la_get_symbol_name_matcher initializer. (auto_language_data): Likewise. * language.h (language_data): Delete la_get_symbol_name_matcher field. (language_defn::get_symbol_name_matcher): New member function. (language_defn::get_symbol_name_matcher_inner): Likewise. (default_symbol_name_matcher): Delete declaration. * linespec.c (find_methods): Update call to get_symbol_name_matcher. * m2-lang.c (m2_language_data): Delete la_get_symbol_name_matcher initializer. * minsyms.c (lookup_minimal_symbol): Update call to get_symbol_name_matcher. (iterate_over_minimal_symbols): Likewise. * objc-lang.c (objc_language_data): Delete la_get_symbol_name_matcher initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * psymtab.c (psymbol_name_matches): Update call to get_symbol_name_matcher. * rust-lang.c (rust_language_data): Delete la_get_symbol_name_matcher initializer. * symtab.c (symbol_matches_search_name): Update call to get_symbol_name_matcher. (compare_symbol_name): Likewise.