GDB (xrefs)

Macros | Enumerations | Functions | Variables
scm-math.c File Reference
`#include "defs.h"`
`#include "arch-utils.h"`
`#include "charset.h"`
`#include "cp-abi.h"`
`#include "target-float.h"`
`#include "symtab.h"`
`#include "language.h"`
`#include "valprint.h"`
`#include "value.h"`
`#include "guile-internal.h"`

Go to the source code of this file.

## Macros
#define | STRIP_REFERENCE(TYPE) ((TYPE_CODE (TYPE) == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE))

## Enumerations
enum | valscm_unary_opcode { VALSCM_NOT, VALSCM_NEG, VALSCM_NOP, VALSCM_ABS, VALSCM_LOGNOT }
enum | valscm_binary_opcode { VALSCM_ADD, VALSCM_SUB, VALSCM_MUL, VALSCM_DIV, VALSCM_REM, VALSCM_MOD, VALSCM_POW, VALSCM_LSH, VALSCM_RSH, VALSCM_MIN, VALSCM_MAX, VALSCM_BITAND, VALSCM_BITOR, VALSCM_BITXOR }

## Functions
static SCM | vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
static SCM | vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y, const char *func_name)
static SCM | gdbscm_value_add (SCM x, SCM y)
static SCM | gdbscm_value_sub (SCM x, SCM y)
static SCM | gdbscm_value_mul (SCM x, SCM y)
static SCM | gdbscm_value_div (SCM x, SCM y)
static SCM | gdbscm_value_rem (SCM x, SCM y)
static SCM | gdbscm_value_mod (SCM x, SCM y)
static SCM | gdbscm_value_pow (SCM x, SCM y)
static SCM | gdbscm_value_neg (SCM x)
static SCM | gdbscm_value_pos (SCM x)
static SCM | gdbscm_value_abs (SCM x)
static SCM | gdbscm_value_lsh (SCM x, SCM y)
static SCM | gdbscm_value_rsh (SCM x, SCM y)
static SCM | gdbscm_value_min (SCM x, SCM y)
static SCM | gdbscm_value_max (SCM x, SCM y)
static SCM | gdbscm_value_not (SCM x)
static SCM | gdbscm_value_lognot (SCM x)
static SCM | gdbscm_value_logand (SCM x, SCM y)
static SCM | gdbscm_value_logior (SCM x, SCM y)
static SCM | gdbscm_value_logxor (SCM x, SCM y)
static SCM | vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
static SCM | gdbscm_value_eq_p (SCM x, SCM y)
static SCM | gdbscm_value_lt_p (SCM x, SCM y)
static SCM | gdbscm_value_le_p (SCM x, SCM y)
static SCM | gdbscm_value_gt_p (SCM x, SCM y)
static SCM | gdbscm_value_ge_p (SCM x, SCM y)
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 int | vlscm_integer_fits_p (SCM obj, struct type *type)
static struct value * | vlscm_convert_number (const char *func_name, int obj_arg_pos, SCM obj, struct gdbarch *gdbarch, SCM *except_scmp)
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)
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)
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)
void | gdbscm_initialize_math (void)

## Variables
static const scheme_function | math_functions []

## Macro Definition Documentation

## ◆ STRIP_REFERENCE

#define STRIP_REFERENCE | ( |  | TYPE | ) | ((TYPE_CODE (TYPE) == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE))

Definition at line 67 of file scm-math.c.

Referenced by vlscm_binop().

## Enumeration Type Documentation

## ◆ valscm_binary_opcode

enum valscm_binary_opcode

Enumerator
VALSCM_ADD |
VALSCM_SUB |
VALSCM_MUL |
VALSCM_DIV |
VALSCM_REM |
VALSCM_MOD |
VALSCM_POW |
VALSCM_LSH |
VALSCM_RSH |
VALSCM_MIN |
VALSCM_MAX |
VALSCM_BITAND |
VALSCM_BITOR |
VALSCM_BITXOR |

Definition at line 48 of file scm-math.c.

## ◆ valscm_unary_opcode

enum valscm_unary_opcode

Enumerator
VALSCM_NOT |
VALSCM_NEG |
VALSCM_NOP |
VALSCM_ABS |
VALSCM_LOGNOT |

Definition at line 37 of file scm-math.c.

## Function Documentation

## ◆ gdbscm_initialize_math()

void gdbscm_initialize_math | ( | void |  | ) |

Definition at line 1018 of file scm-math.c.

References gdbscm_define_functions(), and math_functions.

## ◆ gdbscm_value_abs()

static SCM gdbscm_value_abs | ( | SCM | x | ) |
| static

Definition at line 359 of file scm-math.c.

References FUNC_NAME, VALSCM_ABS, and vlscm_unop().

## ◆ gdbscm_value_add()

static SCM gdbscm_value_add | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 287 of file scm-math.c.

References FUNC_NAME, VALSCM_ADD, and vlscm_binop().

## ◆ gdbscm_value_div()

static SCM gdbscm_value_div | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 311 of file scm-math.c.

References FUNC_NAME, VALSCM_DIV, and vlscm_binop().

## ◆ gdbscm_value_eq_p()

static SCM gdbscm_value_eq_p | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 511 of file scm-math.c.

References FUNC_NAME, and vlscm_rich_compare().

## ◆ gdbscm_value_ge_p()

static SCM gdbscm_value_ge_p | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 543 of file scm-math.c.

References FUNC_NAME, and vlscm_rich_compare().

## ◆ gdbscm_value_gt_p()

static SCM gdbscm_value_gt_p | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 535 of file scm-math.c.

References FUNC_NAME, and vlscm_rich_compare().

## ◆ gdbscm_value_le_p()

static SCM gdbscm_value_le_p | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 527 of file scm-math.c.

References FUNC_NAME, and vlscm_rich_compare().

## ◆ gdbscm_value_logand()

static SCM gdbscm_value_logand | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 415 of file scm-math.c.

References FUNC_NAME, VALSCM_BITAND, and vlscm_binop().

## ◆ gdbscm_value_logior()

static SCM gdbscm_value_logior | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 423 of file scm-math.c.

References FUNC_NAME, VALSCM_BITOR, and vlscm_binop().

## ◆ gdbscm_value_lognot()

static SCM gdbscm_value_lognot | ( | SCM | x | ) |
| static

Definition at line 407 of file scm-math.c.

References FUNC_NAME, VALSCM_LOGNOT, and vlscm_unop().

## ◆ gdbscm_value_logxor()

static SCM gdbscm_value_logxor | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 431 of file scm-math.c.

References FUNC_NAME, VALSCM_BITXOR, and vlscm_binop().

## ◆ gdbscm_value_lsh()

static SCM gdbscm_value_lsh | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 367 of file scm-math.c.

References FUNC_NAME, VALSCM_LSH, and vlscm_binop().

## ◆ gdbscm_value_lt_p()

static SCM gdbscm_value_lt_p | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 519 of file scm-math.c.

References FUNC_NAME, and vlscm_rich_compare().

## ◆ gdbscm_value_max()

static SCM gdbscm_value_max | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 391 of file scm-math.c.

References FUNC_NAME, VALSCM_MAX, and vlscm_binop().

## ◆ gdbscm_value_min()

static SCM gdbscm_value_min | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 383 of file scm-math.c.

References FUNC_NAME, VALSCM_MIN, and vlscm_binop().

## ◆ gdbscm_value_mod()

static SCM gdbscm_value_mod | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 327 of file scm-math.c.

References FUNC_NAME, VALSCM_MOD, and vlscm_binop().

## ◆ gdbscm_value_mul()

static SCM gdbscm_value_mul | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 303 of file scm-math.c.

References FUNC_NAME, VALSCM_MUL, and vlscm_binop().

## ◆ gdbscm_value_neg()

static SCM gdbscm_value_neg | ( | SCM | x | ) |
| static

Definition at line 343 of file scm-math.c.

References FUNC_NAME, VALSCM_NEG, and vlscm_unop().

## ◆ gdbscm_value_not()

static SCM gdbscm_value_not | ( | SCM | x | ) |
| static

Definition at line 399 of file scm-math.c.

References FUNC_NAME, VALSCM_NOT, and vlscm_unop().

## ◆ gdbscm_value_pos()

static SCM gdbscm_value_pos | ( | SCM | x | ) |
| static

Definition at line 351 of file scm-math.c.

References FUNC_NAME, VALSCM_NOP, and vlscm_unop().

## ◆ gdbscm_value_pow()

static SCM gdbscm_value_pow | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 335 of file scm-math.c.

References FUNC_NAME, VALSCM_POW, and vlscm_binop().

## ◆ gdbscm_value_rem()

static SCM gdbscm_value_rem | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 319 of file scm-math.c.

References FUNC_NAME, VALSCM_REM, and vlscm_binop().

## ◆ gdbscm_value_rsh()

static SCM gdbscm_value_rsh | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 375 of file scm-math.c.

References FUNC_NAME, VALSCM_RSH, and vlscm_binop().

## ◆ gdbscm_value_sub()

static SCM gdbscm_value_sub | ( | SCM | x,
|  | SCM | y
| ) |  |
| static

Definition at line 295 of file scm-math.c.

References FUNC_NAME, VALSCM_SUB, and vlscm_binop().

## ◆ vlscm_binop()

static SCM vlscm_binop | ( | enum valscm_binary_opcode | opcode,
|  | SCM | x,
|  | SCM | y,
|  | const char * | func_name
| ) |  |
| static

Definition at line 150 of file scm-math.c.

References CATCH, check_typedef(), current_language, do_cleanups(), END_CATCH, gdb_assert, gdb_assert_not_reached, GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS, gdbscm_is_exception(), gdbscm_throw(), get_current_arch(), is_integral_type(), make_cleanup_value_free_to_mark(), RETURN_MASK_ALL, STRIP_REFERENCE, TRY, TYPE_CODE, TYPE_CODE_PTR, VALSCM_ADD, VALSCM_BITAND, VALSCM_BITOR, VALSCM_BITXOR, VALSCM_DIV, VALSCM_LSH, VALSCM_MAX, VALSCM_MIN, VALSCM_MOD, VALSCM_MUL, VALSCM_POW, VALSCM_REM, VALSCM_RSH, VALSCM_SUB, value_as_long(), value_binop(), value_from_longest(), value_mark(), value_ptradd(), value_ptrdiff(), value_type(), vlscm_convert_value_from_scheme(), and vlscm_scm_from_value().

Referenced by gdbscm_value_add(), gdbscm_value_div(), gdbscm_value_logand(), gdbscm_value_logior(), gdbscm_value_logxor(), gdbscm_value_lsh(), gdbscm_value_max(), gdbscm_value_min(), gdbscm_value_mod(), gdbscm_value_mul(), gdbscm_value_pow(), gdbscm_value_rem(), gdbscm_value_rsh(), and gdbscm_value_sub().

## ◆ vlscm_convert_bytevector()

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

Definition at line 711 of file scm-math.c.

References _, builtin_type(), builtin_type::builtin_uint8, check_typedef(), gdbscm_make_out_of_range_error(), lookup_array_range_type(), make_vector_type(), TYPE_LENGTH, and value_from_contents().

Referenced by vlscm_convert_typed_value_from_scheme().

## ◆ vlscm_convert_number()

static struct value* vlscm_convert_number | ( | const char * | func_name,
|  | int | obj_arg_pos,
|  | SCM | obj,
|  | struct gdbarch * | gdbarch,
|  | SCM * | except_scmp
| ) |  |
| static

Definition at line 656 of file scm-math.c.

References _, allocate_value(), builtin_type::builtin_double, builtin_type::builtin_int, builtin_type::builtin_long, builtin_type::builtin_long_long, builtin_type(), builtin_type::builtin_unsigned_int, builtin_type::builtin_unsigned_long, builtin_type::builtin_unsigned_long_long, gdbscm_make_out_of_range_error(), gdbscm_scm_to_longest(), gdbscm_scm_to_ulongest(), target_float_from_host_double(), value_contents_raw(), value_from_longest(), value_type(), and vlscm_integer_fits_p().

Referenced by vlscm_convert_typed_value_from_scheme().

## ◆ vlscm_convert_typed_number()

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

Definition at line 561 of file scm-math.c.

References _, allocate_value(), gdbscm_make_out_of_range_error(), gdbscm_make_type_error(), gdbscm_scm_to_longest(), gdbscm_scm_to_ulongest(), get_signed_type_minmax(), get_unsigned_type_max(), is_integral_type(), target_float_from_host_double(), TYPE_CODE, TYPE_CODE_FLT, TYPE_CODE_PTR, TYPE_UNSIGNED, value_contents_raw(), value_from_longest(), and value_type().

Referenced by vlscm_convert_typed_value_from_scheme().

## ◆ vlscm_convert_typed_value_from_scheme()

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
| ) |  |

Definition at line 757 of file scm-math.c.

References _, CATCH, do_cleanups(), END_CATCH, gdb_assert, gdbscm_is_bool, gdbscm_is_true, gdbscm_make_misc_error(), gdbscm_make_type_error(), gdbscm_scm_from_gdb_exception(), gdbscm_scm_to_string(), is_integral_type(), language_bool_type(), language_string_char_type(), lsscm_is_lazy_string(), lsscm_safe_lazy_string_to_value(), make_cleanup(), RETURN_MASK_ALL, target_charset(), TRY, value_copy(), value_cstring(), value_from_longest(), vlscm_convert_bytevector(), vlscm_convert_number(), vlscm_convert_typed_number(), vlscm_is_value(), vlscm_scm_to_value(), and xfree().

Referenced by gdbscm_make_value(), and vlscm_convert_value_from_scheme().

## ◆ vlscm_convert_value_from_scheme()

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
| ) |  |

Definition at line 903 of file scm-math.c.

References vlscm_convert_typed_value_from_scheme().

Referenced by gdbscm_value_call(), gdbscm_value_subscript(), ppscm_pretty_print_one_value(), ppscm_print_children(), vlscm_binop(), vlscm_rich_compare(), and vlscm_unop().

## ◆ vlscm_integer_fits_p()

static int vlscm_integer_fits_p | ( | SCM | obj,
|  | struct type * | type
| ) |  |
| static

Definition at line 618 of file scm-math.c.

References get_signed_type_minmax(), get_unsigned_type_max(), TYPE_LENGTH, and TYPE_UNSIGNED.

Referenced by vlscm_convert_number().

## ◆ vlscm_rich_compare()

static SCM vlscm_rich_compare | ( | int | op,
|  | SCM | x,
|  | SCM | y,
|  | const char * | func_name
| ) |  |
| static

Definition at line 440 of file scm-math.c.

References CATCH, current_language, do_cleanups(), END_CATCH, exception_none, gdb_assert_not_reached, GDBSCM_HANDLE_GDB_EXCEPTION, gdbscm_throw(), get_current_arch(), make_cleanup_value_free_to_mark(), RETURN_MASK_ALL, TRY, value_equal(), value_less(), value_mark(), and vlscm_convert_value_from_scheme().

Referenced by gdbscm_value_eq_p(), gdbscm_value_ge_p(), gdbscm_value_gt_p(), gdbscm_value_le_p(), and gdbscm_value_lt_p().

## ◆ vlscm_unop()

static SCM vlscm_unop | ( | enum valscm_unary_opcode | opcode,
|  | SCM | x,
|  | const char * | func_name
| ) |  |
| static

Definition at line 75 of file scm-math.c.

References CATCH, current_language, do_cleanups(), END_CATCH, gdb_assert, gdb_assert_not_reached, GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS, gdbscm_is_exception(), gdbscm_throw(), get_current_arch(), language_bool_type(), make_cleanup_value_free_to_mark(), not_lval, RETURN_MASK_ALL, TRY, VALSCM_ABS, VALSCM_LOGNOT, VALSCM_NEG, VALSCM_NOP, VALSCM_NOT, value_complement(), value_from_longest(), value_less(), value_logical_not(), value_mark(), value_neg(), value_type(), value_zero(), vlscm_convert_value_from_scheme(), and vlscm_scm_from_value().

Referenced by gdbscm_value_abs(), gdbscm_value_lognot(), gdbscm_value_neg(), gdbscm_value_not(), and gdbscm_value_pos().

## Variable Documentation

## ◆ math_functions

const scheme_function math_functions[]
| static

Definition at line 916 of file scm-math.c.

Referenced by gdbscm_initialize_math().