aboutsummaryrefslogtreecommitdiff
path: root/gdb/guile
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2016-11-06 16:10:00 -0800
committerDoug Evans <dje@google.com>2017-03-16 09:26:18 -0700
commita3a5feccd26be653efbdf1408874b98962baaa50 (patch)
treef93ed928cc32277f5bf2ebb186e11d417026aafa /gdb/guile
parentf8d995870f957d5fd32fb21fb4afe76a754ddf31 (diff)
New function tyscm_scm_to_type.
gdb/ChangeLog: * guile/guile-internal.h (tyscm_scm_to_type): Declare. * guile/scm-type.c (tyscm_scm_to_type): New function.
Diffstat (limited to 'gdb/guile')
-rw-r--r--gdb/guile/guile-internal.h2
-rw-r--r--gdb/guile/scm-type.c13
2 files changed, 15 insertions, 0 deletions
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index d6c4214a35..361245f4dc 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -561,6 +561,8 @@ extern SCM tyscm_scm_from_type (struct type *type);
extern type_smob *tyscm_get_type_smob_arg_unsafe (SCM type_scm, int arg_pos,
const char *func_name);
+extern struct type *tyscm_scm_to_type (SCM t_scm);
+
extern struct type *tyscm_type_smob_type (type_smob *t_smob);
extern SCM tyscm_scm_from_field (SCM type_scm, int field_num);
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 42a8ad2666..b3036adec9 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -333,6 +333,19 @@ tyscm_get_type_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name)
return t_smob;
}
+/* Return the type field of T_SCM, an object of type <gdb:type>.
+ This exists so that we don't have to export the struct's contents. */
+
+struct type *
+tyscm_scm_to_type (SCM t_scm)
+{
+ type_smob *t_smob;
+
+ gdb_assert (tyscm_is_type (t_scm));
+ t_smob = (type_smob *) SCM_SMOB_DATA (t_scm);
+ return t_smob->type;
+}
+
/* Helper function for save_objfile_types to make a deep copy of the type. */
static int