aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
AgeCommit message (Collapse)AuthorFilesLines
2021-03-08Split out eval_op_predecTom Tromey1-21/+32
This splits UNOP_PREDECREMENT into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_predec): New file. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_preincTom Tromey1-21/+32
This splits UNOP_PREINCREMENT into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_preinc): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_memvalTom Tromey1-13/+18
This splits UNOP_MEMVAL into a new function for future use. This new function is also used to hande UNOP_MEMVAL_TYPE. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_memval): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_alignofTom Tromey1-10/+18
This splits UNOP_ALIGNOF into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_alignof): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_indTom Tromey1-45/+55
This splits UNOP_IND into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_ind): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_lognotTom Tromey1-9/+20
This splits UNOP_LOGICAL_NOT into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_lognot): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_complementTom Tromey1-9/+19
This splits UNOP_COMPLEMENT into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_complement): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_negTom Tromey1-9/+19
This splits UNOP NEG into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_neg): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_plusTom Tromey1-9/+19
This splits UNOP_PLUS into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_plus): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_repeatTom Tromey1-13/+23
This splits BINOP_REPEAT into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_repeat): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_leqTom Tromey1-13/+24
This splits BINOP_LEQ into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_leq): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_geqTom Tromey1-13/+24
This splits BINOP_GEQ into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_geq): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_gtrTom Tromey1-13/+24
This splits BINOP_GTR into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_gtr): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_lessTom Tromey1-13/+24
This splits BINOP_LESS into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_less): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_notequalTom Tromey1-13/+24
This splits BINOP_NOTEQUAL into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_notequal): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_equalTom Tromey1-13/+24
This splits BINOP_EQUAL into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_equal): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_subscriptTom Tromey1-26/+37
This splits BINOP_SUBSCRIPT into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_subscript): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_binaryTom Tromey1-38/+48
This splits out a new eval_op_binary helper function. This function can handle several different binary operations: case BINOP_EXP: case BINOP_MUL: case BINOP_DIV: case BINOP_INTDIV: case BINOP_REM: case BINOP_MOD: case BINOP_LSH: case BINOP_RSH: case BINOP_BITWISE_AND: case BINOP_BITWISE_IOR: case BINOP_BITWISE_XOR: gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_binary): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_subTom Tromey1-19/+29
This splits BINOP_SUB into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_sub): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_addTom Tromey1-15/+25
This splits BINOP_ADD into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_add): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_memberTom Tromey1-32/+44
This splits STRUCTOP_MEMBER into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_member): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_structop_ptrTom Tromey1-50/+61
This splits STRUCTOP_PTR into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_structop_ptr): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_structop_structTom Tromey1-7/+18
This splits STRUCTOP_STRUCT into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_structop_struct): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_ternopTom Tromey1-7/+17
This splits TERNOP_SLICE into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_ternop): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_concatTom Tromey1-6/+16
This splits BINOP_CONCAT into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_concat): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_objc_selectorTom Tromey1-7/+16
This splits OP_OBJC_SELECTOR into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_objc_selector): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_stringTom Tromey1-4/+15
This splits OP_STRING into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_string): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_registerTom Tromey1-21/+31
This splits OP_REGISTER into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_register): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_func_static_varTom Tromey1-10/+19
This splits OP_FUNC_STATIC_VAR into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_func_static_var): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_var_msym_valueTom Tromey1-9/+19
This splits OP_VAR_MSYM_VALUE into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_var_msym_value): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_var_entry_valueTom Tromey1-13/+21
This splits OP_VAR_ENTRY_VALUE into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_var_entry_value): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out eval_op_scopeTom Tromey1-8/+19
This splits OP_SCOPE into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_scope): New function. (evaluate_subexp_standard): Use it.
2021-02-24gdb: call value_ind for pointers to dynamic types in UNOP_IND evaluationAndrew Burgess1-13/+23
When evaluating and expression containing UNOP_IND in mode EVAL_AVOID_SIDE_EFFECTS, GDB currently (mostly) returns the result of a call to value_zero meaning we get back an object with the correct type, but its contents are all zero. If the target type contains fields with dynamic type then in order to resolve these dynamic fields GDB will need to read the value of the field from within the parent object. In this case the field value will be zero as a result of the call to value_zero mentioned above. The idea behind EVAL_AVOID_SIDE_EFFECTS is to avoid the chance that doing something like `ptype` will modify state within the target, for example consider: ptype i++. However, there is already precedence within GDB that sometimes, in order to get accurate type results, we can't avoid reading from the target, even when EVAL_AVOID_SIDE_EFFECTS is in effect. For example I would point to eval.c:evaluate_var_value, the handling of OP_REGISTER, the handling of value_x_unop in many places. I believe the Ada expression evaluator also ignore EVAL_AVOID_SIDE_EFFECTS in some cases. I am therefor proposing that, in the case where a pointer points at a dynamic type, we allow UNOP_IND to perform the actual indirection. This allows accurate types to be displayed in more cases. gdb/ChangeLog: * eval.c (evaluate_subexp_standard): Call value_ind for points to dynamic types in UNOP_IND. gdb/testsuite/ChangeLog: * gdb.fortran/pointer-to-pointer.exp: Additional tests.
2021-02-18Introduce expression::evaluateTom Tromey1-22/+25
This introduces a new method, expression::evaluate, and changes the top-level expression-evaluation functions to use it. Stack temporary handling is moved into this new method, which makes sense because that handling was only done when "*pos == 0". This patch avoids some temporary regressions related to stack temporary in the larger expression rewrite series. I've pulled it out separately because it seems like a reasonable change in its own right, and because it's better to avoid making that series even longer. Regression tested on x86-64 Fedora 32. gdb/ChangeLog 2021-02-18 Tom Tromey <tom@tromey.com> * expression.h (struct expression) <evaluate>: Declare method. * eval.c (evaluate_subexp): Simplify. (expression::evaluate): New method. (evaluate_expression, evaluate_type): Use expression::evaluate.
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-27Simplify MULTI_SUBSCRIPT implementationTom Tromey1-29/+7
The MULTI_SUBSCRIPT code in evaluate_subexp_standard has a comment saying that perhaps the EVAL_SKIP handling is incorrect. This patch simplifies this code. In particular, it precomputes all the indices in a separate loop and removes some complicated flow-control. Tested using the gdb.modula2 and gdb.dlang test suites, as these are the only parsers that emit MULTI_SUBSCRIPT. gdb/ChangeLog 2020-12-27 Tom Tromey <tom@tromey.com> * eval.c (evaluate_subexp_standard) <case MULTI_SUBSCRIPT>: Simplify.
2020-12-24gdb: avoid resolving dynamic properties for non-allocated arraysAndrew Burgess1-4/+8
In PR gdb/27059 an issue was discovered where GDB would sometimes trigger undefined behaviour in the form of signed integer overflow. The problem here is that GDB was reading random garbage from the inferior memory space, assuming this data was valid, and performing arithmetic on it. This bug raises an interesting general problem with GDB's DWARF expression evaluator, which is this: We currently assume that the DWARF expressions being evaluated are well formed, and well behaving. As an example, this is the expression that the bug was running into problems on, this was used as the expression for a DW_AT_byte_stride of a DW_TAG_subrange_type: DW_OP_push_object_address; DW_OP_plus_uconst: 88; DW_OP_deref; DW_OP_push_object_address; DW_OP_plus_uconst: 32; DW_OP_deref; DW_OP_mul Two values are read from the inferior and multiplied together. GDB should not assume that any value read from the inferior is in any way sane, as such the implementation of DW_OP_mul should be guarding against overflow and doing something semi-sane here. However, it turns out that the original bug PR gdb/27059, is hitting a more specific case, which doesn't require changes to the DWARF expression evaluator, so I'm going to leave the above issue for another day. In the test mentioned in the bug GDB is actually trying to resolve the dynamic type of a Fortran array that is NOT allocated. A non-allocated Fortran array is one that does not have any data allocated for it yet, and even the upper and lower bounds of the array are not yet known. It turns out that, at least for gfortran compiled code, the data fields that describe the byte-stride are not initialised until the array is allocated. This leads me to the following conclusion: GDB should not try to resolve the bounds, or stride information for an array that is not allocated (or not associated, a similar, but slightly different Fortran feature). Instead, each of these properties should be set to undefined if the array is not allocated (or associated). That is what this commit does. There's a new flag that is passed around during the dynamic array resolution. When this flag is true the dynamic properties are resolved using the DWARF expressions as they currently are, but when this flag is false the expressions are not evaluated, and instead the properties are set to undefined. gdb/ChangeLog: PR gdb/27059 * eval.c (evaluate_subexp_for_sizeof): Handle not allocated and not associated arrays. * f-lang.c (fortran_adjust_dynamic_array_base_address_hack): Don't adjust arrays that are not allocated/associated. * gdbtypes.c (resolve_dynamic_range): Update header comment. Add new parameter which is used to sometimes set dynamic properties to undefined. (resolve_dynamic_array_or_string): Update header comment. Add new parameter which is used to guard evaluating dynamic properties. Resolve allocated/associated properties first. gdb/testsuite/ChangeLog: PR gdb/27059 * gdb.dwarf2/dyn-type-unallocated.c: New file. * gdb.dwarf2/dyn-type-unallocated.exp: New file.
2020-12-15Add expected type parameter to evaluate_expressionTom Tromey1-5/+3
While working on the expression rewrite, I found a few spots that called the internal functions of the expression evaluator, just to pass in an expected type. This patch adds a parameter to evaluate_expression so that these functions can avoid this dependency. Regression tested on x86-64 Fedora 28. gdb/ChangeLog 2020-12-15 Tom Tromey <tom@tromey.com> * stap-probe.c (stap_probe::evaluate_argument): Use evaluate_expression. * dtrace-probe.c (dtrace_probe::evaluate_argument): Use evaluate_expression. * value.h (evaluate_expression): Add expect_type parameter. * objc-lang.c (print_object_command): Call evaluate_expression. * eval.c (evaluate_expression): Add expect_type parameter.
2020-12-15Introduce expression::first_opcodeTom Tromey1-1/+1
This adds a new helper method, expression::first_opcode, that extracts the outermost opcode of an expression. This simplifies some patches in the expression rewrite series. Note that this patch requires the earlier patch to avoid manual dissection of OP_TYPE operations. 2020-12-15 Tom Tromey <tom@tromey.com> * varobj.c (varobj_create): Use first_opcode. * value.c (init_if_undefined_command): Use first_opcode. * typeprint.c (whatis_exp): Use first_opcode. * tracepoint.c (validate_actionline): Use first_opcode. (encode_actions_1): Use first_opcode. * stack.c (return_command): Use first_opcode. * expression.h (struct expression) <first_opcode>: New method. * eval.c (parse_and_eval_type): Use first_opcode. * dtrace-probe.c (dtrace_process_dof_probe): Use first_opcode.
2020-12-15Clean up arguments to evaluate_subexp_do_callTom Tromey1-14/+12
I noticed hat evaluate_subexp_do_call takes an array of arguments and a count -- but, unlike the usual convention, the count does not include the first element. This patch changes this function to match call_function_by_hand -- passing the callee separately, and using an array_view for the arguments. This makes it simpler to understand. Regression tested on x86-64 Fedora 28. gdb/ChangeLog 2020-12-15 Tom Tromey <tom@tromey.com> * f-lang.c (evaluate_subexp_f): Update. * expression.h (evaluate_subexp_do_call): Update. * eval.c (evaluate_subexp_do_call): Add callee parameter. Replace nargs, argvec with array_view. (evaluate_funcall): Update.
2020-12-13Constify parse_and_eval_typeTom Tromey1-1/+1
I noticed that the argumen to parse_and_eval_type could be "const". This patch implements this change. I wonder if this could be removed. It's only called via check_stub_method_group, which seems questionable to me. However, I didn't look into doing this. gdb/ChangeLog 2020-12-13 Tom Tromey <tom@tromey.com> * gdbtypes.c (safe_parse_type): Make argument const. * value.h (parse_and_eval_type): Make argument const. * eval.c (parse_and_eval_type): Make argument const.
2020-12-09gdb: make get_discrete_bounds return boolSimon Marchi1-2/+2
get_discrete_bounds currently has three possible return values (see its current doc for details). It appears that for all callers, it would be sufficient to have a boolean "worked" / "didn't work" return value. Change the return type of get_discrete_bounds to bool and adjust all callers. Doing so simplifies the following patch. gdb/ChangeLog: * gdbtypes.h (get_discrete_bounds): Return bool, adjust all callers. * gdbtypes.c (get_discrete_bounds): Return bool. Change-Id: Ie51feee23c75f0cd7939742604282d745db59172
2020-11-30Remove some dead code from evaluate_subexp_standardTom Tromey1-57/+7
I noticed that in the OP_ARRAY case in evaluate_subexp_standard, "index_pc" is read but never set. This dead code then guards the only call to init_array_element, so this can be removed as well. gdb/ChangeLog 2020-11-30 Tom Tromey <tom@tromey.com> * eval.c (init_array_element): Remove. (evaluate_subexp_standard) <OP_ARRAY>: Remove "index_pc".
2020-11-25Remove two unnecessary variables from evaluate_subexp_standardTom Tromey1-9/+3
I noticed a couple of spots in evaluate_subexp_standard that looked like: value *result; result = something; return result; This patch simplifies these spots to a simple "return". gdb/ChangeLog 2020-11-25 Tom Tromey <tom@tromey.com> * eval.c (evaluate_subexp_standard): Remove unnecessary variables.
2020-11-19gdb: convert some function arguments from int to boolAndrew Burgess1-1/+1
A little int to bool conversion around the 'watch' type commands. There should be no user visible changes after this commit. gdb/ChangeLog: * breakpoint.c (update_watchpoint): Pass 'false' not '0'. (watch_command_1): Update parameter types. Convert locals to bool. (watch_command_wrapper): Change parameter type. (watch_maybe_just_location): Change locals to bool. (rwatch_command_wrapper): Update parameter type. (awatch_command_wrapper): Update parameter type. * breakpoint.h (watch_command_wrapper): Change parameter type. (rwatch_command_wrapper): Update parameter type. (awatch_command_wrapper): Update parameter type. * eval.c (fetch_subexp_value): Change parameter type. * ppc-linux-nat.c (ppc_linux_nat_target::check_condition): Pass 'false' not '0'. * value.h (fetch_subexp_value): Change parameter type in declaration.
2020-11-15Add support for fixed-point type arithmeticJoel Brobecker1-0/+3
This patch adds support for binary operations on fixed-point values, as well as for the negative unary operator. gdb/ChangeLog: * eval.c (binop_promote): Add fixed-point type handling. * valarith.c (fixed_point_binop): New function. (scalar_binop): Add fixed-point type handling. (value_neg): Add fixed-point type handling. * valops.c (value_cast_to_fixed_point): New function. (value_cast): Add fixed-point type handling. gdb/testsuite/ChangeLog: * gdb.dwarf2/dw2-fixed-point.exp: Add arithmetic tests.
2020-11-02gdb, gdbserver, gdbsupport: fix leading space vs tabs issuesSimon Marchi1-39/+39
Many spots incorrectly use only spaces for indentation (for example, there are a lot of spots in ada-lang.c). I've always found it awkward when I needed to edit one of these spots: do I keep the original wrong indentation, or do I fix it? What if the lines around it are also wrong, do I fix them too? I probably don't want to fix them in the same patch, to avoid adding noise to my patch. So I propose to fix as much as possible once and for all (hopefully). One typical counter argument for this is that it makes code archeology more difficult, because git-blame will show this commit as the last change for these lines. My counter counter argument is: when git-blaming, you often need to do "blame the file at the parent commit" anyway, to go past some other refactor that touched the line you are interested in, but is not the change you are looking for. So you already need a somewhat efficient way to do this. Using some interactive tool, rather than plain git-blame, makes this trivial. For example, I use "tig blame <file>", where going back past the commit that changed the currently selected line is one keystroke. It looks like Magit in Emacs does it too (though I've never used it). Web viewers of Github and Gitlab do it too. My point is that it won't really make archeology more difficult. The other typical counter argument is that it will cause conflicts with existing patches. That's true... but it's a one time cost, and those are not conflicts that are difficult to resolve. I have also tried "git rebase --ignore-whitespace", it seems to work well. Although that will re-introduce the faulty indentation, so one needs to take care of fixing the indentation in the patch after that (which is easy). gdb/ChangeLog: * aarch64-linux-tdep.c: Fix indentation. * aarch64-ravenscar-thread.c: Fix indentation. * aarch64-tdep.c: Fix indentation. * aarch64-tdep.h: Fix indentation. * ada-lang.c: Fix indentation. * ada-lang.h: Fix indentation. * ada-tasks.c: Fix indentation. * ada-typeprint.c: Fix indentation. * ada-valprint.c: Fix indentation. * ada-varobj.c: Fix indentation. * addrmap.c: Fix indentation. * addrmap.h: Fix indentation. * agent.c: Fix indentation. * aix-thread.c: Fix indentation. * alpha-bsd-nat.c: Fix indentation. * alpha-linux-tdep.c: Fix indentation. * alpha-mdebug-tdep.c: Fix indentation. * alpha-nbsd-tdep.c: Fix indentation. * alpha-obsd-tdep.c: Fix indentation. * alpha-tdep.c: Fix indentation. * amd64-bsd-nat.c: Fix indentation. * amd64-darwin-tdep.c: Fix indentation. * amd64-linux-nat.c: Fix indentation. * amd64-linux-tdep.c: Fix indentation. * amd64-nat.c: Fix indentation. * amd64-obsd-tdep.c: Fix indentation. * amd64-tdep.c: Fix indentation. * amd64-windows-tdep.c: Fix indentation. * annotate.c: Fix indentation. * arc-tdep.c: Fix indentation. * arch-utils.c: Fix indentation. * arch/arm-get-next-pcs.c: Fix indentation. * arch/arm.c: Fix indentation. * arm-linux-nat.c: Fix indentation. * arm-linux-tdep.c: Fix indentation. * arm-nbsd-tdep.c: Fix indentation. * arm-pikeos-tdep.c: Fix indentation. * arm-tdep.c: Fix indentation. * arm-tdep.h: Fix indentation. * arm-wince-tdep.c: Fix indentation. * auto-load.c: Fix indentation. * auxv.c: Fix indentation. * avr-tdep.c: Fix indentation. * ax-gdb.c: Fix indentation. * ax-general.c: Fix indentation. * bfin-linux-tdep.c: Fix indentation. * block.c: Fix indentation. * block.h: Fix indentation. * blockframe.c: Fix indentation. * bpf-tdep.c: Fix indentation. * break-catch-sig.c: Fix indentation. * break-catch-syscall.c: Fix indentation. * break-catch-throw.c: Fix indentation. * breakpoint.c: Fix indentation. * breakpoint.h: Fix indentation. * bsd-uthread.c: Fix indentation. * btrace.c: Fix indentation. * build-id.c: Fix indentation. * buildsym-legacy.h: Fix indentation. * buildsym.c: Fix indentation. * c-typeprint.c: Fix indentation. * c-valprint.c: Fix indentation. * c-varobj.c: Fix indentation. * charset.c: Fix indentation. * cli/cli-cmds.c: Fix indentation. * cli/cli-decode.c: Fix indentation. * cli/cli-decode.h: Fix indentation. * cli/cli-script.c: Fix indentation. * cli/cli-setshow.c: Fix indentation. * coff-pe-read.c: Fix indentation. * coffread.c: Fix indentation. * compile/compile-cplus-types.c: Fix indentation. * compile/compile-object-load.c: Fix indentation. * compile/compile-object-run.c: Fix indentation. * completer.c: Fix indentation. * corefile.c: Fix indentation. * corelow.c: Fix indentation. * cp-abi.h: Fix indentation. * cp-namespace.c: Fix indentation. * cp-support.c: Fix indentation. * cp-valprint.c: Fix indentation. * cris-linux-tdep.c: Fix indentation. * cris-tdep.c: Fix indentation. * darwin-nat-info.c: Fix indentation. * darwin-nat.c: Fix indentation. * darwin-nat.h: Fix indentation. * dbxread.c: Fix indentation. * dcache.c: Fix indentation. * disasm.c: Fix indentation. * dtrace-probe.c: Fix indentation. * dwarf2/abbrev.c: Fix indentation. * dwarf2/attribute.c: Fix indentation. * dwarf2/expr.c: Fix indentation. * dwarf2/frame.c: Fix indentation. * dwarf2/index-cache.c: Fix indentation. * dwarf2/index-write.c: Fix indentation. * dwarf2/line-header.c: Fix indentation. * dwarf2/loc.c: Fix indentation. * dwarf2/macro.c: Fix indentation. * dwarf2/read.c: Fix indentation. * dwarf2/read.h: Fix indentation. * elfread.c: Fix indentation. * eval.c: Fix indentation. * event-top.c: Fix indentation. * exec.c: Fix indentation. * exec.h: Fix indentation. * expprint.c: Fix indentation. * f-lang.c: Fix indentation. * f-typeprint.c: Fix indentation. * f-valprint.c: Fix indentation. * fbsd-nat.c: Fix indentation. * fbsd-tdep.c: Fix indentation. * findvar.c: Fix indentation. * fork-child.c: Fix indentation. * frame-unwind.c: Fix indentation. * frame-unwind.h: Fix indentation. * frame.c: Fix indentation. * frv-linux-tdep.c: Fix indentation. * frv-tdep.c: Fix indentation. * frv-tdep.h: Fix indentation. * ft32-tdep.c: Fix indentation. * gcore.c: Fix indentation. * gdb_bfd.c: Fix indentation. * gdbarch.sh: Fix indentation. * gdbarch.c: Re-generate * gdbarch.h: Re-generate. * gdbcore.h: Fix indentation. * gdbthread.h: Fix indentation. * gdbtypes.c: Fix indentation. * gdbtypes.h: Fix indentation. * glibc-tdep.c: Fix indentation. * gnu-nat.c: Fix indentation. * gnu-nat.h: Fix indentation. * gnu-v2-abi.c: Fix indentation. * gnu-v3-abi.c: Fix indentation. * go32-nat.c: Fix indentation. * guile/guile-internal.h: Fix indentation. * guile/scm-cmd.c: Fix indentation. * guile/scm-frame.c: Fix indentation. * guile/scm-iterator.c: Fix indentation. * guile/scm-math.c: Fix indentation. * guile/scm-ports.c: Fix indentation. * guile/scm-pretty-print.c: Fix indentation. * guile/scm-value.c: Fix indentation. * h8300-tdep.c: Fix indentation. * hppa-linux-nat.c: Fix indentation. * hppa-linux-tdep.c: Fix indentation. * hppa-nbsd-nat.c: Fix indentation. * hppa-nbsd-tdep.c: Fix indentation. * hppa-obsd-nat.c: Fix indentation. * hppa-tdep.c: Fix indentation. * hppa-tdep.h: Fix indentation. * i386-bsd-nat.c: Fix indentation. * i386-darwin-nat.c: Fix indentation. * i386-darwin-tdep.c: Fix indentation. * i386-dicos-tdep.c: Fix indentation. * i386-gnu-nat.c: Fix indentation. * i386-linux-nat.c: Fix indentation. * i386-linux-tdep.c: Fix indentation. * i386-nto-tdep.c: Fix indentation. * i386-obsd-tdep.c: Fix indentation. * i386-sol2-nat.c: Fix indentation. * i386-tdep.c: Fix indentation. * i386-tdep.h: Fix indentation. * i386-windows-tdep.c: Fix indentation. * i387-tdep.c: Fix indentation. * i387-tdep.h: Fix indentation. * ia64-libunwind-tdep.c: Fix indentation. * ia64-libunwind-tdep.h: Fix indentation. * ia64-linux-nat.c: Fix indentation. * ia64-linux-tdep.c: Fix indentation. * ia64-tdep.c: Fix indentation. * ia64-tdep.h: Fix indentation. * ia64-vms-tdep.c: Fix indentation. * infcall.c: Fix indentation. * infcmd.c: Fix indentation. * inferior.c: Fix indentation. * infrun.c: Fix indentation. * iq2000-tdep.c: Fix indentation. * language.c: Fix indentation. * linespec.c: Fix indentation. * linux-fork.c: Fix indentation. * linux-nat.c: Fix indentation. * linux-tdep.c: Fix indentation. * linux-thread-db.c: Fix indentation. * lm32-tdep.c: Fix indentation. * m2-lang.c: Fix indentation. * m2-typeprint.c: Fix indentation. * m2-valprint.c: Fix indentation. * m32c-tdep.c: Fix indentation. * m32r-linux-tdep.c: Fix indentation. * m32r-tdep.c: Fix indentation. * m68hc11-tdep.c: Fix indentation. * m68k-bsd-nat.c: Fix indentation. * m68k-linux-nat.c: Fix indentation. * m68k-linux-tdep.c: Fix indentation. * m68k-tdep.c: Fix indentation. * machoread.c: Fix indentation. * macrocmd.c: Fix indentation. * macroexp.c: Fix indentation. * macroscope.c: Fix indentation. * macrotab.c: Fix indentation. * macrotab.h: Fix indentation. * main.c: Fix indentation. * mdebugread.c: Fix indentation. * mep-tdep.c: Fix indentation. * mi/mi-cmd-catch.c: Fix indentation. * mi/mi-cmd-disas.c: Fix indentation. * mi/mi-cmd-env.c: Fix indentation. * mi/mi-cmd-stack.c: Fix indentation. * mi/mi-cmd-var.c: Fix indentation. * mi/mi-cmds.c: Fix indentation. * mi/mi-main.c: Fix indentation. * mi/mi-parse.c: Fix indentation. * microblaze-tdep.c: Fix indentation. * minidebug.c: Fix indentation. * minsyms.c: Fix indentation. * mips-linux-nat.c: Fix indentation. * mips-linux-tdep.c: Fix indentation. * mips-nbsd-tdep.c: Fix indentation. * mips-tdep.c: Fix indentation. * mn10300-linux-tdep.c: Fix indentation. * mn10300-tdep.c: Fix indentation. * moxie-tdep.c: Fix indentation. * msp430-tdep.c: Fix indentation. * namespace.h: Fix indentation. * nat/fork-inferior.c: Fix indentation. * nat/gdb_ptrace.h: Fix indentation. * nat/linux-namespaces.c: Fix indentation. * nat/linux-osdata.c: Fix indentation. * nat/netbsd-nat.c: Fix indentation. * nat/x86-dregs.c: Fix indentation. * nbsd-nat.c: Fix indentation. * nbsd-tdep.c: Fix indentation. * nios2-linux-tdep.c: Fix indentation. * nios2-tdep.c: Fix indentation. * nto-procfs.c: Fix indentation. * nto-tdep.c: Fix indentation. * objfiles.c: Fix indentation. * objfiles.h: Fix indentation. * opencl-lang.c: Fix indentation. * or1k-tdep.c: Fix indentation. * osabi.c: Fix indentation. * osabi.h: Fix indentation. * osdata.c: Fix indentation. * p-lang.c: Fix indentation. * p-typeprint.c: Fix indentation. * p-valprint.c: Fix indentation. * parse.c: Fix indentation. * ppc-linux-nat.c: Fix indentation. * ppc-linux-tdep.c: Fix indentation. * ppc-nbsd-nat.c: Fix indentation. * ppc-nbsd-tdep.c: Fix indentation. * ppc-obsd-nat.c: Fix indentation. * ppc-ravenscar-thread.c: Fix indentation. * ppc-sysv-tdep.c: Fix indentation. * ppc64-tdep.c: Fix indentation. * printcmd.c: Fix indentation. * proc-api.c: Fix indentation. * producer.c: Fix indentation. * producer.h: Fix indentation. * prologue-value.c: Fix indentation. * prologue-value.h: Fix indentation. * psymtab.c: Fix indentation. * python/py-arch.c: Fix indentation. * python/py-bpevent.c: Fix indentation. * python/py-event.c: Fix indentation. * python/py-event.h: Fix indentation. * python/py-finishbreakpoint.c: Fix indentation. * python/py-frame.c: Fix indentation. * python/py-framefilter.c: Fix indentation. * python/py-inferior.c: Fix indentation. * python/py-infthread.c: Fix indentation. * python/py-objfile.c: Fix indentation. * python/py-prettyprint.c: Fix indentation. * python/py-registers.c: Fix indentation. * python/py-signalevent.c: Fix indentation. * python/py-stopevent.c: Fix indentation. * python/py-stopevent.h: Fix indentation. * python/py-threadevent.c: Fix indentation. * python/py-tui.c: Fix indentation. * python/py-unwind.c: Fix indentation. * python/py-value.c: Fix indentation. * python/py-xmethods.c: Fix indentation. * python/python-internal.h: Fix indentation. * python/python.c: Fix indentation. * ravenscar-thread.c: Fix indentation. * record-btrace.c: Fix indentation. * record-full.c: Fix indentation. * record.c: Fix indentation. * reggroups.c: Fix indentation. * regset.h: Fix indentation. * remote-fileio.c: Fix indentation. * remote.c: Fix indentation. * reverse.c: Fix indentation. * riscv-linux-tdep.c: Fix indentation. * riscv-ravenscar-thread.c: Fix indentation. * riscv-tdep.c: Fix indentation. * rl78-tdep.c: Fix indentation. * rs6000-aix-tdep.c: Fix indentation. * rs6000-lynx178-tdep.c: Fix indentation. * rs6000-nat.c: Fix indentation. * rs6000-tdep.c: Fix indentation. * rust-lang.c: Fix indentation. * rx-tdep.c: Fix indentation. * s12z-tdep.c: Fix indentation. * s390-linux-tdep.c: Fix indentation. * score-tdep.c: Fix indentation. * ser-base.c: Fix indentation. * ser-mingw.c: Fix indentation. * ser-uds.c: Fix indentation. * ser-unix.c: Fix indentation. * serial.c: Fix indentation. * sh-linux-tdep.c: Fix indentation. * sh-nbsd-tdep.c: Fix indentation. * sh-tdep.c: Fix indentation. * skip.c: Fix indentation. * sol-thread.c: Fix indentation. * solib-aix.c: Fix indentation. * solib-darwin.c: Fix indentation. * solib-frv.c: Fix indentation. * solib-svr4.c: Fix indentation. * solib.c: Fix indentation. * source.c: Fix indentation. * sparc-linux-tdep.c: Fix indentation. * sparc-nbsd-tdep.c: Fix indentation. * sparc-obsd-tdep.c: Fix indentation. * sparc-ravenscar-thread.c: Fix indentation. * sparc-tdep.c: Fix indentation. * sparc64-linux-tdep.c: Fix indentation. * sparc64-nbsd-tdep.c: Fix indentation. * sparc64-obsd-tdep.c: Fix indentation. * sparc64-tdep.c: Fix indentation. * stabsread.c: Fix indentation. * stack.c: Fix indentation. * stap-probe.c: Fix indentation. * stubs/ia64vms-stub.c: Fix indentation. * stubs/m32r-stub.c: Fix indentation. * stubs/m68k-stub.c: Fix indentation. * stubs/sh-stub.c: Fix indentation. * stubs/sparc-stub.c: Fix indentation. * symfile-mem.c: Fix indentation. * symfile.c: Fix indentation. * symfile.h: Fix indentation. * symmisc.c: Fix indentation. * symtab.c: Fix indentation. * symtab.h: Fix indentation. * target-float.c: Fix indentation. * target.c: Fix indentation. * target.h: Fix indentation. * tic6x-tdep.c: Fix indentation. * tilegx-linux-tdep.c: Fix indentation. * tilegx-tdep.c: Fix indentation. * top.c: Fix indentation. * tracefile-tfile.c: Fix indentation. * tracepoint.c: Fix indentation. * tui/tui-disasm.c: Fix indentation. * tui/tui-io.c: Fix indentation. * tui/tui-regs.c: Fix indentation. * tui/tui-stack.c: Fix indentation. * tui/tui-win.c: Fix indentation. * tui/tui-winsource.c: Fix indentation. * tui/tui.c: Fix indentation. * typeprint.c: Fix indentation. * ui-out.h: Fix indentation. * unittests/copy_bitwise-selftests.c: Fix indentation. * unittests/memory-map-selftests.c: Fix indentation. * utils.c: Fix indentation. * v850-tdep.c: Fix indentation. * valarith.c: Fix indentation. * valops.c: Fix indentation. * valprint.c: Fix indentation. * valprint.h: Fix indentation. * value.c: Fix indentation. * value.h: Fix indentation. * varobj.c: Fix indentation. * vax-tdep.c: Fix indentation. * windows-nat.c: Fix indentation. * windows-tdep.c: Fix indentation. * xcoffread.c: Fix indentation. * xml-syscall.c: Fix indentation. * xml-tdesc.c: Fix indentation. * xstormy16-tdep.c: Fix indentation. * xtensa-config.c: Fix indentation. * xtensa-linux-nat.c: Fix indentation. * xtensa-linux-tdep.c: Fix indentation. * xtensa-tdep.c: Fix indentation. gdbserver/ChangeLog: * ax.cc: Fix indentation. * dll.cc: Fix indentation. * inferiors.h: Fix indentation. * linux-low.cc: Fix indentation. * linux-nios2-low.cc: Fix indentation. * linux-ppc-ipa.cc: Fix indentation. * linux-ppc-low.cc: Fix indentation. * linux-x86-low.cc: Fix indentation. * linux-xtensa-low.cc: Fix indentation. * regcache.cc: Fix indentation. * server.cc: Fix indentation. * tracepoint.cc: Fix indentation. gdbsupport/ChangeLog: * common-exceptions.h: Fix indentation. * event-loop.cc: Fix indentation. * fileio.cc: Fix indentation. * filestuff.cc: Fix indentation. * gdb-dlfcn.cc: Fix indentation. * gdb_string_view.h: Fix indentation. * job-control.cc: Fix indentation. * signals.cc: Fix indentation. Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-09-28Remove target_has_execution macroTom Tromey1-1/+1
This removes the object-like macro target_has_execution, replacing it with a function call. target_has_execution_current is also now handled by this function. gdb/ChangeLog 2020-09-28 Tom Tromey <tom@tromey.com> * inferior.h (class inferior) <has_execution>: Update. * windows-tdep.c (windows_solib_create_inferior_hook): Update. * valops.c (find_function_in_inferior) (value_allocate_space_in_inferior): Update. * top.c (kill_or_detach): Update. * target.c (target_preopen, set_target_permissions): Update. (target_has_execution_current): Remove. * sparc64-tdep.c (adi_examine_command, adi_assign_command): Update. * solib.c (update_solib_list, reload_shared_libraries): Update. * solib-svr4.c (svr4_solib_create_inferior_hook): Update. * solib-dsbt.c (enable_break): Update. * score-tdep.c (score7_fetch_inst): Update. * rs6000-nat.c (rs6000_nat_target::xfer_shared_libraries): Update. * remote.c (remote_target::start_remote) (remote_target::remote_check_symbols, remote_target::open_1) (remote_target::remote_detach_1, remote_target::verify_memory) (remote_target::xfer_partial, remote_target::read_description) (remote_target::get_min_fast_tracepoint_insn_len): Update. * record-full.c (record_full_open_1): Update. * record-btrace.c (record_btrace_target_open): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring): Update. * linux-thread-db.c (add_thread_db_info) (thread_db_find_new_threads_silently, check_thread_db_callback) (try_thread_db_load_1, record_thread): Update. * linux-tdep.c (linux_info_proc, linux_vsyscall_range_raw): Update. * linux-fork.c (checkpoint_command): Update. * infrun.c (set_non_stop, set_observer_mode) (check_multi_target_resumption, for_each_just_stopped_thread) (maybe_remove_breakpoints, normal_stop) (class infcall_suspend_state): Update. * infcmd.c (ERROR_NO_INFERIOR, kill_if_already_running) (info_program_command, attach_command): Update. * infcall.c (call_function_by_hand_dummy): Update. * inf-loop.c (inferior_event_handler): Update. * gcore.c (gcore_command, derive_heap_segment): Update. * exec.c (exec_file_command): Update. * eval.c (evaluate_subexp): Update. * compile/compile.c (compile_to_object): Update. * cli/cli-dump.c (restore_command): Update. * breakpoint.c (update_watchpoint) (update_inserted_breakpoint_locations) (insert_breakpoint_locations, get_bpstat_thread): Update. * target.h (target_has_execution): Remove macro. (target_has_execution_current): Don't declare. (target_has_execution): Rename from target_has_execution_1. Add argument default.
2020-09-19gdb/fortran: Move Fortran expression handling into f-lang.cAndrew Burgess1-215/+8
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-19gdb/fortran: Clean up array/string expression evaluationAndrew Burgess1-69/+67
This commit is a refactor of part of the Fortran array and string handling code. The current code is split into two blocks, linked, weirdly, with a goto. After this commit all the code is moved to its own function, and arrays and strings are now handled using the same code; this will be useful later when I want to add array stride support where strings will want to be treated just like arrays, but is a good clean up even without the array stride work, which is why I'm merging it now. For now the new function is added as a static within eval.c, even though the function is Fortran only. A following commit will remove some of the Fortran specific code from eval.c into one of the Fortran specific files, including this new function. There should be no user visible changes after this commit. gdb/ChangeLog: * eval.c (fortran_value_subarray): New function, content is taken from... (evaluate_subexp_standard): ...here, in two places. Now arrays and strings both call the new function. (calc_f77_array_dims): Add header comment, handle strings.