Print this page
libdtrace: attempt to resolve FORWARD types to concrete types

@@ -39,10 +39,11 @@
 #include <assert.h>
 #include <errno.h>
 
 #include <dt_impl.h>
 #include <dt_grammar.h>
+#include <dt_module.h>
 #include <dt_parser.h>
 #include <dt_provider.h>
 
 static void dt_cg_node(dt_node_t *, dt_irlist_t *, dt_regset_t *);
 

@@ -68,22 +69,11 @@
  * the actual definition and then call ctf_member_info on the result.
  */
 static ctf_file_t *
 dt_cg_membinfo(ctf_file_t *fp, ctf_id_t type, const char *s, ctf_membinfo_t *mp)
 {
-        while (ctf_type_kind(fp, type) == CTF_K_FORWARD) {
-                char n[DT_TYPE_NAMELEN];
-                dtrace_typeinfo_t dtt;
-
-                if (ctf_type_name(fp, type, n, sizeof (n)) == NULL ||
-                    dt_type_lookup(n, &dtt) == -1 || (
-                    dtt.dtt_ctfp == fp && dtt.dtt_type == type))
-                        break; /* unable to improve our position */
-
-                fp = dtt.dtt_ctfp;
-                type = ctf_type_resolve(fp, dtt.dtt_type);
-        }
+        dt_resolve_forward_decl(&fp, &type);
 
         if (ctf_member_info(fp, type, s, mp) == CTF_ERR)
                 return (NULL); /* ctf_errno is set for us */
 
         return (fp);