aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2021-03-08Introduce decltype_operationTom Tromey2-0/+51
This adds class decltype_operation, which implements OP_DECLTYPE. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class decltype_operation): New.
2021-03-08Introduce typeof_operationTom Tromey2-0/+29
This adds class typeof_operation, which implements OP_TYPEOF. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class typeof_operation): New.
2021-03-08Introduce type_operationTom Tromey3-1/+31
This adds class type_operation, which implements OP_TYPE. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class type_operation): New. * eval.c (eval_op_type): No longer static.
2021-03-08Introduce unop_ind_operationTom Tromey4-5/+111
This adds class unop_ind_operation, which implements UNOP_IND. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class unop_ind_base_operation) (class unop_ind_operation): New. * eval.c (eval_op_ind): No longer static. Remove "op" parameter. (unop_ind_base_operation::evaluate_for_address) (unop_ind_base_operation::evaluate_for_sizeof): New method. * ax-gdb.c (gen_expr_unop) <case UNOP_IND>: New.
2021-03-08Implement unary increment and decrement operationsTom Tromey3-4/+62
This implements the unary increment and decrement operations, "++" and "--". gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (unop_incr_operation): New template. (preinc_operation, predec_operation, postinc_operation) (postdec_operation): New typedefs. * eval.c (eval_op_preinc, eval_op_predec, eval_op_postinc) (eval_op_postdec): No longer static.
2021-03-08Implement some unary operationsTom Tromey4-4/+139
This introduces a couple of new template classes and then uses them to implement some simple unary operations. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (unary_ftype): New typedef. (unop_operation, usual_ax_binop_operation): New templates. (unary_plus_operation, unary_neg_operation) (unary_complement_operation, unary_logical_not_operation): New typedefs. * eval.c (eval_op_plus, eval_op_neg, eval_op_complement) (eval_op_lognot): No longer static. * ax-gdb.c (gen_expr_unop): New function.
2021-03-08Introduce comma_operationTom Tromey3-0/+57
This adds class comma_operation, which implements BINOP_COMMA. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ax-gdb.c (comma_operation::do_generate_ax): New method.
2021-03-08Introduce repeat_operationTom Tromey4-3/+81
This adds class repeat_operation, which implements BINOP_REPEAT. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class repeat_operation): New. * eval.c (eval_op_repeat): No longer static. Remove "op" parameter. (evaluate_subexp_standard): Update. * ax-gdb.c (repeat_operation::do_generate_ax): New method.
2021-03-08Implement binary comparison operationsTom Tromey3-6/+74
This implements the binary comparison operations via a template class. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class comparison_operation): New. (equal_operation, notequal_operation, less_operation) (gtr_operation, geq_operation, leq_operation): New typedefs. * eval.c (eval_op_equal, eval_op_notequal, eval_op_less) (eval_op_gtr, eval_op_geq, eval_op_leq): No longer static.
2021-03-08Introduce subscript_operationTom Tromey3-1/+55
This adds class subscript_operation, which implements BINOP_SUBSCRIPT. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class subscript_operation): New. * eval.c (eval_op_subscript): No longer static.
2021-03-08Introduce binop_operationTom Tromey3-1/+82
This adds two new template classes, binop_operation and usual_ax_binop_operation, and then uses these to implement a number of binary operations that follow similar patterns. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class binop_operation, class usual_ax_binop_operation): New. (exp_operation, intdiv_operation, mod_operation, mul_operation) (div_operation, rem_operation, lsh_operation, rsh_operation) (bitwise_and_operation, bitwise_ior_operation) (bitwise_xor_operation): New typedefs. * eval.c (eval_op_binary): No longer static.
2021-03-08Introduce sub_operationTom Tromey3-5/+51
This adds class sub_operation, which implements BINOP_SUB. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class sub_operation): New. * eval.c (eval_op_sub): No longer static. Remove "op" parameter. (evaluate_subexp_standard): Update.
2021-03-08Introduce add_operationTom Tromey3-5/+51
This adds class add_operation, which implements BINOP_ADD. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class add_operation): New. * eval.c (eval_op_add): No longer static. Remove "op" parameter. (evaluate_subexp_standard): Update.
2021-03-08Introduce concat_operationTom Tromey3-6/+38
This adds class concat_operation, which implements BINOP_CONCAT. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class concat_operation): New. * eval.c (eval_op_concat): No longer static. Remove "op" parameter. (evaluate_subexp_standard): Update.
2021-03-08Introduce structop_member_operation and structop_mptr_operationTom Tromey3-1/+55
This adds class structop_member_operation and structop_mptr_operation, which implement STRUCTOP_MEMBER and STRUCTOP_MPTR. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class structop_member_operation) (class structop_mptr_operation): New. * eval.c (eval_op_member): No longer static.
2021-03-08Introduce structop_ptr_operationTom Tromey3-5/+50
This adds class structop_ptr_operation, which implements STRUCTOP_PTR. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class structop_ptr_operation): New. * eval.c (eval_op_structop_ptr): No longer static. Remove "op" parameter.
2021-03-08Introduce structop_operationTom Tromey3-1/+69
This adds class structop_base_operation and structop_operation, which implement STRUCTOP_STRUCT. The base class exists to unify the completion code between STRUCTOP_STRUCT and STRUCTOP_PTR. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class structop_base_operation) (class structop_operation): New. * eval.c (eval_op_structop_struct): No longer static.
2021-03-08Introduce complex_operationTom Tromey2-0/+25
This adds class complex_operation, which implements OP_COMPLEX. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class complex_operation): New.
2021-03-08Introduce objc_selector_operationTom Tromey3-1/+31
This adds class objc_selector_operation, which implements OP_OBJC_SELECTOR. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_objc_selector): No longer static. * c-exp.h (class objc_selector_operation): New.
2021-03-08Introduce objc_nsstring_operationTom Tromey3-0/+28
This adds class objc_nsstring_operation, which implements OP_OBJC_NSSTRING. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c: Include c-exp.h. * c-exp.h (class objc_nsstring_operation): New.
2021-03-08Add c-exp.h and c_string_operationTom Tromey3-0/+177
This adds the new file c-exp.h, where C operation classes will be declared. The first such class, c_string_operation, is also added here. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * c-lang.c (c_string_operation::evaluate): New method. * c-exp.h: New file.
2021-03-08Introduce ternop_cond_operationTom Tromey3-0/+65
This adds class ternop_cond_operation, which implements TERNOP_COND. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class ternop_cond_operation): New. * ax-gdb.c (ternop_cond_operation::do_generate_ax): New method.
2021-03-08Introduce ternop_slice_operationTom Tromey3-1/+35
This adds class ternop_slice_operation, which implements TERNOP_SLICE. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class ternop_slice_operation): New. * eval.c (eval_op_ternop): No longer static.
2021-03-08Introduce string_operationTom Tromey3-1/+30
This adds string_operation, which implements OP_STRING for most languages (C has its own variant). gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class string_operation): New. * eval.c (eval_op_string): No longer static.
2021-03-08Introduce internalvar_operationTom Tromey3-0/+62
This adds class internalvar_operation, which implements OP_INTERNALVAR. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class internalvar_operation): New. * ax-gdb.c (internalvar_operation::do_generate_ax): New method.
2021-03-08Introduce bool_operationTom Tromey2-0/+26
This adds class bool_operation, which implements OP_BOOL. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class bool_operation): New.
2021-03-08Introduce register_operationTom Tromey4-1/+61
This adds class register_operation, which implements OP_REGISTER. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class register_operation): New. * eval.c (eval_op_register): No longer static. * ax-gdb.c (register_operation::do_generate_ax): New method.
2021-03-08Introduce last_operationTom Tromey2-0/+22
This adds class last_operation, which implements OP_LAST. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class last_operation): New.
2021-03-08Introduce func_static_var_operationTom Tromey3-1/+30
This adds class func_static_var_operation, which implements OP_FUNC_STATIC_VAR. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class func_static_var_operation): New. * eval.c (eval_op_func_static_var): No longer static.
2021-03-08Introduce var_entry_value_operationTom Tromey3-1/+28
This adds class var_entry_value_operation, which implements OP_VAR_ENTRY_VALUE. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class var_entry_value_operation): New. * eval.c (eval_op_var_entry_value): No longer static.
2021-03-08Introduce var_msym_value_operationTom Tromey5-1/+152
This adds class var_msym_value_operation, which implements OP_VAR_MSYM_VALUE. A new method is added to class operation in order to support a special case in minsym evaluation. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expression.h (class operation) <set_outermost>: New method. * expop.h (class var_msym_value_operation): New. * eval.c (eval_op_var_msym_value): No longer static. (var_msym_value_operation::evaluate_for_address) (var_msym_value_operation::evaluate_for_sizeof) (var_msym_value_operation::evaluate_for_cast): New methods. * ax-gdb.c (var_msym_value_operation::do_generate_ax): New method.
2021-03-08Introduce long_const_operationTom Tromey3-0/+45
This adds class long_const_operation, which holds a scalar constant. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class long_const_operation): New. * ax-gdb.c (long_const_operation::do_generate_ax): New method.
2021-03-08Introduce scope_operationTom Tromey4-1/+69
This adds class scope_operation, an implementation of OP_SCOPE. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class scope_operation): New. * eval.c (eval_op_scope): No longer static. (scope_operation::evaluate_for_address): New method. * ax-gdb.c (scope_operation::do_generate_ax): New method.
2021-03-08Introduce float_const_operationTom Tromey3-0/+56
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-08Add two agent expression helper functionsTom Tromey3-0/+62
This adds a couple of agent expression helper functions that will be useful when implementing various operations. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (gen_expr_binop, gen_expr_structop): Declare. * ax-gdb.c (gen_expr_binop): New function. (gen_expr_structop): Likewise.
2021-03-08Implement dumpingTom Tromey3-1/+185
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-03-08Introduce class operationTom Tromey5-0/+487
This patch introduces class operation, the new base class for all expression operations. In the new approach, an operation is simply a class that presents a certain interface. Operations own their operands, and management is done via unique_ptr. The operation interface is largely ad hoc, based on the evolution of expression handling in GDB. Parts (for example, evaluate_with_coercion) are probably redundant; however I took this approach to try to avoid mixing different kinds of refactorings. In some specific situations, rather than add a generic method across the entire operation class hierarchy, I chose instead to use dynamic_cast and specialized methods on certain concrete subclasses. This will appear in some subsequent patches. One goal of this work is to avoid the kinds of easy-to-make errors that affected the old implementation. To this end, some helper subclasses are also added here. These helpers automate the implementation of the 'dump', 'uses_objfile', and 'constant_p' methods. Nearly every concrete operation that is subsequently added will use these facilities. (Note that the 'dump' implementation is only outlined here, the body appears in the next patch.) gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expression.h (expr::operation): New class. (expr::make_operation): New function. (expr::operation_up): New typedef. * expop.h: New file. * eval.c (operation::evaluate_for_cast) (operation::evaluate_for_address, operation::evaluate_for_sizeof): New methods. * ax-gdb.c (operation::generate_ax): New method.
2021-03-08Split gen_expr_binop_restTom Tromey2-2/+19
This splits gen_expr_binop_rest into two overloads. One overload retains the "pc" parameter, while the other does not, and furthermore does not call gen_expr on the left-hand-side. This split is useful for subsequent patches in the new expression evaluation approach. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ax-gdb.c (gen_expr_binop_rest): Remove "pc" parameter. (gen_expr_binop_rest): New overload.
2021-03-08Split out eval_multi_subscriptTom Tromey2-33/+47
This splits MULTI_SUBSCRIPT into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_multi_subscript): New function. (evaluate_subexp_standard): Use it.
2021-03-08Split out ada_binop_expTom Tromey2-13/+29
This splits BINOP_EXP into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_binop_exp): New function. (ada_evaluate_subexp): Use it.
2021-03-08Change value_val_atr to ada_val_atrTom Tromey2-7/+11
This renames value_val_atr to ada_val_atr, changing its parameters to more closely mirror other expression helpers. The EVAL_AVOID_SIDE_EFFECTS case is moved into this function as well. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_val_atr): Rename from value_val_atr. Change parameters. (ada_evaluate_subexp): Use it.
2021-03-08Split out ada_binop_minmaxTom Tromey2-8/+24
This splits OP_ATR_MIN and OP_ATR_MAX into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_binop_minmax): New function. (ada_evaluate_subexp): Use it.
2021-03-08Split out ada_unop_atrTom Tromey2-116/+133
This splits some Ada attribute operations into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_unop_atr): New function. (ada_evaluate_subexp): Use it.
2021-03-08Split out ada_binop_in_boundsTom Tromey2-22/+36
This splits BINOP_IN_BOUNDS into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_binop_in_bounds): New function. (ada_evaluate_subexp): Use it.
2021-03-08Split out ada_ternop_sliceTom Tromey2-70/+88
This splits TERNOP_SLICE into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_ternop_slice): New function. (ada_evaluate_subexp): Use it.
2021-03-08Split out ada_equal_binopTom Tromey2-11/+28
This splits BINOP_EQUAL and BINOP_NOTEQUAL into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_equal_binop): New function. (ada_evaluate_subexp): Use it.
2021-03-08Split out ada_mult_binopTom Tromey2-11/+27
This splits BINOP_MUL into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_mult_binop): New function. (ada_evaluate_subexp): Use it.
2021-03-08Split out ada_absTom Tromey2-5/+21
This splits UNOP_ABS into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_abs): New function. (ada_evaluate_subexp): Use it.
2021-03-08Split out ada_atr_sizeTom Tromey2-15/+31
This splits OP_ATR_SIZE into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_atr_size): New function. (ada_evaluate_subexp): Use it.
2021-03-08Split out ada_atr_tagTom Tromey2-5/+20
This splits OP_ATR_TAG into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_atr_tag): New function. (ada_evaluate_subexp): Use it.