GDB (xrefs)
|
#include "defs.h"
#include "value.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
#include "target.h"
#include "language.h"
#include "gdb_string.h"
#include "doublest.h"
#include "dfp.h"
#include <math.h>
#include "infcall.h"
#include "exceptions.h"
Go to the source code of this file.
Defines | |
#define | TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2) |
Functions | |
void | _initialize_valarith (void) |
static LONGEST | find_size_for_pointer_math (struct type *ptr_type) |
struct value * | value_ptradd (struct value *arg1, LONGEST arg2) |
LONGEST | value_ptrdiff (struct value *arg1, struct value *arg2) |
struct value * | value_subscript (struct value *array, LONGEST index) |
struct value * | value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) |
int | binop_types_user_defined_p (enum exp_opcode op, struct type *type1, struct type *type2) |
int | binop_user_defined_p (enum exp_opcode op, struct value *arg1, struct value *arg2) |
int | unop_user_defined_p (enum exp_opcode op, struct value *arg1) |
static struct value * | value_user_defined_cpp_op (struct value **args, int nargs, char *operator, int *static_memfuncp) |
static struct value * | value_user_defined_op (struct value **argp, struct value **args, char *name, int *static_memfuncp, int nargs) |
struct value * | value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op, enum exp_opcode otherop, enum noside noside) |
struct value * | value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) |
struct value * | value_concat (struct value *arg1, struct value *arg2) |
static LONGEST | integer_pow (LONGEST v1, LONGEST v2) |
static ULONGEST | uinteger_pow (ULONGEST v1, LONGEST v2) |
static void | value_args_as_decimal (struct value *arg1, struct value *arg2, gdb_byte *x, int *len_x, enum bfd_endian *byte_order_x, gdb_byte *y, int *len_y, enum bfd_endian *byte_order_y) |
static struct value * | scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) |
struct value * | value_vector_widen (struct value *scalar_value, struct type *vector_type) |
static struct value * | vector_binop (struct value *val1, struct value *val2, enum exp_opcode op) |
struct value * | value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) |
int | value_logical_not (struct value *arg1) |
static int | value_strcmp (struct value *arg1, struct value *arg2) |
int | value_equal (struct value *arg1, struct value *arg2) |
int | value_equal_contents (struct value *arg1, struct value *arg2) |
int | value_less (struct value *arg1, struct value *arg2) |
struct value * | value_pos (struct value *arg1) |
struct value * | value_neg (struct value *arg1) |
struct value * | value_complement (struct value *arg1) |
int | value_bit_index (struct type *type, const gdb_byte *valaddr, int index) |
int | value_in (struct value *element, struct value *set) |
#define TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2) |
Definition at line 38 of file valarith.c.
Referenced by scalar_binop().
void _initialize_valarith | ( | void | ) |
int binop_types_user_defined_p | ( | enum exp_opcode | op, |
struct type * | type1, | ||
struct type * | type2 | ||
) |
Definition at line 230 of file valarith.c.
References check_typedef(), TYPE_CODE, TYPE_CODE_REF, TYPE_CODE_STRUCT, and TYPE_TARGET_TYPE.
Referenced by binop_user_defined_p(), and gen_expr_binop_rest().
int binop_user_defined_p | ( | enum exp_opcode | op, |
struct value * | arg1, | ||
struct value * | arg2 | ||
) |
Definition at line 255 of file valarith.c.
References binop_types_user_defined_p(), and value_type().
Referenced by evaluate_subexp_standard().
static LONGEST find_size_for_pointer_math | ( | struct type * | ptr_type | ) | [static] |
Definition at line 51 of file valarith.c.
References _, check_typedef(), error(), gdb_assert, LONGEST, name, TYPE_CODE, TYPE_CODE_PTR, TYPE_CODE_VOID, TYPE_LENGTH, TYPE_NAME, TYPE_TAG_NAME, and TYPE_TARGET_TYPE.
Referenced by value_ptradd().
static LONGEST integer_pow | ( | LONGEST | v1, |
LONGEST | v2 | ||
) | [static] |
Definition at line 769 of file valarith.c.
References _, error(), L, and LONGEST.
Referenced by scalar_binop().
static struct value* scalar_binop | ( | struct value * | arg1, |
struct value * | arg2, | ||
enum exp_opcode | op | ||
) | [static, read] |
Definition at line 897 of file valarith.c.
References _, allocate_value(), check_typedef(), coerce_ref(), decimal_binop(), error(), gdbarch_byte_order(), get_type_arch(), integer_pow(), is_integral_type(), LONGEST, safe_strerror(), store_signed_integer(), store_typed_floating(), store_unsigned_integer(), TRUNCATION_TOWARDS_ZERO, TYPE_CODE, TYPE_CODE_BOOL, TYPE_CODE_DECFLOAT, TYPE_CODE_FLT, TYPE_LENGTH, TYPE_UNSIGNED, uinteger_pow(), ULONGEST, value_args_as_decimal(), value_as_double(), value_as_long(), value_contents_raw(), value_from_decfloat(), and value_type().
Referenced by value_binop().
static ULONGEST uinteger_pow | ( | ULONGEST | v1, |
LONGEST | v2 | ||
) | [static] |
Definition at line 800 of file valarith.c.
References _, error(), L, and ULONGEST.
Referenced by scalar_binop().
int unop_user_defined_p | ( | enum exp_opcode | op, |
struct value * | arg1 | ||
) |
Definition at line 268 of file valarith.c.
References check_typedef(), TYPE_CODE, TYPE_CODE_REF, TYPE_CODE_STRUCT, TYPE_TARGET_TYPE, and value_type().
Referenced by evaluate_subexp_standard().
static void value_args_as_decimal | ( | struct value * | arg1, |
struct value * | arg2, | ||
gdb_byte * | x, | ||
int * | len_x, | ||
enum bfd_endian * | byte_order_x, | ||
gdb_byte * | y, | ||
int * | len_y, | ||
enum bfd_endian * | byte_order_y | ||
) | [static] |
Definition at line 830 of file valarith.c.
References _, check_typedef(), decimal_from_integral(), error(), gdb_assert, gdbarch_byte_order(), get_type_arch(), is_integral_type(), memcpy(), TYPE_CODE, TYPE_CODE_DECFLOAT, TYPE_CODE_FLT, TYPE_LENGTH, TYPE_NAME, value_contents(), and value_type().
Referenced by scalar_binop(), value_equal(), and value_less().
struct value* value_binop | ( | struct value * | arg1, |
struct value * | arg2, | ||
enum exp_opcode | op | ||
) | [read] |
Definition at line 1445 of file valarith.c.
References _, check_typedef(), error(), is_integral_type(), scalar_binop(), TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_DECFLOAT, TYPE_CODE_FLT, TYPE_VECTOR, value_type(), value_vector_widen(), and vector_binop().
Referenced by ada_value_binop(), evaluate_subexp_standard(), execute_stack_op(), value_equal(), value_less(), and vector_binop().
Definition at line 1830 of file valarith.c.
References extract_unsigned_integer(), gdbarch_bits_big_endian(), gdbarch_byte_order(), get_discrete_bounds(), get_type_arch(), LONGEST, TYPE_INDEX_TYPE, and word.
Referenced by m2_print_long_set(), m2_val_print(), pascal_val_print(), and value_in().
struct value* value_complement | ( | struct value * | arg1 | ) | [read] |
Definition at line 1791 of file valarith.c.
References _, allocate_value(), check_typedef(), coerce_ref(), error(), get_array_bounds(), is_integral_type(), LONGEST, memcpy(), type, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_LENGTH, TYPE_TARGET_TYPE, TYPE_VECTOR, value_as_long(), value_complement(), value_contents_all(), value_contents_writeable(), value_from_longest(), value_subscript(), and value_type().
Referenced by evaluate_subexp_standard(), execute_stack_op(), and value_complement().
struct value* value_concat | ( | struct value * | arg1, |
struct value * | arg2 | ||
) | [read] |
Definition at line 626 of file valarith.c.
References _, check_typedef(), do_cleanups(), error(), longest_to_int(), make_cleanup(), memcpy(), TYPE_CODE, TYPE_CODE_BOOL, TYPE_CODE_CHAR, TYPE_CODE_INT, TYPE_CODE_STRING, TYPE_LENGTH, TYPE_TARGET_TYPE, unpack_long(), value_as_long(), value_contents(), value_string(), value_type(), xfree(), and xmalloc().
Referenced by evaluate_subexp_standard().
int value_equal | ( | struct value * | arg1, |
struct value * | arg2 | ||
) |
Definition at line 1543 of file valarith.c.
References _, check_typedef(), coerce_array(), decimal_compare(), error(), is_integral_type(), len, longest_to_int(), TYPE_CODE, TYPE_CODE_DECFLOAT, TYPE_CODE_FLT, TYPE_CODE_PTR, TYPE_CODE_STRING, TYPE_LENGTH, value_args_as_decimal(), value_as_address(), value_as_double(), value_as_long(), value_binop(), value_contents(), value_strcmp(), and value_type().
Referenced by ada_value_equal(), evaluate_subexp_standard(), execute_stack_op(), scalar_relop(), value_vector_widen(), and wrap_value_equal().
int value_equal_contents | ( | struct value * | arg1, |
struct value * | arg2 | ||
) |
Definition at line 1625 of file valarith.c.
References check_typedef(), memcmp(), TYPE_CODE, TYPE_LENGTH, value_contents(), and value_type().
Referenced by watchpoint_check().
Definition at line 1852 of file valarith.c.
References _, check_typedef(), error(), TYPE_CODE, TYPE_CODE_BOOL, TYPE_CODE_CHAR, TYPE_CODE_ENUM, TYPE_CODE_INT, TYPE_CODE_RANGE, TYPE_CODE_SET, TYPE_TARGET_TYPE, value_as_long(), value_bit_index(), value_contents(), and value_type().
Referenced by evaluate_subexp_standard().
int value_less | ( | struct value * | arg1, |
struct value * | arg2 | ||
) |
Definition at line 1642 of file valarith.c.
References _, check_typedef(), coerce_array(), decimal_compare(), error(), is_integral_type(), longest_to_int(), TYPE_CODE, TYPE_CODE_DECFLOAT, TYPE_CODE_FLT, TYPE_CODE_PTR, TYPE_CODE_STRING, value_args_as_decimal(), value_as_address(), value_as_double(), value_as_long(), value_binop(), value_strcmp(), and value_type().
Referenced by evaluate_subexp_standard(), execute_stack_op(), and scalar_relop().
int value_logical_not | ( | struct value * | arg1 | ) |
Definition at line 1482 of file valarith.c.
References check_typedef(), coerce_array(), decimal_is_zero(), gdbarch_byte_order(), get_type_arch(), len, p, TYPE_CODE, TYPE_CODE_DECFLOAT, TYPE_CODE_FLT, TYPE_LENGTH, value_as_double(), value_contents(), and value_type().
Referenced by evaluate_subexp_opencl(), evaluate_subexp_standard(), java_value_print(), opencl_logical_not(), scalar_relop(), type_from_class(), value_allocate_space_in_inferior(), value_cast_pointers(), and value_true().
Definition at line 1736 of file valarith.c.
References _, allocate_value(), check_typedef(), coerce_ref(), error(), gdbarch_byte_order(), get_array_bounds(), get_type_arch(), is_integral_type(), len, LONGEST, memcpy(), type, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_DECFLOAT, TYPE_CODE_FLT, TYPE_LENGTH, TYPE_TARGET_TYPE, TYPE_VECTOR, value_as_double(), value_as_long(), value_contents(), value_contents_all(), value_contents_raw(), value_contents_writeable(), value_from_double(), value_from_longest(), value_neg(), value_subscript(), and value_type().
Referenced by const_expr(), evaluate_subexp_standard(), execute_stack_op(), and value_neg().
Definition at line 1705 of file valarith.c.
References _, allocate_value(), check_typedef(), coerce_ref(), error(), is_integral_type(), memcpy(), type, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_DECFLOAT, TYPE_CODE_FLT, TYPE_LENGTH, TYPE_VECTOR, value_as_double(), value_as_long(), value_contents(), value_contents_raw(), value_from_decfloat(), value_from_double(), value_from_longest(), and value_type().
Referenced by evaluate_subexp_standard().
struct value* value_ptradd | ( | struct value * | arg1, |
LONGEST | arg2 | ||
) | [read] |
Definition at line 86 of file valarith.c.
References check_typedef(), coerce_array(), find_size_for_pointer_math(), LONGEST, lval_internalvar, set_value_component_location(), value_as_address(), value_from_pointer(), VALUE_LVAL, and value_type().
Referenced by ada_get_tsd_from_tag(), ada_tag_value_at_base_address(), ada_value_ptr_subscript(), evaluate_subexp_modula2(), evaluate_subexp_standard(), gnuv2_virtual_fn_field(), gnuv3_method_ptr_to_value(), and value_subscript().
LONGEST value_ptrdiff | ( | struct value * | arg1, |
struct value * | arg2 | ||
) |
Definition at line 107 of file valarith.c.
References _, check_typedef(), coerce_array(), error(), gdb_assert, LONGEST, TYPE_CODE, TYPE_CODE_PTR, TYPE_LENGTH, TYPE_TARGET_TYPE, value_as_long(), value_type(), and warning().
Referenced by evaluate_subexp_standard().
static int value_strcmp | ( | struct value * | arg1, |
struct value * | arg2 | ||
) | [static] |
Definition at line 1513 of file valarith.c.
References len, TYPE_LENGTH, value_contents(), and value_type().
Referenced by value_equal(), and value_less().
struct value* value_subscript | ( | struct value * | array, |
LONGEST | index | ||
) | [read] |
Definition at line 148 of file valarith.c.
References _, language_defn::c_style_arrays, check_typedef(), coerce_ref(), current_language, error(), get_discrete_bounds(), LONGEST, lval_memory, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_STRING, TYPE_INDEX_TYPE, value_coerce_array(), value_ind(), VALUE_LVAL, value_ptradd(), value_subscripted_rvalue(), value_type(), and warning().
Referenced by ada_promote_array_of_integrals(), ada_value_subscript(), c_describe_child(), create_value(), evaluate_subexp_java(), evaluate_subexp_modula2(), evaluate_subexp_opencl(), evaluate_subexp_standard(), gnuv2_virtual_fn_field(), gnuv3_baseclass_offset(), gnuv3_get_virtual_fn(), lval_func_write(), opencl_logical_not(), print_one_vtable(), read_atcb(), value_complement(), value_neg(), vector_binop(), and vector_relop().
struct value* value_subscripted_rvalue | ( | struct value * | array, |
LONGEST | index, | ||
int | lowerbound | ||
) | [read] |
Definition at line 193 of file valarith.c.
References _, allocate_value(), allocate_value_lazy(), check_typedef(), error(), longest_to_int(), lval_memory, set_value_component_location(), set_value_offset(), TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED, TYPE_LENGTH, TYPE_TARGET_TYPE, value_contents_copy(), value_embedded_offset(), VALUE_FRAME_ID, value_lazy(), VALUE_LVAL, value_offset(), VALUE_REGNUM, and value_type().
Referenced by evaluate_subexp_standard(), and value_subscript().
static struct value* value_user_defined_cpp_op | ( | struct value ** | args, |
int | nargs, | ||
char * | operator, | ||
int * | static_memfuncp | ||
) | [static, read] |
Definition at line 289 of file valarith.c.
References _, BOTH, error(), find_overload_match(), value_ind(), and value_of_variable().
Referenced by value_user_defined_op().
static struct value* value_user_defined_op | ( | struct value ** | argp, |
struct value ** | args, | ||
char * | name, | ||
int * | static_memfuncp, | ||
int | nargs | ||
) | [static, read] |
Definition at line 320 of file valarith.c.
References current_language, language_defn::la_language, language_cplus, value_struct_elt(), and value_user_defined_cpp_op().
Referenced by value_x_binop(), and value_x_unop().
struct value* value_vector_widen | ( | struct value * | scalar_value, |
struct type * | vector_type | ||
) | [read] |
Definition at line 1355 of file valarith.c.
References _, allocate_value(), check_typedef(), CHECK_TYPEDEF, error(), gdb_assert, get_array_bounds(), LONGEST, memcpy(), TYPE_CODE, TYPE_CODE_ARRAY, TYPE_LENGTH, TYPE_TARGET_TYPE, TYPE_VECTOR, value_cast(), value_contents_all(), value_contents_writeable(), value_equal(), and value_type().
Referenced by opencl_value_cast(), and value_binop().
struct value* value_x_binop | ( | struct value * | arg1, |
struct value * | arg2, | ||
enum exp_opcode | op, | ||
enum exp_opcode | otherop, | ||
enum noside noside | |||
) | [read] |
Definition at line 344 of file valarith.c.
References _, call_function_by_hand(), check_typedef(), coerce_ref(), error(), EVAL_AVOID_SIDE_EFFECTS, NOT_FOUND_ERROR, throw_error(), TYPE_CODE, TYPE_CODE_STRUCT, TYPE_TARGET_TYPE, value_addr(), VALUE_LVAL, value_type(), value_user_defined_op(), and value_zero().
Referenced by evaluate_subexp_standard().
struct value* value_x_unop | ( | struct value * | arg1, |
enum exp_opcode | op, | ||
enum noside noside | |||
) | [read] |
Definition at line 509 of file valarith.c.
References _, call_function_by_hand(), check_typedef(), coerce_ref(), error(), EVAL_AVOID_SIDE_EFFECTS, get_type_arch(), NOT_FOUND_ERROR, throw_error(), TYPE_CODE, TYPE_CODE_STRUCT, TYPE_TARGET_TYPE, value_addr(), value_from_longest(), VALUE_LVAL, value_type(), value_user_defined_op(), and value_zero().
Referenced by evaluate_subexp_standard().
static struct value* vector_binop | ( | struct value * | val1, |
struct value * | val2, | ||
enum exp_opcode | op | ||
) | [static, read] |
Definition at line 1395 of file valarith.c.
References _, allocate_value(), check_typedef(), error(), get_array_bounds(), LONGEST, memcpy(), TYPE_CODE, TYPE_CODE_ARRAY, TYPE_LENGTH, TYPE_TARGET_TYPE, TYPE_UNSIGNED, TYPE_VECTOR, value_binop(), value_contents_all(), value_contents_writeable(), value_free_to_mark(), value_mark(), value_subscript(), and value_type().
Referenced by value_binop().