67#define STRIP_REFERENCE(TYPE) \
68 ((TYPE->code () == TYPE_CODE_REF) ? ((TYPE)->target_type ()) : (TYPE))
75 const char *func_name)
89 struct value *res_val = NULL;
121 gdb_assert_not_reached (
"unsupported operation");
124 gdb_assert (res_val != NULL);
139 const char *func_name)
143 struct value *arg1, *arg2;
144 struct value *res_val = NULL;
171 if (ltype->
code () == TYPE_CODE_PTR
174 else if (rtype->
code () == TYPE_CODE_PTR
191 if (ltype->
code () == TYPE_CODE_PTR
192 && rtype->
code () == TYPE_CODE_PTR)
199 else if (ltype->
code () == TYPE_CODE_PTR
234 res_val =
value_binop (arg1, arg2, BINOP_BITWISE_AND);
237 res_val =
value_binop (arg1, arg2, BINOP_BITWISE_IOR);
240 res_val =
value_binop (arg1, arg2, BINOP_BITWISE_XOR);
243 gdb_assert_not_reached (
"unsupported operation");
246 gdb_assert (res_val != NULL);
256 const char *func_name)
453 gdb_assert_not_reached (
"not-equal not implemented");
462 gdb_assert_not_reached (
"invalid <gdb:value> comparison");
464 return scm_from_bool (result);
524 int type_arg_pos, SCM type_scm,
struct type *
type,
532 if (!scm_is_unsigned_integer (obj, 0, max))
536 (func_name, obj_arg_pos, obj,
537 _(
"value out of range for type"));
547 if (!scm_is_signed_integer (obj, min, max))
551 (func_name, obj_arg_pos, obj,
552 _(
"value out of range for type"));
558 else if (
type->
code () == TYPE_CODE_PTR)
561 if (!scm_is_unsigned_integer (obj, 0, max))
565 (func_name, obj_arg_pos, obj,
566 _(
"value out of range for type"));
571 else if (
type->
code () == TYPE_CODE_FLT)
593 return scm_is_unsigned_integer (obj, 0, max);
603 return scm_is_signed_integer (obj, min, max);
629 if (scm_is_exact (obj) && scm_is_integer (obj))
650 else if (scm_is_real (obj))
654 _(
"value not a number representable on the target"));
671 int arg_pos,
const char *func_name,
674 LONGEST length = SCM_BYTEVECTOR_LENGTH (bv);
688 _(
"size of type does not match size of bytevector"));
693 (gdb_byte *) SCM_BYTEVECTOR_CONTENTS (bv));
717 int obj_arg_pos, SCM obj,
718 int type_arg_pos, SCM type_scm,
725 SCM except_scm = SCM_BOOL_F;
729 gdb_assert (type_arg_pos == -1);
730 gdb_assert (SCM_UNBNDP (type_scm));
733 *except_scmp = SCM_BOOL_F;
743 _(
"No type allowed"));
752 obj_arg_pos, func_name,
772 else if (scm_is_number (obj))
777 type_arg_pos, type_scm,
type,
786 else if (scm_is_string (obj))
794 _(
"No type allowed"));
800 gdb::unique_xmalloc_ptr<char> s
817 _(
"No type allowed"));
834 catch (
const gdb_exception &except)
841 gdb_assert (
value == NULL);
842 *except_scmp = except_scm;
854 int obj_arg_pos, SCM obj,
859 -1, SCM_UNDEFINED, NULL,
890Return a mod b. See Knuth 1.2.4." },
894Return pow (x, y)." },
922Return min (a, b)." },
926Return max (a, b)." },
struct gdbarch * get_current_arch(void)
const char * target_charset(struct gdbarch *gdbarch)
int is_integral_type(struct type *t)
struct type * lookup_array_range_type(struct type *element_type, LONGEST low_bound, LONGEST high_bound)
CORE_ADDR get_pointer_type_max(struct type *type)
void get_signed_type_minmax(struct type *type, LONGEST *min, LONGEST *max)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
ULONGEST get_unsigned_type_max(struct type *type)
struct type * check_typedef(struct type *type)
void make_vector_type(struct type *array_type)
SCM gdbscm_make_out_of_range_error(const char *subr, int arg_pos, SCM bad_value, const char *error)
#define gdbscm_is_true(scm)
SCM gdbscm_make_type_error(const char *subr, int arg_pos, SCM bad_value, const char *expected_type)
SCM gdbscm_wrap(Function &&func, Args &&... args)
struct value * vlscm_scm_to_value(SCM scm)
int vlscm_is_value(SCM scm)
gdbscm_gdb_exception unpack(const gdb_exception &exc)
SCM gdbscm_make_misc_error(const char *subr, int arg_pos, SCM bad_value, const char *error)
SCM vlscm_scm_from_value(struct value *value)
SCM gdbscm_scm_from_gdb_exception(const gdbscm_gdb_exception &exception)
int lsscm_is_lazy_string(SCM scm)
ULONGEST gdbscm_scm_to_ulongest(SCM u)
LONGEST gdbscm_scm_to_longest(SCM l)
#define gdbscm_is_bool(scm)
SCM gdb::unique_xmalloc_ptr< char > gdbscm_scm_to_string(SCM string, size_t *lenp, const char *charset, int strict, SCM *except_scmp)
void gdbscm_define_functions(const scheme_function *, int is_public)
struct value * lsscm_safe_lazy_string_to_value(SCM string, int arg_pos, const char *func_name, SCM *except_scmp)
static scm_t_subr as_a_scm_t_subr(SCM(*func)(void))
const struct language_defn * current_language
struct type * language_bool_type(const struct language_defn *la, struct gdbarch *gdbarch)
static SCM gdbscm_value_logior(SCM x, SCM y)
static SCM gdbscm_value_pos(SCM x)
struct value * vlscm_convert_value_from_scheme(const char *func_name, int obj_arg_pos, SCM obj, SCM *except_scmp, struct gdbarch *gdbarch, const struct language_defn *language)
struct value * vlscm_convert_typed_value_from_scheme(const char *func_name, int obj_arg_pos, SCM obj, int type_arg_pos, SCM type_scm, struct type *type, SCM *except_scmp, struct gdbarch *gdbarch, const struct language_defn *language)
static SCM gdbscm_value_add(SCM x, SCM y)
static SCM gdbscm_value_max(SCM x, SCM y)
static SCM gdbscm_value_eq_p(SCM x, SCM y)
static SCM gdbscm_value_lognot(SCM x)
static SCM gdbscm_value_lsh(SCM x, SCM y)
static SCM gdbscm_value_abs(SCM x)
static SCM gdbscm_value_rsh(SCM x, SCM y)
static SCM gdbscm_value_rem(SCM x, SCM y)
static SCM vlscm_unop_gdbthrow(enum valscm_unary_opcode opcode, SCM x, const char *func_name)
static int vlscm_integer_fits_p(SCM obj, struct type *type)
static SCM gdbscm_value_logxor(SCM x, SCM y)
static SCM gdbscm_value_mul(SCM x, SCM y)
static SCM gdbscm_value_neg(SCM x)
static SCM gdbscm_value_gt_p(SCM x, SCM y)
static const scheme_function math_functions[]
static SCM vlscm_binop_gdbthrow(enum valscm_binary_opcode opcode, SCM x, SCM y, const char *func_name)
void gdbscm_initialize_math(void)
static struct value * vlscm_convert_bytevector(SCM bv, struct type *type, SCM type_scm, int arg_pos, const char *func_name, SCM *except_scmp, struct gdbarch *gdbarch)
static SCM gdbscm_value_div(SCM x, SCM y)
static SCM gdbscm_value_le_p(SCM x, SCM y)
static SCM gdbscm_value_pow(SCM x, SCM y)
static SCM vlscm_binop(enum valscm_binary_opcode opcode, SCM x, SCM y, const char *func_name)
static SCM gdbscm_value_min(SCM x, SCM y)
#define STRIP_REFERENCE(TYPE)
static SCM gdbscm_value_logand(SCM x, SCM y)
static SCM vlscm_unop(enum valscm_unary_opcode opcode, SCM x, const char *func_name)
static SCM gdbscm_value_mod(SCM x, SCM y)
static SCM gdbscm_value_sub(SCM x, SCM y)
static struct value * vlscm_convert_number(const char *func_name, int obj_arg_pos, SCM obj, struct gdbarch *gdbarch, SCM *except_scmp)
static SCM gdbscm_value_lt_p(SCM x, SCM y)
static SCM gdbscm_value_ge_p(SCM x, SCM y)
static SCM vlscm_rich_compare(int op, SCM x, SCM y, const char *func_name)
static struct value * vlscm_convert_typed_number(const char *func_name, int obj_arg_pos, SCM obj, int type_arg_pos, SCM type_scm, struct type *type, struct gdbarch *gdbarch, SCM *except_scmp)
static SCM gdbscm_value_not(SCM x)
struct type * builtin_uint8
static struct value * zero(struct type *type, enum lval_type lv)
struct value * copy() const
struct type * type() const
bool value_logical_not(struct value *arg1)
struct value * value_neg(struct value *arg1)
struct value * value_complement(struct value *arg1)
int value_equal(struct value *arg1, struct value *arg2)
int value_less(struct value *arg1, struct value *arg2)
struct value * value_ptradd(struct value *arg1, LONGEST arg2)
LONGEST value_ptrdiff(struct value *arg1, struct value *arg2)
struct value * value_binop(struct value *arg1, struct value *arg2, enum exp_opcode op)
struct value * value_from_longest(struct type *type, LONGEST num)
struct value * value_from_contents(struct type *type, const gdb_byte *contents)
LONGEST value_as_long(struct value *val)
struct value * value_from_host_double(struct type *type, double d)
struct value * value_from_pointer(struct type *type, CORE_ADDR addr)