New function tyscm_scm_to_type.
authorDoug Evans <dje@google.com>
Mon, 7 Nov 2016 00:10:00 +0000 (16:10 -0800)
committerDoug Evans <dje@google.com>
Thu, 16 Mar 2017 16:26:18 +0000 (09:26 -0700)
gdb/ChangeLog:

* guile/guile-internal.h (tyscm_scm_to_type): Declare.
* guile/scm-type.c (tyscm_scm_to_type): New function.

gdb/ChangeLog
gdb/guile/guile-internal.h
gdb/guile/scm-type.c

index 9010d6fcd08e570143a40119b7d07f087729dc1a..14c9561ee335c70f2e0520fd13ff40a42c4a1b9f 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-16  Doug Evans  <dje@google.com>
+
+       * guile/guile-internal.h (tyscm_scm_to_type): Declare.
+       * guile/scm-type.c (tyscm_scm_to_type): New function.
+
 2017-03-16  Jiong Wang  <jiong.wang@arm.com>
 
        * inf-ptrace.c (inf_ptrace_peek_poke): Change the type to
index d6c4214a357efd1b9f8a519ec37b20c6c5b85900..361245f4dc7636f246e8f699c3400855b7434baa 100644 (file)
@@ -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);
index 42a8ad266611f11943c4d37d887a1571ae245b3f..b3036adec94d85063dc3e7aaa3e726f202dfa811 100644 (file)
@@ -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