71 N_(
"type is not a structure, union, or enum type");
97 gdb_assert (htab !=
nullptr);
136 catch (
const gdb_exception_forced_quit &except)
140 catch (
const gdb_exception &except)
157 return htab_hash_pointer (t_smob->
type);
204 if (t_smob->
type != NULL)
232 scm_puts (
name.c_str (), port);
235 scm_puts (
">", port);
237 scm_remember_upto_here_1 (self);
249 struct type *type1, *type2;
256 type1_smob = (
type_smob *) SCM_SMOB_DATA (type1_scm);
257 type2_smob = (
type_smob *) SCM_SMOB_DATA (type2_scm);
258 type1 = type1_smob->
type;
259 type2 = type2_smob->
type;
266 catch (
const gdb_exception &except)
272 return scm_from_bool (result);
326 return (*slot)->containing_scm;
329 t_smob = (
type_smob *) SCM_SMOB_DATA (t_scm);
342 SCM_ASSERT_TYPE (
tyscm_is_type (self), self, arg_pos, func_name,
369 t_smob = (
type_smob *) SCM_SMOB_DATA (t_scm);
379 htab_t copied_types = (htab_t) info;
384 htab_empty (copied_types);
397 t_smob_for_lookup.
type = t_smob->
type;
399 gdb_assert (*new_slot == NULL);
418 scm_puts (
">", port);
420 scm_remember_upto_here_1 (self);
532 return scm_from_int (
type->
code ());
546 struct type *containing_type;
547 SCM containing_type_scm, result;
551 if (containing_type == NULL)
557 if (containing_type ==
type)
558 containing_type_scm = self;
563 for (i = 0; i < containing_type->
num_fields (); ++i)
566 return scm_reverse_x (result, SCM_EOL);
578 const char *tagname =
nullptr;
580 if (
type->
code () == TYPE_CODE_STRUCT
585 if (tagname ==
nullptr)
635 catch (
const gdb_exception &except)
659 catch (
const gdb_exception &except)
682 catch (
const gdb_exception &except)
696 if (
type->
code () != TYPE_CODE_STRUCT
708 const char *func_name)
714 struct type *array = NULL;
717 n1_scm, &
n1, n2_scm, &
n2);
719 if (SCM_UNBNDP (n2_scm))
728 scm_cons (scm_from_long (
n1),
730 _(
"Array length must not be negative"));
740 catch (
const gdb_exception &except)
796 catch (
const gdb_exception &except)
816 SCM low_scm, high_scm;
818 LONGEST low = 0, high = 0;
820 SCM_ASSERT_TYPE (
type->
code () == TYPE_CODE_ARRAY
821 ||
type->
code () == TYPE_CODE_STRING
822 ||
type->
code () == TYPE_CODE_RANGE,
823 self, SCM_ARG1,
FUNC_NAME, _(
"ranged type"));
827 case TYPE_CODE_ARRAY:
828 case TYPE_CODE_STRING:
829 case TYPE_CODE_RANGE:
845 return scm_list_2 (low_scm, high_scm);
863 catch (
const gdb_exception &except)
902 catch (
const gdb_exception &except)
926 catch (
const gdb_exception &except)
950 catch (
const gdb_exception &except)
989 SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2,
FUNC_NAME,
1008 if (t_field_name && (
strcmp_iw (t_field_name,
field.get ()) == 0))
1010 field.reset (
nullptr);
1017 _(
"Unknown field"));
1030 SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2,
FUNC_NAME,
1043 gdb::unique_xmalloc_ptr<char>
field
1050 if (t_field_name && (
strcmp_iw (t_field_name,
field.get ()) == 0))
1067 struct type *containing_type;
1068 SCM containing_type_scm;
1071 if (containing_type == NULL)
1077 if (containing_type ==
type)
1078 containing_type_scm = self;
1098 SCM it_scm, result, progress, object;
1108 t_smob = (
type_smob *) SCM_SMOB_DATA (
object);
1111 SCM_ASSERT_TYPE (scm_is_signed_integer (progress,
1113 progress, SCM_ARG1,
FUNC_NAME, _(
"integer"));
1114 field = scm_to_int (progress);
1170 SCM_ASSERT_TYPE (
type->
code () == TYPE_CODE_ENUM,
1171 self, SCM_ARG1,
FUNC_NAME, _(
"enum type"));
1187 SCM_ASSERT_TYPE (
type->
code () != TYPE_CODE_ENUM,
1188 self, SCM_ARG1,
FUNC_NAME, _(
"non-enum type"));
1229 if (
type->
code () == TYPE_CODE_STRUCT)
1245 if (startswith (type_name,
"struct "))
1247 else if (startswith (type_name,
"union "))
1249 else if (startswith (type_name,
"enum "))
1253 type_name,
block, 0);
1255 catch (
const gdb_exception &except)
1271 SCM block_scm = SCM_BOOL_F;
1272 int block_arg_pos = -1;
1278 rest, &block_arg_pos, &block_scm);
1280 if (block_arg_pos != -1)
1306 {
"TYPE_CODE_BITSTRING", -1 },
1308#define OP(SYM) { #SYM, SYM },
1309#include "type-codes.def"
1319Return #t if the object is a <gdb:type> object." },
1323Return the <gdb:type> object representing string or #f if not found.\n\
1324If block is given then the type is looked for in that block.\n\
1326 Arguments: string [#:block <gdb:block>]" },
1330Return the code of the type" },
1334Return the tag name of the type, or #f if there isn't one." },
1338Return the name of the type as a string, or #f if there isn't one." },
1342Return the print name of the type as a string." },
1346Return the size of the type, in bytes." },
1348 {
"type-strip-typedefs", 1, 0, 0,
1351Return a type formed by stripping the type of all typedefs." },
1355Return a type representing an array of objects of the type.\n\
1357 Arguments: <gdb:type> [low-bound] high-bound\n\
1358 If low-bound is not provided zero is used.\n\
1359 N.B. If only the high-bound parameter is specified, it is not\n\
1361 Valid bounds for array indices are [low-bound,high-bound]." },
1365Return a type representing a vector of objects of the type.\n\
1366Vectors differ from arrays in that if the current language has C-style\n\
1367arrays, vectors don't decay to a pointer to the first element.\n\
1368They are first class values.\n\
1370 Arguments: <gdb:type> [low-bound] high-bound\n\
1371 If low-bound is not provided zero is used.\n\
1372 N.B. If only the high-bound parameter is specified, it is not\n\
1374 Valid bounds for array indices are [low-bound,high-bound]." },
1378Return a type of pointer to the type." },
1382Return (low high) representing the range for the type." },
1386Return a type of reference to the type." },
1390Return the target type of the type." },
1394Return a const variant of the type." },
1398Return a volatile variant of the type." },
1402Return a variant of the type without const or volatile attributes." },
1406Return the number of fields of the type." },
1410Return the list of <gdb:field> objects of fields of the type." },
1412 {
"make-field-iterator", 1, 0, 0,
1415Return a <gdb:iterator> object for iterating over the fields of the type." },
1419Return the field named by string of the type.\n\
1421 Arguments: <gdb:type> string" },
1425Return #t if the type has field named string.\n\
1427 Arguments: <gdb:type> string" },
1431Return #t if the object is a <gdb:field> object." },
1435Return the name of the field." },
1439Return the type of the field." },
1443Return the enum value represented by the field." },
1447Return the offset in bits of the field in its containing type." },
1451Return the size of the field in bits." },
1455Return #t if the field is artificial." },
1459Return #t if the field is a baseclass." },
1481 = scm_c_define_gsubr (
"%type-next-field!", 1, 0, 0,
1486Internal function to assist the type fields iterator."));
static struct parser_state * pstate
void set(unsigned key, void *datum)
struct type * copy_type_recursive(struct type *type, htab_t copied_types)
struct type * lookup_pointer_type(struct type *type)
struct type * lookup_enum(const char *name, const struct block *block)
struct type * lookup_lvalue_reference_type(struct type *type)
struct type * lookup_typename(const struct language_defn *language, const char *name, const struct block *block, int noerr)
htab_up create_copied_types_hash()
struct type * lookup_array_range_type(struct type *element_type, LONGEST low_bound, LONGEST high_bound)
struct type * make_cv_type(int cnst, int voltl, struct type *type, struct type **typeptr)
bool types_deeply_equal(struct type *type1, struct type *type2)
struct type * lookup_struct(const char *name, const struct block *block)
struct type * lookup_union(const char *name, const struct block *block)
struct type * check_typedef(struct type *type)
void make_vector_type(struct type *array_type)
#define TYPE_N_BASECLASSES(thistype)
void itscm_set_iterator_smob_progress_x(iterator_smob *i_smob, SCM progress)
void gdbscm_init_eqable_gsmob(eqable_gdb_smob *base, SCM containing_scm)
SCM itscm_iterator_smob_object(iterator_smob *i_smob)
SCM itscm_iterator_smob_progress(iterator_smob *i_smob)
void gdbscm_parse_function_args(const char *function_name, int beginning_arg_pos, const SCM *keywords, const char *format,...)
#define END_INTEGER_CONSTANTS
SCM gdbscm_documentation_symbol
gdbscm_gdb_exception unpack(const gdb_exception &exc)
htab_t gdbscm_create_eqable_gsmob_ptr_map(htab_hash hash_fn, htab_eq eq_fn)
void gdbscm_init_gsmob(gdb_smob *base)
SCM gdbscm_scm_from_gdb_exception(const gdbscm_gdb_exception &exception)
SCM gdbscm_scm_from_longest(LONGEST l)
SCM gdbscm_make_iterator(SCM object, SCM progress, SCM next)
void gdbscm_out_of_range_error(const char *subr, int arg_pos, SCM bad_value, const char *error) ATTRIBUTE_NORETURN
void gdbscm_clear_eqable_gsmob_ptr_slot(htab_t htab, eqable_gdb_smob *base)
void gdbscm_printf(SCM port, const char *format,...) ATTRIBUTE_PRINTF(2
gdb::unique_xmalloc_ptr< char > gdbscm_scm_to_c_string(SCM string)
void gdbscm_define_integer_constants(const scheme_integer_constant *, int is_public)
const struct block * bkscm_scm_to_block(SCM block_scm, int arg_pos, const char *func_name, SCM *excp)
static SCM scm_new_smob(scm_t_bits tc, scm_t_bits data)
void gdbscm_define_functions(const scheme_function *, int is_public)
eqable_gdb_smob ** gdbscm_find_eqable_gsmob_ptr_slot(htab_t htab, eqable_gdb_smob *base)
#define GDBSCM_HANDLE_GDB_EXCEPTION(exception)
void gdbscm_fill_eqable_gsmob_ptr_slot(eqable_gdb_smob **slot, eqable_gdb_smob *base)
scm_t_bits gdbscm_make_smob_type(const char *name, size_t size)
void gdbscm_throw(SCM exception) ATTRIBUTE_NORETURN
SCM itscm_get_iterator_arg_unsafe(SCM self, int arg_pos, const char *func_name)
int gdb_scheme_initialized
static scm_t_subr as_a_scm_t_subr(SCM(*func)(void))
SCM gdbscm_end_of_iteration(void)
SCM gdbscm_scm_from_c_string(const char *string)
const struct language_defn * current_language
static SCM tyscm_next_field_x_proc
static SCM gdbscm_field_artificial_p(SCM self)
static SCM gdbscm_type_num_fields(SCM self)
static int tyscm_print_type_smob(SCM self, SCM port, scm_print_state *pstate)
void gdbscm_initialize_types(void)
static SCM gdbscm_type_p(SCM self)
static SCM tyscm_array_1(SCM self, SCM n1_scm, SCM n2_scm, int is_vector, const char *func_name)
SCM tyscm_scm_from_field(SCM type_scm, int field_num)
static struct field * tyscm_field_smob_to_field(field_smob *f_smob)
struct type * tyscm_type_smob_type(type_smob *t_smob)
static SCM gdbscm_type_code(SCM self)
static SCM gdbscm_type_name(SCM self)
static SCM gdbscm_field_name(SCM self)
static size_t tyscm_free_type_smob(SCM self)
static const char not_composite_error[]
static SCM gdbscm_make_field_iterator(SCM self)
static SCM gdbscm_type_volatile(SCM self)
static SCM gdbscm_field_type(SCM self)
static scm_t_bits field_smob_tag
static SCM gdbscm_type_reference(SCM self)
static const char type_smob_name[]
static SCM gdbscm_field_bitsize(SCM self)
static SCM gdbscm_type_print_name(SCM self)
static struct type * tyscm_field_smob_containing_type(field_smob *f_smob)
static const scheme_function type_functions[]
static SCM gdbscm_type_unqualified(SCM self)
static SCM gdbscm_type_target(SCM self)
static htab_t tyscm_type_map(struct type *type)
static SCM gdbscm_type_next_field_x(SCM self)
static scm_t_bits type_smob_tag
int tyscm_is_type(SCM self)
SCM tyscm_scm_from_type(struct type *type)
static int tyscm_is_field(SCM self)
static SCM tyscm_get_type_arg_unsafe(SCM self, int arg_pos, const char *func_name)
static SCM tyscm_equal_p_type_smob(SCM type1_scm, SCM type2_scm)
static SCM gdbscm_type_fields(SCM self)
static const scheme_integer_constant type_integer_constants[]
static SCM gdbscm_type_range(SCM self)
static struct type * tyscm_get_composite(struct type *type)
static int tyscm_copy_type_recursive(void **slot, void *info)
static std::string tyscm_type_name(struct type *type)
static SCM gdbscm_field_bitpos(SCM self)
static const registry< objfile >::key< htab, tyscm_deleter > tyscm_objfile_data_key
static hashval_t tyscm_hash_type_smob(const void *p)
static SCM gdbscm_field_p(SCM self)
static int tyscm_print_field_smob(SCM self, SCM port, scm_print_state *pstate)
struct type * tyscm_scm_to_type(SCM t_scm)
static SCM gdbscm_type_strip_typedefs(SCM self)
static SCM gdbscm_field_enumval(SCM self)
static struct type * tyscm_lookup_typename(const char *type_name, const struct block *block)
static SCM gdbscm_type_has_field_p(SCM self, SCM field_scm)
static SCM gdbscm_type_array(SCM self, SCM n1, SCM n2)
type_smob * tyscm_get_type_smob_arg_unsafe(SCM self, int arg_pos, const char *func_name)
static SCM tyscm_make_type_smob(void)
static SCM tyscm_make_field_smob(SCM type_scm, int field_num)
static SCM gdbscm_type_vector(SCM self, SCM n1, SCM n2)
static SCM gdbscm_field_baseclass_p(SCM self)
static htab_t global_types_map
static SCM gdbscm_lookup_type(SCM name_scm, SCM rest)
static int tyscm_eq_type_smob(const void *ap, const void *bp)
static field_smob * tyscm_get_field_smob_arg_unsafe(SCM self, int arg_pos, const char *func_name)
static SCM gdbscm_type_pointer(SCM self)
static SCM gdbscm_type_sizeof(SCM self)
static SCM gdbscm_type_field(SCM self, SCM field_scm)
static const char field_smob_name[]
static SCM gdbscm_type_tag(SCM self)
static SCM tyscm_get_field_arg_unsafe(SCM self, int arg_pos, const char *func_name)
static SCM gdbscm_type_const(SCM self)
LONGEST const_val() const
LONGEST loc_bitpos() const
bool is_artificial() const
LONGEST loc_enumval() const
const char * name() const
struct type * type() const
virtual void print_type(struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const =0
struct type * target_type() const
struct field & field(int idx) const
struct objfile * objfile_owner() const
unsigned int num_fields() const
struct field * fields() const
range_bounds * bounds() const
const char * name() const
void operator()(htab_t htab)
void quit_force(int *exit_arg, int from_tty)
const struct type_print_options type_print_raw_options
int strcmp_iw(const char *string1, const char *string2)