GDB (xrefs)
Enumerations | Functions | Variables
/tmp/gdb-8.1/gdb/valops.c File Reference
#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
#include "frame.h"
#include "inferior.h"
#include "gdbcore.h"
#include "target.h"
#include "demangle.h"
#include "language.h"
#include "gdbcmd.h"
#include "regcache.h"
#include "cp-abi.h"
#include "block.h"
#include "infcall.h"
#include "dictionary.h"
#include "cp-support.h"
#include "target-float.h"
#include "tracepoint.h"
#include "observer.h"
#include "objfiles.h"
#include "extension.h"
#include "byte-vector.h"

Go to the source code of this file.

Enumerations

enum  oload_classification { STANDARD, NON_STANDARD, INCOMPATIBLE }
 

Functions

static int typecmp (int staticp, int varargs, int nargs, struct field t1[], struct value *t2[])
 
static struct valuesearch_struct_field (const char *, struct value *, struct type *, int)
 
static struct valuesearch_struct_method (const char *, struct value **, struct value **, LONGEST, int *, struct type *)
 
static int find_oload_champ_namespace (struct value **, int, const char *, const char *, struct symbol ***, struct badness_vector **, const int no_adl)
 
static int find_oload_champ_namespace_loop (struct value **, int, const char *, const char *, int, struct symbol ***, struct badness_vector **, int *, const int no_adl)
 
static int find_oload_champ (struct value **, int, int, struct fn_field *, VEC(xmethod_worker_ptr) *, struct symbol **, struct badness_vector **)
 
static int oload_method_static_p (struct fn_field *, int)
 
static enum oload_classification classify_oload_match (struct badness_vector *, int, int)
 
static struct valuevalue_struct_elt_for_reference (struct type *, int, struct type *, const char *, struct type *, int, enum noside)
 
static struct valuevalue_namespace_elt (const struct type *, const char *, int, enum noside)
 
static struct valuevalue_maybe_namespace_elt (const struct type *, const char *, int, enum noside)
 
static CORE_ADDR allocate_space_in_inferior (int)
 
static struct valuecast_into_complex (struct type *, struct value *)
 
static void find_method_list (struct value **, const char *, LONGEST, struct type *, struct fn_field **, int *, VEC(xmethod_worker_ptr) **, struct type **, LONGEST *)
 
static void show_overload_resolution (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
struct valuefind_function_in_inferior (const char *name, struct objfile **objf_p)
 
struct valuevalue_allocate_space_in_inferior (int len)
 
static struct valuevalue_cast_structs (struct type *type, struct value *v2)
 
struct valuevalue_cast_pointers (struct type *type, struct value *arg2, int subclass_check)
 
struct valuevalue_cast (struct type *type, struct value *arg2)
 
struct valuevalue_reinterpret_cast (struct type *type, struct value *arg)
 
static int dynamic_cast_check_1 (struct type *desired_type, const gdb_byte *valaddr, LONGEST embedded_offset, CORE_ADDR address, struct value *val, struct type *search_type, CORE_ADDR arg_addr, struct type *arg_type, struct value **result)
 
static int dynamic_cast_check_2 (struct type *desired_type, const gdb_byte *valaddr, LONGEST embedded_offset, CORE_ADDR address, struct value *val, struct type *search_type, struct value **result)
 
struct valuevalue_dynamic_cast (struct type *type, struct value *arg)
 
struct valuevalue_zero (struct type *type, enum lval_type lv)
 
struct valuevalue_one (struct type *type)
 
static struct valueget_value_at (struct type *type, CORE_ADDR addr, int lazy)
 
struct valuevalue_at (struct type *type, CORE_ADDR addr)
 
struct valuevalue_at_lazy (struct type *type, CORE_ADDR addr)
 
void read_value_memory (struct value *val, LONGEST bit_offset, int stack, CORE_ADDR memaddr, gdb_byte *buffer, size_t length)
 
struct valuevalue_assign (struct value *toval, struct value *fromval)
 
struct valuevalue_repeat (struct value *arg1, int count)
 
struct valuevalue_of_variable (struct symbol *var, const struct block *b)
 
struct valueaddress_of_variable (struct symbol *var, const struct block *b)
 
int value_must_coerce_to_target (struct value *val)
 
struct valuevalue_coerce_to_target (struct value *val)
 
struct valuevalue_coerce_array (struct value *arg1)
 
struct valuevalue_coerce_function (struct value *arg1)
 
struct valuevalue_addr (struct value *arg1)
 
struct valuevalue_ref (struct value *arg1, enum type_code refcode)
 
struct valuevalue_ind (struct value *arg1)
 
struct valuevalue_array (int lowbound, int highbound, struct value **elemvec)
 
struct valuevalue_cstring (const char *ptr, ssize_t len, struct type *char_type)
 
struct valuevalue_string (const char *ptr, ssize_t len, struct type *char_type)
 
static void update_search_result (struct value **result_ptr, struct value *v, LONGEST *last_boffset, LONGEST boffset, const char *name, struct type *type)
 
static void do_search_struct_field (const char *name, struct value *arg1, LONGEST offset, struct type *type, int looking_for_baseclass, struct value **result_ptr, LONGEST *last_boffset, struct type *outermost_type)
 
struct valuevalue_struct_elt (struct value **argp, struct value **args, const char *name, int *static_memfuncp, const char *err)
 
struct valuevalue_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype, const char *err)
 
static void value_find_oload_method_list (struct value **argp, const char *method, LONGEST offset, struct fn_field **fn_list, int *num_fns, VEC(xmethod_worker_ptr) **xm_worker_vec, struct type **basetype, LONGEST *boffset)
 
int find_overload_match (struct value **args, int nargs, const char *name, enum oload_search_type method, struct value **objp, struct symbol *fsym, struct value **valp, struct symbol **symp, int *staticp, const int no_adl, const enum noside noside)
 
int destructor_name_p (const char *name, struct type *type)
 
static struct valueenum_constant_from_type (struct type *type, const char *name)
 
struct valuevalue_aggregate_elt (struct type *curtype, const char *name, struct type *expect_type, int want_address, enum noside noside)
 
static int compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
 
struct typevalue_rtti_indirect_type (struct value *v, int *full, LONGEST *top, int *using_enc)
 
struct valuevalue_full_object (struct value *argp, struct type *rtype, int xfull, int xtop, int xusing_enc)
 
struct valuevalue_of_this (const struct language_defn *lang)
 
struct valuevalue_of_this_silent (const struct language_defn *lang)
 
struct valuevalue_slice (struct value *array, int lowbound, int length)
 
struct valuevalue_literal_complex (struct value *arg1, struct value *arg2, struct type *type)
 
void _initialize_valops (void)
 

Variables

unsigned int overload_debug
 
int overload_resolution = 0
 

Enumeration Type Documentation

◆ oload_classification

Enumerator
STANDARD 
NON_STANDARD 
INCOMPATIBLE 

Definition at line 76 of file valops.c.

Function Documentation

◆ _initialize_valops()

void _initialize_valops ( void  )

◆ address_of_variable()

struct value* address_of_variable ( struct symbol var,
const struct block b 
)

◆ allocate_space_in_inferior()

static CORE_ADDR allocate_space_in_inferior ( int  len)
static

Definition at line 206 of file valops.c.

References value_allocate_space_in_inferior(), and value_as_long().

Referenced by value_coerce_to_target().

◆ cast_into_complex()

static struct value * cast_into_complex ( struct type type,
struct value val 
)
static

◆ classify_oload_match()

static enum oload_classification classify_oload_match ( struct badness_vector oload_champ_bv,
int  nargs,
int  static_offset 
)
static

◆ compare_parameters()

static int compare_parameters ( struct type t1,
struct type t2,
int  skip_artificial 
)
static

◆ destructor_name_p()

int destructor_name_p ( const char *  name,
struct type type 
)

Definition at line 3160 of file valops.c.

References _, error(), name, and type_name_no_tag_or_error().

Referenced by yyparse().

◆ do_search_struct_field()

static void do_search_struct_field ( const char *  name,
struct value arg1,
LONGEST  offset,
struct type type,
int  looking_for_baseclass,
struct value **  result_ptr,
LONGEST last_boffset,
struct type outermost_type 
)
static

◆ dynamic_cast_check_1()

static int dynamic_cast_check_1 ( struct type desired_type,
const gdb_byte valaddr,
LONGEST  embedded_offset,
CORE_ADDR  address,
struct value val,
struct type search_type,
CORE_ADDR  arg_addr,
struct type arg_type,
struct value **  result 
)
static

◆ dynamic_cast_check_2()

static int dynamic_cast_check_2 ( struct type desired_type,
const gdb_byte valaddr,
LONGEST  embedded_offset,
CORE_ADDR  address,
struct value val,
struct type search_type,
struct value **  result 
)
static

◆ enum_constant_from_type()

static struct value* enum_constant_from_type ( struct type type,
const char *  name 
)
static

◆ find_function_in_inferior()

struct value* find_function_in_inferior ( const char *  name,
struct objfile **  objf_p 
)

◆ find_method_list()

static void find_method_list ( struct value **  argp,
const char *  method,
LONGEST  offset,
struct type type,
struct fn_field **  fn_list,
int *  num_fns,
VEC(xmethod_worker_ptr) **  xm_worker_vec,
struct type **  basetype,
LONGEST boffset 
)
static

◆ find_oload_champ()

static int find_oload_champ ( struct value **  args,
int  nargs,
int  num_fns,
struct fn_field fns_ptr,
VEC(xmethod_worker_ptr) *  xm_worker_vec,
struct symbol **  oload_syms,
struct badness_vector **  oload_champ_bv 
)
static

◆ find_oload_champ_namespace()

static int find_oload_champ_namespace ( struct value **  args,
int  nargs,
const char *  func_name,
const char *  qualified_name,
struct symbol ***  oload_syms,
struct badness_vector **  oload_champ_bv,
const int  no_adl 
)
static

Definition at line 2831 of file valops.c.

References find_oload_champ_namespace_loop().

Referenced by find_overload_match().

◆ find_oload_champ_namespace_loop()

static int find_oload_champ_namespace_loop ( struct value **  args,
int  nargs,
const char *  func_name,
const char *  qualified_name,
int  namespace_len,
struct symbol ***  oload_syms,
struct badness_vector **  oload_champ_bv,
int *  oload_champ,
const int  no_adl 
)
static

◆ find_overload_match()

int find_overload_match ( struct value **  args,
int  nargs,
const char *  name,
enum oload_search_type  method,
struct value **  objp,
struct symbol fsym,
struct value **  valp,
struct symbol **  symp,
int *  staticp,
const int  no_adl,
const enum noside noside   
)

◆ get_value_at()

static struct value* get_value_at ( struct type type,
CORE_ADDR  addr,
int  lazy 
)
static

◆ oload_method_static_p()

static int oload_method_static_p ( struct fn_field fns_ptr,
int  index 
)
static

Definition at line 3116 of file valops.c.

References TYPE_FN_FIELD_STATIC_P.

Referenced by find_oload_champ(), and find_overload_match().

◆ read_value_memory()

void read_value_memory ( struct value val,
LONGEST  bit_offset,
int  stack,
CORE_ADDR  memaddr,
gdb_byte buffer,
size_t  length 
)

◆ search_struct_field()

static struct value * search_struct_field ( const char *  name,
struct value arg1,
struct type type,
int  looking_for_baseclass 
)
static

Definition at line 1968 of file valops.c.

References do_search_struct_field(), and name.

Referenced by find_overload_match(), value_cast_structs(), and value_struct_elt().

◆ search_struct_method()

static struct value * search_struct_method ( const char *  name,
struct value **  arg1p,
struct value **  args,
LONGEST  offset,
int *  static_memfuncp,
struct type type 
)
static

◆ show_overload_resolution()

static void show_overload_resolution ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 113 of file valops.c.

References _, and fprintf_filtered().

Referenced by _initialize_valops().

◆ typecmp()

static int typecmp ( int  staticp,
int  varargs,
int  nargs,
struct field  t1[],
struct value t2[] 
)
static

◆ update_search_result()

static void update_search_result ( struct value **  result_ptr,
struct value v,
LONGEST last_boffset,
LONGEST  boffset,
const char *  name,
struct type type 
)
static

Definition at line 1782 of file valops.c.

References _, error(), name, and TYPE_SAFE_NAME.

Referenced by do_search_struct_field().

◆ value_addr()

struct value* value_addr ( struct value arg1)

◆ value_aggregate_elt()

struct value* value_aggregate_elt ( struct type curtype,
const char *  name,
struct type expect_type,
int  want_address,
enum noside noside   
)

◆ value_allocate_space_in_inferior()

struct value* value_allocate_space_in_inferior ( int  len)

◆ value_array()

struct value* value_array ( int  lowbound,
int  highbound,
struct value **  elemvec 
)

◆ value_assign()

struct value* value_assign ( struct value toval,
struct value fromval 
)

Definition at line 993 of file valops.c.

References _, check_typedef(), coerce_array(), coerce_ref(), current_target, deprecated_safe_get_selected_frame(), deprecated_value_modifiable(), error(), frame_find_by_id(), gdb_assert, gdbarch_convert_register_p(), gdbarch_value_to_register(), get_frame_arch(), get_frame_id(), get_frame_register_bytes(), get_type_arch(), HOST_CHAR_BIT, lval_computed, lval_internalvar, lval_internalvar_component, lval_memory, lval_register, modify_field(), NOT_AVAILABLE_ERROR, observer_notify_register_changed(), observer_notify_target_changed(), offset, OPTIMIZED_OUT_ERROR, value::parent, put_frame_register_bytes(), read_memory(), select_frame(), set_internalvar(), set_internalvar_component(), set_value_enclosing_type(), set_value_lazy(), set_value_pointed_to_offset(), throw_error(), type, TYPE_CODE, TYPE_CODE_PTR, TYPE_LENGTH, type_length_units(), TYPE_UNSIGNED, value_address(), value_as_long(), value_bitpos(), value_bitsize(), value_cast(), value_computed_funcs(), value_contents(), value_contents_raw(), value_copy(), value_enclosing_type(), VALUE_FRAME_ID, value_from_longest(), VALUE_INTERNALVAR, VALUE_LVAL, value_must_coerce_to_target(), value_of_internalvar(), value_offset(), value_parent(), value_pointed_to_offset(), VALUE_REGNUM, value_type(), lval_funcs::write, and write_memory_with_notification().

Referenced by ada_value_assign(), evaluate_subexp_opencl(), evaluate_subexp_standard(), lval_func_write(), rust_evaluate_subexp(), rust_range(), rust_subscript(), and varobj_set_value().

◆ value_at()

struct value* value_at ( struct type type,
CORE_ADDR  addr 
)

◆ value_at_lazy()

struct value* value_at_lazy ( struct type type,
CORE_ADDR  addr 
)

◆ value_cast()

struct value* value_cast ( struct type type,
struct value arg2 
)

Definition at line 351 of file valops.c.

References _, allocate_value(), language_defn::c_style_arrays, cast_into_complex(), check_typedef(), coerce_ref(), cplus_make_method_ptr(), create_array_type(), create_static_range_type(), current_language, deprecated_set_value_type(), error(), extract_unsigned_integer(), gdb_assert, gdbarch_addr_bit(), gdbarch_byte_order(), get_discrete_bounds(), get_type_arch(), HOST_CHAR_BIT, is_floating_type(), is_floating_value(), lval_memory, not_lval, set_value_enclosing_type(), set_value_pointed_to_offset(), target_float_convert(), type, TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_BOOL, TYPE_CODE_CHAR, TYPE_CODE_COMPLEX, TYPE_CODE_DECFLOAT, TYPE_CODE_ENUM, TYPE_CODE_FLT, TYPE_CODE_FUNC, TYPE_CODE_INT, TYPE_CODE_MEMBERPTR, TYPE_CODE_METHODPTR, TYPE_CODE_PTR, TYPE_CODE_RANGE, TYPE_CODE_STRUCT, TYPE_CODE_UNION, TYPE_CODE_VOID, TYPE_INDEX_TYPE, TYPE_IS_REFERENCE, TYPE_LENGTH, TYPE_NAME, TYPE_TARGET_TYPE, TYPE_UNSIGNED, TYPE_VECTOR, value_address(), value_as_long(), value_at_lazy(), value_cast(), value_cast_pointers(), value_cast_structs(), value_coerce_array(), value_coerce_function(), value_contents(), value_contents_raw(), value_contents_writeable(), value_copy(), value_from_longest(), value_from_ulongest(), VALUE_LVAL, value_ref(), value_type(), value_zero(), and warning().

Referenced by aarch64_push_dummy_call(), ada_coerce_to_simple_array_ptr(), ada_evaluate_subexp(), ada_get_tsd_from_tag(), ada_promote_array_of_integrals(), ada_tag_value_at_base_address(), ada_val_print_num(), ada_value_assign(), ada_value_cast(), ada_value_ptr_subscript(), ada_value_slice(), adjust_value_for_child_access(), alpha_push_dummy_call(), binop_promote(), BP_MANIPULATION(), cast_from_fixed(), cast_to_fixed(), compute_exception(), cplus_describe_child(), desc_bounds(), evaluate_funcall(), evaluate_struct_tuple(), evaluate_subexp_for_address(), evaluate_subexp_for_cast(), evaluate_subexp_modula2(), evaluate_subexp_standard(), evaluate_subexp_with_coercion(), dwarf_expr_context::execute_stack_op(), gdbpy_get_xmethod_result_type(), gdbpy_invoke_xmethod(), gnuv2_value_rtti_type(), gnuv2_virtual_fn_field(), gnuv3_get_typeid(), gnuv3_get_virtual_fn(), gnuv3_method_ptr_to_value(), gnuv3_virtual_fn_field(), hppa64_push_dummy_call(), m88k_store_arguments(), opencl_value_cast(), printf_floating(), return_command(), rust_get_trait_object_pointer(), s390_unwind_pseudo_register(), sparc64_store_arguments(), thin_data_pntr(), unop_promote(), valpy_do_cast(), valpy_getitem(), value_arg_coerce(), value_assign(), value_assign_to_component(), value_cast(), value_dynamic_cast(), value_fn_field(), value_literal_complex(), value_reinterpret_cast(), value_vector_widen(), varobj_create(), vlscm_do_cast(), and xtensa_push_dummy_call().

◆ value_cast_pointers()

struct value* value_cast_pointers ( struct type type,
struct value arg2,
int  subclass_check 
)

◆ value_cast_structs()

static struct value* value_cast_structs ( struct type type,
struct value v2 
)
static

◆ value_coerce_array()

struct value* value_coerce_array ( struct value arg1)

◆ value_coerce_function()

struct value* value_coerce_function ( struct value arg1)

◆ value_coerce_to_target()

struct value* value_coerce_to_target ( struct value val)

◆ value_cstring()

struct value* value_cstring ( const char *  ptr,
ssize_t  len,
struct type char_type 
)

◆ value_dynamic_cast()

struct value* value_dynamic_cast ( struct type type,
struct value arg 
)

◆ value_find_oload_method_list()

static void value_find_oload_method_list ( struct value **  argp,
const char *  method,
LONGEST  offset,
struct fn_field **  fn_list,
int *  num_fns,
VEC(xmethod_worker_ptr) **  xm_worker_vec,
struct type **  basetype,
LONGEST boffset 
)
static

◆ value_full_object()

struct value* value_full_object ( struct value argp,
struct type rtype,
int  xfull,
int  xtop,
int  xusing_enc 
)

◆ value_ind()

struct value* value_ind ( struct value arg1)

Definition at line 1542 of file valops.c.

References _, check_typedef(), coerce_array(), error(), find_function_addr(), value::funcs, lval_funcs::indirect, lval_computed, readjust_indirect_value_type(), TYPE_CODE, TYPE_CODE_FUNC, TYPE_CODE_METHOD, TYPE_CODE_PTR, TYPE_TARGET_TYPE, value_as_address(), value_at_lazy(), value_computed_funcs(), value_enclosing_type(), VALUE_LVAL, value_pointed_to_offset(), and value_type().

Referenced by ada_array_bound(), ada_array_length(), ada_coerce_to_simple_array(), ada_evaluate_subexp(), ada_get_tsd_from_tag(), ada_tag_value_at_base_address(), ada_value_ind(), ada_value_ptr_subscript(), ada_value_struct_elt(), adjust_value_for_child_access(), c_describe_child(), c_value_print(), compute_exception(), decode_constrained_packed_array(), do_module_cleanup(), evaluate_funcall(), evaluate_subexp_for_sizeof(), evaluate_subexp_modula2(), evaluate_subexp_standard(), find_overload_match(), gdbscm_value_dereference(), gdbscm_value_dynamic_type(), gdbscm_value_referenced_value(), gnuv2_virtual_fn_field(), gnuv3_get_typeid(), gnuv3_method_ptr_to_value(), gnuv3_print_vtable(), info_mach_region_command(), read_fat_string_value(), rust_evaluate_funcall(), rust_evaluate_subexp(), valpy_dereference(), valpy_get_dynamic_type(), valpy_referenced_value(), value_cast_pointers(), value_dynamic_cast(), value_find_oload_method_list(), value_fn_field(), value_reinterpret_cast(), value_rtti_indirect_type(), value_struct_elt(), value_struct_elt_bitpos(), value_struct_elt_for_reference(), value_subscript(), and value_user_defined_cpp_op().

◆ value_literal_complex()

struct value* value_literal_complex ( struct value arg1,
struct value arg2,
struct type type 
)

◆ value_maybe_namespace_elt()

static struct value* value_maybe_namespace_elt ( const struct type curtype,
const char *  name,
int  want_address,
enum noside noside   
)
static

◆ value_must_coerce_to_target()

int value_must_coerce_to_target ( struct value val)

◆ value_namespace_elt()

static struct value* value_namespace_elt ( const struct type curtype,
const char *  name,
int  want_address,
enum noside noside   
)
static

Definition at line 3542 of file valops.c.

References _, error(), name, TYPE_TAG_NAME, and value_maybe_namespace_elt().

Referenced by value_aggregate_elt().

◆ value_of_this()

struct value* value_of_this ( const struct language_defn lang)

◆ value_of_this_silent()

struct value* value_of_this_silent ( const struct language_defn lang)

Definition at line 3757 of file valops.c.

References CATCH, END_CATCH, RETURN_MASK_ERROR, TRY, and value_of_this().

Referenced by value_struct_elt_for_reference(), and yyparse().

◆ value_of_variable()

struct value* value_of_variable ( struct symbol var,
const struct block b 
)

◆ value_one()

struct value* value_one ( struct type type)

◆ value_ref()

struct value* value_ref ( struct value arg1,
enum type_code  refcode 
)

◆ value_reinterpret_cast()

struct value* value_reinterpret_cast ( struct type type,
struct value arg 
)

◆ value_repeat()

struct value* value_repeat ( struct value arg1,
int  count 
)

◆ value_rtti_indirect_type()

struct type* value_rtti_indirect_type ( struct value v,
int *  full,
LONGEST top,
int *  using_enc 
)

◆ value_slice()

struct value* value_slice ( struct value array,
int  lowbound,
int  length 
)

◆ value_string()

struct value* value_string ( const char *  ptr,
ssize_t  len,
struct type char_type 
)

◆ value_struct_elt()

struct value* value_struct_elt ( struct value **  argp,
struct value **  args,
const char *  name,
int *  static_memfuncp,
const char *  err 
)

◆ value_struct_elt_bitpos()

struct value* value_struct_elt_bitpos ( struct value **  argp,
int  bitpos,
struct type ftype,
const char *  err 
)

◆ value_struct_elt_for_reference()

static struct value* value_struct_elt_for_reference ( struct type domain,
int  offset,
struct type curtype,
const char *  name,
struct type intype,
int  want_address,
enum noside noside   
)
static

◆ value_zero()

struct value* value_zero ( struct type type,
enum lval_type  lv 
)

Variable Documentation

◆ overload_debug

unsigned int overload_debug

Definition at line 124 of file gdbtypes.c.

Referenced by _initialize_gdbtypes(), find_oload_champ(), and rank_one_type().

◆ overload_resolution

int overload_resolution = 0

Definition at line 111 of file valops.c.

Referenced by _initialize_valops(), and evaluate_funcall().