aboutsummaryrefslogtreecommitdiff
path: root/gdb/expprint.c
AgeCommit message (Collapse)AuthorFilesLines
2023-05-01Remove op_nameTom Tromey1-24/+17
op_name is only needed in a single place, so remove it and inline it there.
2023-04-17Convert long_const_operation to use gdb_mpzTom Tromey1-0/+6
This changes long_const_operation to use gdb_mpz for its storage.
2023-02-19Convert block_objfile to methodTom Tromey1-1/+1
This converts block_objfile to be a method. This was mostly written by script.
2023-02-08Don't include block.h from expop.hTom Tromey1-0/+6
expop.h needs block.h for a single inline function. However, I don't think most of the check_objfile functions need to be defined in the header (just the templates). This patch moves the one offending function and removes the include.
2023-01-05Add type to expression dump of symbolTom Tromey1-0/+1
I recently had cause to dump some expressions from gdb. I got output like this: Operation: BINOP_GTR Operation: OP_VAR_VALUE Block symbol: Symbol: small_value Block: 0x39b4c20 Operation: OP_LONG Operation: OP_LONG Type: int Constant: 0x0000000000000014 This is ok, but it would have been handy to see the type of the symbol. This patch adds this information. Reviewed-By: Bruno Larsen <blarsen@redhat.com>
2023-01-02Simplify debug_expTom Tromey1-1/+1
debug_exp should call expression::dump rather than using the 'op' member.
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-11-14Remove dump_prefix_expressionTom Tromey1-6/+0
Since the expression rewrite, dump_prefix_expression has been misnamed. This patch cleans this up by removing the function, turning it into a method on struct expression.
2022-08-05[gdb] Add debug_{exp,val}Tom de Vries1-0/+13
When debugging cc1 I heavily rely on simple one-parameter debug functions that allow me to inspect a variable of a common type, like: - debug_generic_expr - debug_gimple_stmt - debug_rtx and I miss similar functions in gdb. Add functions to dump variables of types 'value' and 'expression': - debug_exp, and - debug_val. Tested on x86_64-linux, by breaking on varobj_create, and doing: ... (gdb) call debug_exp (var->root->exp.get ()) &"Operation: OP_VAR_VALUE\n" &" Block symbol:\n" &" Symbol: aaa\n" &" Block: 0x2d064f0\n" (gdb) ... and: ... (gdb) call debug_val (value) &"5" (gdb) ...
2022-03-29Unify gdb printf functionsTom Tromey1-21/+21
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-13/+13
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-05Filtered output cleanup in expression dumpingTom Tromey1-13/+13
Most of the expression-dumping code uses filtered output, but a few functions did not. This patch cleans up these instance. Note that this won't cause any behavior change, because the only calls to dump_prefix_expression pass in gdb_stdlog. However, in the long run it's easier to audit the code if the number of uses of _unfiltered is reduced.
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-04-15Use block_symbol in var_value_operationTom Tromey1-0/+9
I noticed that var_value_operation takes a block and a symbol, and most callers destructure a block_symbol to pass in. It seems better for this class to simply hold a block_symbol instead. Tested on x86-64 Fedora 32. gdb/ChangeLog 2021-04-15 Tom Tromey <tromey@adacore.com> * rust-exp.y (rust_parser::convert_ast_to_expression): Update. * parse.c (parser_state::push_symbol, parser_state::push_dollar): Update. * p-exp.y (variable): Update. * m2-exp.y (variable): Update. * go-exp.y (variable): Update. * expprint.c (dump_for_expression): New overload. * expop.h (check_objfile): New overload. (check_constant): New overload. (class var_value_operation): Use block_symbol. <get_symbol>: Rewrite. * eval.c (var_value_operation::evaluate) (var_value_operation::evaluate_funcall) (var_value_operation::evaluate_for_address) (var_value_operation::evaluate_for_address) (var_value_operation::evaluate_with_coercion) (var_value_operation::evaluate_for_sizeof) (var_value_operation::evaluate_for_cast): Update. * d-exp.y (PrimaryExpression): Update. * c-exp.y (variable): Update. * ax-gdb.c (var_value_operation::do_generate_ax): Update. * ada-lang.c (ada_var_value_operation::evaluate_for_cast) (ada_var_value_operation::evaluate) (ada_var_value_operation::resolve) (ada_funcall_operation::resolve): Update. * ada-exp.y (write_var_from_sym, write_object_renaming) (write_ambiguous_var, write_var_or_type, write_name_assoc) (maybe_overload): Update. * ada-exp.h (class ada_var_value_operation) <get_block>: Rewrite.
2021-03-08Use bound_minimal_symbol in var_msym_value_operationTom Tromey1-10/+4
This changes var_msym_value_operation to use a bound_minimal_symbol rather than separate minsym and objfile parameters. The main benefit of this is removing the possibly-confusing check_objfile overload for a plain minimal symbol. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * parse.c (parser_state::push_symbol, parser_state::push_dollar): Update. * p-exp.y (variable): Update. * go-exp.y (variable): Update. * expprint.c (dump_for_expression): Use bound_minimal_symbol. Remove overload for objfile. * expop.h (eval_op_var_msym_value): Use bound_minimal_symbol parameter. (check_objfile): Likewise. (dump_for_expression): Likewise. Remove overload for objfile. (class var_msym_value_operation): Use bound_minimal_symbol. * eval.c (eval_op_var_msym_value): Use bound_minimal_symbol parameter. (var_msym_value_operation::evaluate_for_address) (var_msym_value_operation::evaluate_for_sizeof) (var_msym_value_operation::evaluate_for_cast): Update. * d-exp.y (PrimaryExpression): Update. * c-exp.y (variable): Update. * ax-gdb.c (var_msym_value_operation::do_generate_ax): Update. * ada-lang.c (ada_var_msym_value_operation::evaluate_for_cast): Update. * ada-exp.y (write_var_or_type): Update.
2021-03-08Remove union exp_elementTom Tromey1-1116/+1
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-03-08Add an expr::operation_up to struct expressionTom Tromey1-0/+16
This adds an expr::operation_up to struct expression, and then modifies various parts of GDB to use this member when it is non-null. The list of such spots was a bit surprising to me, and found only after writing most of the code and then noticing what no longer compiled. In a few spots, new accessor methods are added to operation subclasses, so that code that dissects an expression will work with the new scheme. After this change, code that constructs an expression can be switched to the new form without breaking. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-exp.h (class ada_var_value_operation) <get_symbol>: Remove; now in superclass. * value.h (fetch_subexp_value): Add "op" parameter. * value.c (init_if_undefined_command): Update. * tracepoint.c (validate_actionline, encode_actions_1): Update. * stap-probe.c (stap_probe::compile_to_ax): Update. * printcmd.c (set_command): Update. * ppc-linux-nat.c (ppc_linux_nat_target::check_condition): Update. * parser-defs.h (struct expr_builder) <set_operation>: New method. * parse.c (parse_exp_in_context, exp_uses_objfile): Update. * expression.h (struct expression) <first_opcode>: Update. <op>: New member. * expprint.c (dump_raw_expression, dump_prefix_expression): Update. * expop.h (class var_value_operation) <get_symbol>: New method. (class register_operation) <get_name>: New method. (class equal_operation): No longer a typedef, now a subclass. (class unop_memval_operation) <get_type>: New method. (class assign_operation) <get_lhs>: New method. (class unop_cast_operation) <get_type>: New method. * eval.c (evaluate_expression, evaluate_type) (evaluate_subexpression_type): Update. (fetch_subexp_value): Add "op" parameter. (parse_and_eval_type): Update. * dtrace-probe.c (dtrace_probe::compile_to_ax): Update. * breakpoint.c (update_watchpoint, watchpoint_check) (watchpoint_exp_is_const, watch_command_1): Update. * ax-gdb.c (gen_trace_for_expr, gen_eval_for_expr, gen_printf): Update.
2021-03-08Implement Ada assignmentTom Tromey1-0/+8
Assignment is the most complicated Ada expression, because implementing aggregate assignment involves several specialized opcodes. This patch does this implementation by introducing new abstract classes that are used to represent the various parts of aggregate assignment. This makes the code somewhat cleaner, and, by avoiding the over-use of 'operation' subclasses, avoids the need for dissection using dynamic_cast (though a few are still needed here). I believe this patch fixes a latent bug in the handling of aggregate_assign_from_choices. That code does: if (op == OP_DISCRETE_RANGE) { choice_pos += 1; lower = value_as_long (ada_evaluate_subexp (NULL, exp, pos, EVAL_NORMAL)); upper = value_as_long (ada_evaluate_subexp (NULL, exp, pos, EVAL_NORMAL)); } However, I think 'choice_pos' should be used in the calls, rather than 'pos'. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expprint.c (dump_for_expression): New overload. * expop.h (check_objfile, dump_for_expression): Declare new overloads. * ada-lang.c (check_objfile): New overload. (assign_component, ada_aggregate_component::uses_objfile) (ada_aggregate_component::dump, ada_aggregate_component::assign) (ada_aggregate_component::assign_aggregate) (ada_positional_component::uses_objfile) (ada_positional_component::dump, ada_positional_component::assign) (ada_discrete_range_association::uses_objfile) (ada_discrete_range_association::dump) (ada_discrete_range_association::assign) (ada_name_association::uses_objfile, ada_name_association::dump) (ada_name_association::assign) (ada_choices_component::uses_objfile, ada_choices_component::dump) (ada_choices_component::assign) (ada_others_component::uses_objfile, ada_others_component::dump) (ada_others_component::assign, ada_assign_operation::evaluate): New methods. * ada-exp.h (ada_string_operation) <get_name>: New method. (class ada_assign_operation): New. (class ada_component): New. (ada_component_up): New typedef. (class ada_aggregate_operation, class ada_aggregate_component) (class ada_positional_component, class ada_others_component) (class ada_association): New. (ada_association_up): New typedef. (class ada_choices_component) (class ada_discrete_range_association) (class ada_name_association): New.
2021-03-08Introduce float_const_operationTom Tromey1-0/+8
This adds class float_const_operation, an operation holding a floating-point constant. Unlike most other new operations, this one requires a custom 'dump' method. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expprint.c (float_const_operation::dump): New method. * expop.h (float_data): New typedef. (class float_const_operation): New.
2021-03-08Implement dumpingTom Tromey1-0/+124
This patch implements the dumping methods for tuple_holding_operation. A number of overloads are used. Note that no default case is given. This approach makes it simple to detect when a new overload is needed -- compilation will fail. (There is an example of this in a later patch in the series.) gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expprint.c (expr::dump_for_expression): New functions. * expop.h (dump_for_expression): New overloads. (tuple_holding_operation::dump, tuple_holding_operation::do_dump): Update.
2021-01-12gdb: fix debug dump of OP_BOOL expressionsAndrew Burgess1-1/+8
Consider this GDB session: (gdb) set language fortran (gdb) set debug expression 1 (gdb) p .TRUE. Dump of expression @ 0x4055d90, before conversion to prefix form: Language fortran, 3 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_BOOL 79 O............... 1 BINOP_ADD 1 ................ 2 OP_BOOL 79 O............... Dump of expression @ 0x4055d90, after conversion to prefix form: Expression: `TRUE' Language fortran, 3 elements, 16 bytes each. 0 OP_BOOL Unknown format 1 BINOP_ADD 2 OP_BOOL Unknown format 3 OP_NULL Unknown format $1 = .TRUE. The final dump of the OP_BOOL is completely wrong. After this patch we now get: (gdb) set language fortran (gdb) set debug expression 1 (gdb) p .TRUE. Dump of expression @ 0x2d07470, before conversion to prefix form: Language fortran, 3 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_BOOL 79 O............... 1 BINOP_ADD 1 ................ 2 OP_BOOL 79 O............... Dump of expression @ 0x2d07470, after conversion to prefix form: Expression: `TRUE' Language fortran, 3 elements, 16 bytes each. 0 OP_BOOL TRUE $1 = .TRUE. Much better. I added a test for this into the Fortran testsuite. gdb/ChangeLog: * expprint.c (dump_subexp_body_standard): Handle OP_BOOL. gdb/testsuite/ChangeLog: * gdb.fortran/debug-expr.exp: Add new tests.
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: remove some uses of LA_PRINT_STRINGAndrew Burgess1-8/+11
This commit removes some, but not all, uses of LA_PRINT_STRING. In this commit I've removed those uses where there is an obvious language object on which I can instead call the printstr method. In the remaining 3 uses it is harder to know if the correct thing is to call printstr on the current language, or on a specific language. Currently obviously, we always call on the current language (as that's what LA_PRINT_STRING does), and clearly this behaviour is good enough right now, but is it "right"? I've left them for now and will give them more thought in the future. gdb/ChangeLog: * expprint.c (print_subexp_standard): Replace uses of LA_PRINT_STRING. * f-valprint.c (f_language::value_print_inner): Likewise. * guile/scm-pretty-print.c (ppscm_print_string_repr): Likewise. * p-valprint.c (pascal_language::value_print_inner): Likewise. * python/py-prettyprint.c (print_string_repr): Likewise.
2020-12-09Unify all operators into std-operator.defTom Tromey1-2/+0
This removes ada-operator.def and fortran-operator.def, merging their contents into std-operator.def. Note that the comment for OP_EXTENDED0 is a bit wrong. IMO this constant could be removed, as it is only used for a single assert that does not provide much value. However, I haven't done so here. gdb/ChangeLog 2020-12-09 Tom Tromey <tromey@adacore.com> * expprint.c (op_name): Update. * expression.h (enum exp_opcode): Update. * std-operator.def: Add more opcodes. * ada-operator.def, fortran-operator.def: Remove, moving contents into std-operator.def.
2020-11-30Remove per-language op_name functionsTom Tromey1-18/+5
enum exp_opcode is created from all the .def files, but then each language is required to implement its own op_name function to turn an enum value to a string. This seemed over-complicated to me, and this patch removes the per-language functions in favor of simply using the .def names for all languages. Note that op_name is only used for dumping expressions, which is a maintainer/debug feature. Furthermore, I don't think there was any case where the .def name and the string name differed. gdb/ChangeLog 2020-11-30 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_op_name): Remove. (exp_descriptor_rust): Update. * parser-defs.h (op_name_standard): Don't declare. (struct exp_descriptor) <op_name>: Remove. * parse.c (exp_descriptor_standard): Update. * opencl-lang.c (exp_descriptor_opencl): Update. * m2-lang.c (m2_language::exp_descriptor_modula2): Update. * f-lang.c (op_name_f): Remove. (f_language::exp_descriptor_tab): Update. * expression.h (op_name): Update. * expprint.c (op_name): Rewrite. (op_name_standard): Remove. (dump_raw_expression, dump_subexp): Update. * c-lang.c (exp_descriptor_c): Update. * ax-gdb.c (gen_expr): Update. * ada-lang.c (ada_op_name): Remove. (ada_exp_descriptor): Update.
2020-11-06gdb: fix debug expression dumping of function call expressionsAndrew Burgess1-1/+1
In commit: commit 6d81691950f8c4be4a49a85a672255c140e82468 CommitDate: Sat Sep 19 09:44:58 2020 +0100 gdb/fortran: Move Fortran expression handling into f-lang.c A bug was introduced that broke GDB's ability to perform debug dumps of expressions containing function calls. For example this would no longer work: (gdb) set debug expression 1 (gdb) print call_me (&val) Dump of expression @ 0x4eced60, before conversion to prefix form: Language c, 12 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_VAR_VALUE 40 (............... 1 OP_M2_STRING 79862864 P............... 2 unknown opcode: 224 79862240 ................ 3 OP_VAR_VALUE 40 (............... 4 OP_VAR_VALUE 40 (............... 5 OP_RUST_ARRAY 79861600 `............... 6 UNOP_PREDECREMENT 79861312 @............... 7 OP_VAR_VALUE 40 (............... 8 UNOP_ADDR 61 =............... 9 OP_FUNCALL 46 ................ 10 BINOP_ADD 1 ................ 11 OP_FUNCALL 46 ................ Dump of expression @ 0x4eced60, after conversion to prefix form: Expression: `call_me (&main::val, VAL(Aborted (core dumped) The situation was even worse for Fortran function calls, or array indexes, which both make use of the same expression opcode. The problem was that in a couple of places the index into the expression array was handled incorrectly causing GDB to interpret elements incorrectly. These issues are fixed in this commit. There are already some tests to check GDB when 'set debug expression 1' is set, these can be found in gdb.*/debug-expr.exp. Unfortunately the cases above were not covered. In this commit I have cleaned up all of the debug-expr.exp files a little, there was a helper function that had clearly been copied into each file, this is now moved into lib/gdb.exp. I've added a gdb.fortran/debug-expr.exp test file, and extended gdb.base/debug-expr.exp to cover the function call case. gdb/ChangeLog: * expprint.c (print_subexp_funcall): Increment expression position after reading argument count. * f-lang.c (print_subexp_f): Skip over opcode before calling common function. (dump_subexp_body_f): Likewise. gdb/testsuite/ChangeLog: * gdb.base/debug-expr.c: Add extra function to allow for an additional test. * gdb.base/debug-expr.exp (test_debug_expr): Delete, replace calls to this proc with gdb_test_debug_expr. Add an extra test. * gdb.cp/debug-expr.exp (test_debug_expr): Delete, replace calls to this proc with gdb_test_debug_expr, give the tests names * gdb.dlang/debug-expr.exp (test_debug_expr): Delete, replace calls to this proc with gdb_test_debug_expr, give the tests names * gdb.fortran/debug-expr.exp: New file. * gdb.fortran/debug-expr.f90: New file. * lib/gdb.exp (gdb_test_debug_expr): New proc.
2020-11-02gdb, gdbserver, gdbsupport: fix leading space vs tabs issuesSimon Marchi1-7/+7
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-10-22gdb/fortran: add support for parsing array strides in expressionsAndrew Burgess1-0/+4
With this commit GDB now understands the syntax of Fortran array strides, a user can type an expression including an array stride, but they will only get an error informing them that array strides are not supported. This alone is an improvement on what we had before in GDB, better to give the user a helpful message that a particular feature is not supported than to just claim a syntax error. Before: (gdb) p array (1:10:2, 2:10:2) A syntax error in expression, near `:2, 2:10:2)'. Now: (gdb) p array (1:10:2, 2:10:2) Fortran array strides are not currently supported Later commits will allow GDB to handle array strides correctly. gdb/ChangeLog: * expprint.c (dump_subexp_body_standard): Print RANGE_HAS_STRIDE. * expression.h (enum range_type): Add RANGE_HAS_STRIDE. * f-exp.y (arglist): Allow for a series of subranges. (subrange): Add cases for subranges with strides. * f-lang.c (value_f90_subarray): Catch use of array strides and throw an error. * parse.c (operator_length_standard): Handle RANGE_HAS_STRIDE. gdb/testsuite/ChangeLog: * gdb.fortran/array-slices.exp: Add a new test.
2020-10-22gdb: rename 'enum range_type' to 'enum range_flag'Andrew Burgess1-12/+12
To avoid confusion with other parts of GDB relating to types and ranges, rename this enum to make it clearer that it is a set of individual flags rather than an enumeration of different types of range. There should be no user visible changes after this commit. gdb/ChangeLog: * expprint.c (print_subexp_standard): Change enum range_type to range_flag and rename variables to match. (dump_subexp_body_standard): Likewise. * expression.h (enum range_type): Rename to... (enum range_flag): ...this. (range_types): Rename to... (range_flags): ...this. * f-lang.c (value_f90_subarray): Change enum range_type to range_flag and rename variables to match. * parse.c (operator_length_standard): Likewise. * rust-exp.y (rust_parser::convert_ast_to_expression): Change enum range_type to range_flag. * rust-lang.c (rust_evaluate_funcall): Likewise. (rust_range): Likewise. (rust_compute_range): Likewise. (rust_subscript): Likewise.
2020-10-22gdb: Convert enum range_type to a bit field enumAndrew Burgess1-35/+14
The expression range_type enum represents the following ideas: - Lower bound is set to default, - Upper bound is set to default, - Upper bound is exclusive. There are currently 6 entries in the enum to represent the combination of all those ideas. In a future commit I'd like to add stride information to the range, this could in theory appear with any of the existing enum entries, so this would take us to 12 enum entries. This feels like its getting a little out of hand, so in this commit I switch the range_type enum over to being a flags style enum. There's one entry to represent no flags being set, then 3 flags to represent the 3 ideas above. Adding stride information will require adding only one more enum flag. I've then gone through and updated the code to handle this change. There should be no user visible changes after this commit. gdb/ChangeLog: * expprint.c (print_subexp_standard): Update to reflect changes to enum range_type. (dump_subexp_body_standard): Likewise. * expression.h (enum range_type): Convert to a bit field enum, and make the enum unsigned. * f-exp.y (subrange): Update to reflect changes to enum range_type. * f-lang.c (value_f90_subarray): Likewise. * parse.c (operator_length_standard): Likewise. * rust-exp.y (rust_parser::convert_ast_to_expression): Likewise. * rust-lang.c (rust_range): Likewise. (rust_compute_range): Likewise. (rust_subscript): Likewise.
2020-09-19gdb/fortran: Move Fortran expression handling into f-lang.cAndrew Burgess1-24/+37
The Fortran specific OP_F77_UNDETERMINED_ARGLIST is currently handled in the generic expression handling code. There's no reason why this should be the case, so this commit moves handling of this into Fortran specific files. There should be no user visible changes after this commit. gdb/ChangeLog: * eval.c: Remove 'f-lang.h' include. (value_f90_subarray): Moved to f-lang.c. (eval_call): Renamed to... (evaluate_subexp_do_call): ...this, is no longer static, header comment moved into header file. (evaluate_funcall): Update call to eval_call. (skip_undetermined_arglist): Moved to f-lang.c. (fortran_value_subarray): Likewise. (evaluate_subexp_standard): OP_F77_UNDETERMINED_ARGLIST handling moved to evaluate_subexp_f. (calc_f77_array_dims): Moved to f-lang.c * expprint.c (print_subexp_funcall): New function. (print_subexp_standard): OP_F77_UNDETERMINED_ARGLIST handling moved to print_subexp_f, OP_FUNCALL uses new function. (dump_subexp_body_funcall): New function. (dump_subexp_body_standard): OP_F77_UNDETERMINED_ARGLIST handling moved to dump_subexp_f, OP_FUNCALL uses new function. * expression.h (evaluate_subexp_do_call): Declare. * f-lang.c (value_f90_subarray): Moved from eval.c. (skip_undetermined_arglist): Likewise. (calc_f77_array_dims): Likewise. (fortran_value_subarray): Likewise. (evaluate_subexp_f): Add OP_F77_UNDETERMINED_ARGLIST support. (operator_length_f): Likewise. (print_subexp_f): Likewise. (dump_subexp_body_f): Likewise. * fortran-operator.def (OP_F77_UNDETERMINED_ARGLIST): Move declaration of this operation to here. * parse.c (operator_length_standard): OP_F77_UNDETERMINED_ARGLIST support moved to operator_length_f. * parser-defs.h (dump_subexp_body_funcall): Declare. (print_subexp_funcall): Declare. * std-operator.def (OP_F77_UNDETERMINED_ARGLIST): Moved to fortran-operator.def.
2020-09-16gdb: Convert language_data::la_op_print_tab to a methodAndrew Burgess1-2/+2
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-3/+5
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 la_name and la_natural_name to methodsAndrew Burgess1-3/+3
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-2/+2
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-06-15Change target_read_string APITom Tromey1-8/+4
This simplifies the target_read_string API a bit. Note that some code was using safe_strerror on the error codes returned by target_read_string. It seems to me that this is incorrect (if it was ever correct, it must have been quite a long time ago). gdb/ChangeLog 2020-06-15 Tom Tromey <tromey@adacore.com> * windows-nat.c (windows_nat::handle_output_debug_string): Update. (windows_nat::handle_ms_vc_exception): Update. * target.h (target_read_string): Change API. * target.c (target_read_string): Change API. * solib-svr4.c (open_symbol_file_object, svr4_read_so_list): Update. * solib-frv.c (frv_current_sos): Update. * solib-dsbt.c (dsbt_current_sos): Update. * solib-darwin.c (darwin_current_sos): Update. * linux-thread-db.c (inferior_has_bug): Update. * expprint.c (print_subexp_standard): Update. * ada-lang.c (ada_main_name, ada_tag_name_from_tsd) (ada_exception_message_1): Update.
2020-05-16gdb: remove TYPE_NAME macroSimon Marchi1-1/+1
Remove `TYPE_NAME`, changing all the call sites to use `type::name` directly. This is quite a big diff, but this was mostly done using sed and coccinelle. A few call sites were done by hand. gdb/ChangeLog: * gdbtypes.h (TYPE_NAME): Remove. Change all cal sites to use type::name instead.
2020-05-14gdb: remove TYPE_CODE macroSimon Marchi1-1/+1
Remove TYPE_CODE, changing all the call sites to use type::code directly. This is quite a big diff, but this was mostly done using sed and coccinelle. A few call sites were done by hand. gdb/ChangeLog: * gdbtypes.h (TYPE_CODE): Remove. Change all call sites to use type::code instead.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-11-22Replace SYMBOL_*_NAME accessors with member functionsChristian Biesinger1-6/+6
Similar to the MSYMBOL version of this patch, improves readability and will eventually allow making name private. gdb/ChangeLog: 2019-11-22 Christian Biesinger <cbiesinger@google.com> * ada-exp.y: Update. * ada-lang.c (sort_choices): Update. (ada_print_symbol_signature): Update. (resolve_subexp): Update. (ada_parse_renaming): Update. (ada_read_renaming_var_value): Update. (lesseq_defined_than): Update. (remove_extra_symbols): Update. (remove_irrelevant_renamings): Update. (ada_add_block_symbols): Update. (ada_collect_symbol_completion_matches): Update. (ada_is_renaming_symbol): Update. (aggregate_assign_from_choices): Update. (ada_evaluate_subexp): Update. (ada_has_this_exception_support): Update. (ada_is_non_standard_exception_sym): Update. (ada_add_exceptions_from_frame): Update. (ada_add_global_exceptions): Update. (ada_print_subexp): Update. * ax-gdb.c (gen_var_ref): Update. (gen_maybe_namespace_elt): Update. (gen_expr_for_cast): Update. (gen_expr): Update. * block.h: Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (print_breakpoint_location): Update. (update_static_tracepoint): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * buildsym.c (find_symbol_in_list): Update. * c-exp.y: Update. * c-typeprint.c (c_print_typedef): Update. (c_type_print_template_args): Update. * cli/cli-cmds.c (edit_command): Update. (list_command): Update. (print_sal_location): Update. * coffread.c (patch_opaque_types): Update. (process_coff_symbol): Update. (coff_read_enum_type): Update. * compile/compile-c-symbols.c (c_symbol_substitution_name): Update. (convert_one_symbol): Update. (hash_symname): Update. (eq_symname): Update. * compile/compile-cplus-symbols.c (convert_one_symbol): Update. * compile/compile-cplus-types.c (debug_print_scope): Update. * compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update. * compile/compile-object-load.c (get_out_value_type): Update. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Update. (search_symbol_list): Update. (cp_lookup_symbol_imports_or_template): Update. * cp-support.c (overload_list_add_symbol): Update. * ctfread.c (psymtab_to_symtab): Update. * dbxread.c (cp_set_block_scope): Update. * dictionary.c (iter_match_first_hashed): Update. (iter_match_next_hashed): Update. (insert_symbol_hashed): Update. (iter_match_next_linear): Update. * dictionary.h: Update. * dwarf2loc.c (func_get_frame_base_dwarf_block): Update. (locexpr_describe_location_piece): Update. (locexpr_describe_location_1): Update. (locexpr_generate_c_location): Update. (loclist_describe_location): Update. (loclist_generate_c_location): Update. * dwarf2read.c (dw2_debug_names_lookup_symbol): Update. (read_func_scope): Update. (process_enumeration_scope): Update. (new_symbol): Update. (dwarf2_const_value): Update. (dwarf2_symbol_mark_computed): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * f-valprint.c (info_common_command_for_block): Update. * findvar.c (get_hosting_frame): Update. (default_read_var_value): Update. * go-lang.c (go_symbol_package_name): Update. * guile/scm-block.c (bkscm_print_block_smob): Update. * guile/scm-symbol.c (syscm_print_symbol_smob): Update. (gdbscm_symbol_name): Update. (gdbscm_symbol_linkage_name): Update. (gdbscm_symbol_print_name): Update. * infcall.c (get_function_name): Update. * infcmd.c (jump_command): Update. (finish_command): Update. * infrun.c (insert_exception_resume_breakpoint): Update. * linespec.c (canonicalize_linespec): Update. (create_sals_line_offset): Update. (convert_linespec_to_sals): Update. (complete_label): Update. (find_label_symbols_in_block): Update. * m2-typeprint.c (m2_print_typedef): Update. * mdebugread.c (mdebug_reg_to_regnum): Update. (parse_symbol): Update. (mylookup_symbol): Update. * mi/mi-cmd-stack.c (list_arg_or_local): Update. (list_args_or_locals): Update. * objc-lang.c (compare_selectors): Update. (info_selectors_command): Update. (compare_classes): Update. (info_classes_command): Update. (find_imps): Update. * p-typeprint.c (pascal_print_typedef): Update. * printcmd.c (build_address_symbolic): Update. (info_address_command): Update. (print_variable_and_value): Update. * python/py-framefilter.c (extract_sym): Update. (py_print_single_arg): Update. * python/py-symbol.c (sympy_str): Update. (sympy_get_name): Update. (sympy_get_linkage_name): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rust-lang.c (rust_print_typedef): Update. * solib-frv.c (frv_fdpic_find_canonical_descriptor): Update. * stabsread.c (stab_reg_to_regnum): Update. (define_symbol): Update. (read_enum_type): Update. (common_block_end): Update. (cleanup_undefined_types_1): Update. (scan_file_globals): Update. * stack.c (print_frame_arg): Update. (print_frame_args): Update. (find_frame_funname): Update. (info_frame_command_core): Update. (iterate_over_block_locals): Update. (print_block_frame_labels): Update. (do_print_variable_and_value): Update. (iterate_over_block_arg_vars): Update. (return_command): Update. * symmisc.c (dump_symtab_1): Update. (print_symbol): Update. * symtab.c (eq_symbol_entry): Update. (symbol_cache_dump): Update. (lookup_language_this): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (symbol_search::compare_search_syms): Update. (treg_matches_sym_type_name): Update. (search_symbols): Update. (print_symbol_info): Update. (rbreak_command): Update. (completion_list_add_symbol): Update. (find_gnu_ifunc): Update. (get_symbol_address): Update. (search_module_symbols): Update. (info_module_subcommand): Update. * symtab.h (SYMBOL_NATURAL_NAME): Remove. (SYMBOL_LINKAGE_NAME): Remove. (SYMBOL_DEMANGLED_NAME): Remove. (SYMBOL_PRINT_NAME): Remove. (SYMBOL_SEARCH_NAME): Remove. * tracepoint.c (set_traceframe_context): Update. (validate_actionline): Update. (collection_list::collect_symbol): Update. (encode_actions_1): Update. (info_scope_command): Update. (print_one_static_tracepoint_marker): Update. * typeprint.c (typedef_hash_table::add_template_parameters): Update. * valops.c (address_of_variable): Update. (find_overload_match): Update. (find_oload_champ): Update. Change-Id: I76bdc8b44eea6876bf03af9d351f8e90cc0154b2
2019-11-22Replace the MSYMBOL_*_NAME macros with member functionsChristian Biesinger1-2/+2
Improves readability. In the future, it will also allow making the name private, once the name setter functions become member functions. gdb/ChangeLog: 2019-11-22 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_lookup_simple_minsym): Update. (ada_collect_symbol_completion_matches): Update. * ada-tasks.c (read_atcb): Update. * amd64-windows-tdep.c (amd64_skip_main_prologue): Update. (amd64_windows_skip_trampoline_code): Update. * arm-tdep.c (skip_prologue_function): Update. (arm_skip_stack_protector): Update. * arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update. (arm_wince_skip_main_prologue): Update. * ax-gdb.c (gen_expr): Update. * block.c (call_site_for_pc): Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (set_breakpoint_location_function): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * c-valprint.c (print_unpacked_pointer): Update. * coffread.c (coff_symfile_read): Update. * compile/compile-c-symbols.c (convert_symbol_bmsym): Update. * compile/compile-cplus-symbols.c (convert_symbol_bmsym): Update. * dwarf-index-write.c (write_psymbols): Update. * dwarf2loc.c (call_site_to_target_addr): Update. (func_verify_no_selftailcall): Update. (tailcall_dump): Update. (call_site_find_chain_1): Update. (dwarf_expr_reg_to_entry_parameter): Update. * elfread.c (elf_gnu_ifunc_record_cache): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. (evaluate_subexp_for_sizeof): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * frame.c (get_prev_frame_always_1): Update. * frv-tdep.c (frv_skip_main_prologue): Update. * gnu-v2-abi.c (gnuv2_value_rtti_type): Update. * gnu-v3-abi.c (gnuv3_rtti_type): Update. (gnuv3_get_typename_from_type_info): Update. (gnuv3_skip_trampoline): Update. * hppa-tdep.c (hppa_lookup_stub_minimal_symbol): Update. * i386-tdep.c (i386_skip_main_prologue): Update. (i386_pe_skip_trampoline_code): Update. * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update. * infcall.c (get_function_name): Update. * linespec.c (minsym_found): Update. * linux-fork.c (info_checkpoints_command): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. (m32c_m16c_pointer_to_address): Update. * maint.c (maintenance_translate_address): Update. * minsyms.c (add_minsym_to_hash_table): Update. (add_minsym_to_demangled_hash_table): Update. (lookup_minimal_symbol_mangled): Update. (lookup_minimal_symbol_demangled): Update. (lookup_minimal_symbol_linkage): Update. (lookup_minimal_symbol_text): Update. (lookup_minimal_symbol_by_pc_name): Update. (minimal_symbol_is_less_than): Update. (compact_minimal_symbols): Update. (build_minimal_symbol_hash_tables): Update. (find_solib_trampoline_target): Update. * mips-tdep.c (mips_stub_frame_sniffer): Update. (mips_skip_pic_trampoline_code): Update. * msp430-tdep.c (msp430_skip_trampoline_code): Update. * objc-lang.c (info_selectors_command): Update. (info_classes_command): Update. (find_methods): Update. (find_imps): Update. * p-valprint.c (pascal_val_print): Update. * ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * printcmd.c (build_address_symbolic): Update. (info_symbol_command): Update. * psymtab.c (psymbol_name_matches): Update. (match_partial_symbol): Update. (lookup_partial_symbol): Update. (print_partial_symbols): Update. (sort_pst_symbols): Update. (maintenance_check_psymtabs): Update. * python/py-framefilter.c (py_print_frame): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rs6000-tdep.c (rs6000_skip_main_prologue): Update. (rs6000_skip_trampoline_code): Update. * sol-thread.c (info_cb): Update. * stabsread.c (scan_file_globals): Update. * stack.c (find_frame_funname): Update. (info_frame_command_core): Update. * symmisc.c (dump_msymbols): Update. * symtab.c (symbol_natural_name): Rename to.., (general_symbol_info::natural_name): ...this. (symbol_demangled_name): Rename to... (general_symbol_info::demangled_name): ...this. (symbol_search_name): Rename to... (general_symbol_info::search_name): ...this. (symbol_matches_search_name): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (search_symbols): Update. (print_msymbol_info): Update. (rbreak_command): Update. (completion_list_add_msymbol): Update. (completion_list_objc_symbol): Update. (get_msymbol_address): Update. * symtab.h (struct general_symbol_info): Add member functions natural_name (), linkage_name (), print_name (), demangled_name (), and search_name (). (SYMBOL_NATURAL_NAME): Update. (symbol_natural_name): Move to a member function on general_symbol_info. (SYMBOL_DEMANGLED_NAME): Update. (symbol_demangled_name): Move to a member function on general_symbol_info. (SYMBOL_SEARCH_NAME): Update. (symbol_search_name): Move to a member function on general_symbol_info. (MSYMBOL_NATURAL_NAME): Remove. (MSYMBOL_LINKAGE_NAME): Remove. (MSYMBOL_PRINT_NAME): Remove. (MSYMBOL_DEMANGLED_NAME): Remove. (MSYMBOL_SEARCH_NAME): Remove. * x86-tdep.c (x86_in_indirect_branch_thunk): Update. Change-Id: I65aa529843a9903e174ce799037e41f954a9fcee
2019-10-01Introduce metadata styleTom Tromey1-2/+4
This introduces a new "metadata" style and changes many places in gdb to use it. The idea here is to let the user distinguish gdb output from output that (conceptually at least) comes directly from the inferior. The newly-styled category includes text that gdb traditionally surrounds in "<...>", like "<unavailable>". I only added a single test for this. In many cases this output is difficult to test. Also, while developing this errors in the implementation of the new printf formats showed up as regressions. gdb/ChangeLog 2019-10-01 Tom Tromey <tom@tromey.com> * p-lang.c (pascal_printstr): Use metadata style. * value.c (show_convenience): Use metadata style. * valprint.c (valprint_check_validity, val_print_optimized_out) (val_print_not_saved, val_print_unavailable) (val_print_invalid_address, generic_val_print, val_print) (value_check_printable, val_print_array_elements): Use metadata style. * ui-out.h (class ui_out) <field_fmt>: New overload. <do_field_fmt>: Add style parameter. * ui-out.c (ui_out::field_fmt): New overload. * typeprint.c (type_print_unknown_return_type) (val_print_not_allocated, val_print_not_associated): Use metadata style. * tui/tui-out.h (class tui_ui_out) <do_field_fmt>: Add style parameter. * tui/tui-out.c (tui_ui_out::do_field_fmt): Update. * tracepoint.c (tvariables_info_1): Use metadata style. * stack.c (print_frame_arg, print_frame_info, print_frame) (info_frame_command_core): Use metadata style. * skip.c (info_skip_command): Use metadata style. * rust-lang.c (rust_print_enum): Use metadata style. * python/py-prettyprint.c (print_stack_unless_memory_error): Use metadata style. * python/py-framefilter.c (py_print_single_arg): Use metadata style. * printcmd.c (do_one_display, print_variable_and_value): Use metadata style. * p-valprint.c (pascal_val_print) (pascal_object_print_value_fields): Use metadata style. * p-typeprint.c (pascal_type_print_base): Use metadata style. * mi/mi-out.h (class mi_ui_out) <do_field_fmt>: Add style parameter. * mi/mi-out.c (mi_ui_out::do_field_fmt): Update. * m2-valprint.c (m2_print_long_set): Use metadata style. * m2-typeprint.c (m2_print_type): Use metadata style. * infcmd.c (print_return_value_1): Use metadata style. * gnu-v3-abi.c (print_one_vtable): Use metadata style. * f-valprint.c (info_common_command_for_block): Use metadata style. * f-typeprint.c (f_type_print_base): Use metadata style. * expprint.c (print_subexp_standard): Use metadata style. * cp-valprint.c (cp_print_value_fields): Use metadata style. * cli/cli-style.h (class cli_style_option): Add constructor. (metadata_style): Declare. * cli/cli-style.c (metadata_style): New global. (_initialize_cli_style): Register metadata style. * cli-out.h (class cli_ui_out) <do_field_fmt>: Add style parameter. * cli-out.c (cli_ui_out::do_field_fmt): Update. * c-typeprint.c (c_type_print_base_struct_union) (c_type_print_base_1): Use metadata style. * breakpoint.c (watchpoint_value_print) (print_one_breakpoint_location): Use metadata style. * break-catch-syscall.c (print_one_catch_syscall): Use metadata style. * break-catch-sig.c (signal_catchpoint_print_one): Use metadata style. * ada-valprint.c (val_print_packed_array_elements, printstr) (print_field_values, ada_val_print_ref, ada_val_print): Use metadata style. * ada-typeprint.c (print_array_type, ada_print_type): Use metadata style. * ada-tasks.c (print_ada_task_info, info_task): Use metadata style. * ada-lang.c (user_select_syms): Use metadata style. gdb/testsuite/ChangeLog 2019-10-01 Tom Tromey <tom@tromey.com> * lib/gdb-utils.exp (style): Handle "metadata" argument. * gdb.base/style.exp: Add metadata style test.
2019-04-30gdb/fortran: Introduce fortran-operator.def fileAndrew Burgess1-1/+0
Future commits will add more Fortran specific expression operators. In preparation for these new operators, this commit adds a new fortran-operator.def file similar to how GDB already has ada-operator.def. I've moved UNOP_KIND the Fortran specific operator I introduced in commit 4d00f5d8f6c4 into this file, and renamed it to make it clearer that the operator is Fortran specific. I've then updated the Fortran exp_descriptor table (exp_descriptor_f) to use entirely Fortran specific functions that now handle UNOP_FORTRAN_KIND (the new name for UNOP_KIND). There should be no visible changes for standard users after this commit, though for developers, the output when 'set debug expression 1' is now better, before: (gdb) p kind (l1) Dump of expression @ 0x2ccc7a0, before conversion to prefix form: Language fortran, 5 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_VAR_VALUE 42 *............... 1 OP_NULL 47730176 .N.............. 2 BINOP_INTDIV 47729184 J.............. 3 OP_VAR_VALUE 42 *............... 4 UNOP_KIND 78 N............... Dump of expression @ 0x2ccc7a0, after conversion to prefix form: Expression: `Invalid expression (gdb) and after: (gdb) p kind (l1) Dump of expression @ 0x294d0b0, before conversion to prefix form: Language fortran, 5 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_VAR_VALUE 40 (............... 1 unknown opcode: 224 44088544 ................ 2 unknown opcode: 208 44087504 ................ 3 OP_VAR_VALUE 40 (............... 4 UNOP_FORTRAN_KIND 119 w............... Dump of expression @ 0x294d0b0, after conversion to prefix form: Expression: `KIND(test::l1)' Language fortran, 5 elements, 16 bytes each. 0 UNOP_FORTRAN_KIND 1 OP_VAR_VALUE Block @0x2a0bce0, symbol @0x2a0b8d0 (l1) $1 = 1 (gdb) gdb/ChangeLog: * gdb/expprint.c (dump_subexp_body_standard): Remove use of UNOP_KIND. * gdb/expression.h (exp_opcode): Include 'fortran-operator.def'. * gdb/f-exp.y (exp): Rename UNOP_KIND to UNOP_FORTRAN_KIND. * gdb/f-lang.c (evaluate_subexp_f): Likewise. (operator_length_f): New fuction. (print_subexp_f): New function. (op_name_f): New function. (dump_subexp_body_f): New function. (operator_check_f): New function. (exp_descriptor_f): Replace standard expression handling functions with new functions. * gdb/fortran-operator.def: New file. * gdb/parse.c (operator_length_standard): Remove use of UNOP_KIND. * gdb/std-operator.def: Remove UNOP_KIND.
2019-04-06Revert the header-sorting patchTom Tromey1-11/+8
Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-05Sort includes for files gdb/[a-f]*.[chyl].Tom Tromey1-8/+11
This patch sorts the include files for the files [a-f]*.[chyl]. The patch was written by a script. Tested by the buildbot. I will follow up with patches to sort the remaining files, by sorting a subset, testing them, and then checking them in. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> * ft32-tdep.c: Sort headers. * frv-tdep.c: Sort headers. * frv-linux-tdep.c: Sort headers. * frame.c: Sort headers. * frame-unwind.c: Sort headers. * frame-base.c: Sort headers. * fork-child.c: Sort headers. * findvar.c: Sort headers. * findcmd.c: Sort headers. * filesystem.c: Sort headers. * filename-seen-cache.h: Sort headers. * filename-seen-cache.c: Sort headers. * fbsd-tdep.c: Sort headers. * fbsd-nat.h: Sort headers. * fbsd-nat.c: Sort headers. * f-valprint.c: Sort headers. * f-typeprint.c: Sort headers. * f-lang.c: Sort headers. * extension.h: Sort headers. * extension.c: Sort headers. * extension-priv.h: Sort headers. * expprint.c: Sort headers. * exec.h: Sort headers. * exec.c: Sort headers. * exceptions.c: Sort headers. * event-top.c: Sort headers. * event-loop.c: Sort headers. * eval.c: Sort headers. * elfread.c: Sort headers. * dwarf2read.h: Sort headers. * dwarf2read.c: Sort headers. * dwarf2loc.c: Sort headers. * dwarf2expr.h: Sort headers. * dwarf2expr.c: Sort headers. * dwarf2-frame.c: Sort headers. * dwarf2-frame-tailcall.c: Sort headers. * dwarf-index-write.h: Sort headers. * dwarf-index-write.c: Sort headers. * dwarf-index-common.c: Sort headers. * dwarf-index-cache.h: Sort headers. * dwarf-index-cache.c: Sort headers. * dummy-frame.c: Sort headers. * dtrace-probe.c: Sort headers. * disasm.h: Sort headers. * disasm.c: Sort headers. * disasm-selftests.c: Sort headers. * dictionary.c: Sort headers. * dicos-tdep.c: Sort headers. * demangle.c: Sort headers. * dcache.h: Sort headers. * dcache.c: Sort headers. * darwin-nat.h: Sort headers. * darwin-nat.c: Sort headers. * darwin-nat-info.c: Sort headers. * d-valprint.c: Sort headers. * d-namespace.c: Sort headers. * d-lang.c: Sort headers. * ctf.c: Sort headers. * csky-tdep.c: Sort headers. * csky-linux-tdep.c: Sort headers. * cris-tdep.c: Sort headers. * cris-linux-tdep.c: Sort headers. * cp-valprint.c: Sort headers. * cp-support.c: Sort headers. * cp-namespace.c: Sort headers. * cp-abi.c: Sort headers. * corelow.c: Sort headers. * corefile.c: Sort headers. * continuations.c: Sort headers. * completer.h: Sort headers. * completer.c: Sort headers. * complaints.c: Sort headers. * coffread.c: Sort headers. * coff-pe-read.c: Sort headers. * cli-out.h: Sort headers. * cli-out.c: Sort headers. * charset.c: Sort headers. * c-varobj.c: Sort headers. * c-valprint.c: Sort headers. * c-typeprint.c: Sort headers. * c-lang.c: Sort headers. * buildsym.c: Sort headers. * buildsym-legacy.c: Sort headers. * build-id.h: Sort headers. * build-id.c: Sort headers. * btrace.c: Sort headers. * bsd-uthread.c: Sort headers. * breakpoint.h: Sort headers. * breakpoint.c: Sort headers. * break-catch-throw.c: Sort headers. * break-catch-syscall.c: Sort headers. * break-catch-sig.c: Sort headers. * blockframe.c: Sort headers. * block.c: Sort headers. * bfin-tdep.c: Sort headers. * bfin-linux-tdep.c: Sort headers. * bfd-target.c: Sort headers. * bcache.c: Sort headers. * ax-general.c: Sort headers. * ax-gdb.h: Sort headers. * ax-gdb.c: Sort headers. * avr-tdep.c: Sort headers. * auxv.c: Sort headers. * auto-load.c: Sort headers. * arm-wince-tdep.c: Sort headers. * arm-tdep.c: Sort headers. * arm-symbian-tdep.c: Sort headers. * arm-pikeos-tdep.c: Sort headers. * arm-obsd-tdep.c: Sort headers. * arm-nbsd-tdep.c: Sort headers. * arm-nbsd-nat.c: Sort headers. * arm-linux-tdep.c: Sort headers. * arm-linux-nat.c: Sort headers. * arm-fbsd-tdep.c: Sort headers. * arm-fbsd-nat.c: Sort headers. * arm-bsd-tdep.c: Sort headers. * arch-utils.c: Sort headers. * arc-tdep.c: Sort headers. * arc-newlib-tdep.c: Sort headers. * annotate.h: Sort headers. * annotate.c: Sort headers. * amd64-windows-tdep.c: Sort headers. * amd64-windows-nat.c: Sort headers. * amd64-tdep.c: Sort headers. * amd64-sol2-tdep.c: Sort headers. * amd64-obsd-tdep.c: Sort headers. * amd64-obsd-nat.c: Sort headers. * amd64-nbsd-tdep.c: Sort headers. * amd64-nbsd-nat.c: Sort headers. * amd64-nat.c: Sort headers. * amd64-linux-tdep.c: Sort headers. * amd64-linux-nat.c: Sort headers. * amd64-fbsd-tdep.c: Sort headers. * amd64-fbsd-nat.c: Sort headers. * amd64-dicos-tdep.c: Sort headers. * amd64-darwin-tdep.c: Sort headers. * amd64-bsd-nat.c: Sort headers. * alpha-tdep.c: Sort headers. * alpha-obsd-tdep.c: Sort headers. * alpha-nbsd-tdep.c: Sort headers. * alpha-mdebug-tdep.c: Sort headers. * alpha-linux-tdep.c: Sort headers. * alpha-linux-nat.c: Sort headers. * alpha-bsd-tdep.c: Sort headers. * alpha-bsd-nat.c: Sort headers. * aix-thread.c: Sort headers. * agent.c: Sort headers. * addrmap.c: Sort headers. * ada-varobj.c: Sort headers. * ada-valprint.c: Sort headers. * ada-typeprint.c: Sort headers. * ada-tasks.c: Sort headers. * ada-lang.c: Sort headers. * aarch64-tdep.c: Sort headers. * aarch64-ravenscar-thread.c: Sort headers. * aarch64-newlib-tdep.c: Sort headers. * aarch64-linux-tdep.c: Sort headers. * aarch64-linux-nat.c: Sort headers. * aarch64-fbsd-tdep.c: Sort headers. * aarch64-fbsd-nat.c: Sort headers. * aarch32-linux-nat.c: Sort headers.
2019-03-06gdb/fortran: Add Fortran 'kind' intrinsic and keywordAndrew Burgess1-0/+1
The 'kind' keyword has two uses in Fortran, it is the name of a builtin intrinsic function, and it is also a keyword used to create a type of a specific kind. This commit adds support for using kind as an intrinsic function, and also adds some initial support for using kind to create types of a specific kind. This commit only allows the creation of the type 'character(kind=1)', however, it will be easy enough to extend this in future to support more type kinds. The kind of any expression can be queried using the kind intrinsic function. At the moment the kind returned corresponds to the size of the type, this matches how gfortran handles kinds. However, the correspondence between kind and type size depends on the compiler and/or the specific target, so this might not be correct for everyone. If we want to support different compilers/targets in future the code to compute the kind from a type will need to be updated. gdb/ChangeLog: * expprint.c (dump_subexp_body_standard): Support UNOP_KIND. * f-exp.y: Define 'KIND' token. (exp): New pattern for KIND expressions. (ptype): Handle types with a kind extension. (direct_abs_decl): Extend to spot kind extensions. (f77_keywords): Add 'kind' to the list. (push_kind_type): New function. (convert_to_kind_type): New function. * f-lang.c (evaluate_subexp_f): Support UNOP_KIND. * parse.c (operator_length_standard): Likewise. * parser-defs.h (enum type_pieces): Add tp_kind. * std-operator.def: Add UNOP_KIND. gdb/testsuite/ChangeLog: * gdb.fortran/intrinsics.exp: New file. * gdb.fortran/intrinsics.f90: New file. * gdb.fortran/type-kinds.exp: New file.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-10-03Avoid undefined behavior in expression dumpingTom Tromey1-0/+7
-fsanitize=undefined pointed out undefined behavior in dump_raw_expression like: runtime error: load of value 2887952, which is not a valid value for type 'exp_opcode' dump_raw_expression will try to print the opcode for each element of the expression, even when it is not valid. To allow this, but have it avoid undefined behavior, this patch sets the underlying type of enum exp_opcode, and arranges for op_name to handle invalid opcodes more nicely. Before this patch, debug-expr.exp shows: Dump of expression @ 0x60f000007750, before conversion to prefix form: Language c, 8 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_TYPE 89 Y............... <unknown 3851920> 107820862850704 ..:..b.......... 2 OP_TYPE 89 Y............... 3 OP_VAR_VALUE 40 (............... 4 <unknown 2807568> 107820861806352 ..*..b.......... 5 <unknown 2806368> 107820861805152 `.*..b.......... 6 OP_VAR_VALUE 40 (............... 7 UNOP_MEMVAL_TYPE 57 9............... Afterward, the output is: Dump of expression @ 0x4820f90, before conversion to prefix form: Language c, 8 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_TYPE 89 Y............... 1 unknown opcode: 176 75444400 .0.............. 2 OP_TYPE 89 Y............... 3 OP_VAR_VALUE 40 (............... 4 OP_BOOL 74616912 P.r............. 5 unknown opcode: 128 74615680 ..r............. 6 OP_VAR_VALUE 40 (............... 7 UNOP_MEMVAL_TYPE 57 9............... gdb/ChangeLog 2018-10-03 Tom Tromey <tom@tromey.com> * expression.h (enum exp_opcode): Use uint8_t as base type. * expprint.c (op_name): Handle invalid opcodes.
2018-06-01Remove type_name_no_tag and rename type_name_no_tag_or_errorTom Tromey1-1/+1
type_name_no_tag is just a plain wrapper for TYPE_NAME now, so this patch removes it. And, because tag names no longer exist, this renames type_name_no_tag_or_error to type_name_or_error. gdb/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * valops.c (value_cast_structs, destructor_name_p): Update. * symtab.c (gdb_mangle_name): Update. * stabsread.c (define_symbol, read_cpp_abbrev, read_baseclasses): Update. * p-valprint.c (pascal_object_is_vtbl_ptr_type) (pascal_object_print_value_fields, pascal_object_print_value): Update. * p-typeprint.c (pascal_type_print_derivation_info): Update. * linespec.c (find_methods): Update. * gdbtypes.h (type_name_no_tag): Remove. (type_name_or_error): Rename from type_name_no_tag_or_error. * gdbtypes.c (type_name_no_tag): Remove. (type_name_or_error): Rename from type_name_no_tag_or_error. (lookup_struct_elt_type, check_typedef): Update. * expprint.c (print_subexp_standard): Update. * dwarf2read.c (dwarf2_add_field, load_partial_dies): Update. * d-namespace.c (d_lookup_nested_symbol): Update. * cp-valprint.c (cp_is_vtbl_ptr_type, cp_print_value_fields) (cp_print_class_member): Update. * cp-namespace.c (cp_lookup_nested_symbol): Update. * completer.c (add_struct_fields): Update. * c-typeprint.c (cp_type_print_derivation_info) (c_type_print_varspec_prefix, c_type_print_base_struct_union): Update. * ada-lang.c (parse_old_style_renaming, xget_renaming_scope) (ada_prefer_type, ada_is_exception_sym): Update.
2018-04-30Handle alignof and _AlignofTom Tromey1-0/+1
This adds alignof and _Alignof to the C/C++ expression parser, and adds new tests to test the features. The tests are written to try to ensure that gdb's knowledge of alignment rules stays in sync with the compiler's. 2018-04-30 Tom Tromey <tom@tromey.com> PR exp/17095: * NEWS: Update. * std-operator.def (UNOP_ALIGNOF): New operator. * expprint.c (dump_subexp_body_standard) <case UNOP_ALIGNOF>: New. * eval.c (evaluate_subexp_standard) <case UNOP_ALIGNOF>: New. * c-lang.c (c_op_print_tab): Add alignof. * c-exp.y (ALIGNOF): New token. (exp): Add "ALIGNOF" production. (ident_tokens): Add _Alignof and alignof. 2018-04-30 Tom Tromey <tom@tromey.com> PR exp/17095: * gdb.dwarf2/dw2-align.exp: New file. * gdb.cp/align.exp: New file. * gdb.base/align.exp: New file. * lib/gdb.exp (gdb_int128_helper): New proc. (has_int128_c, has_int128_cxx): New caching procs.