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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdtrace/common/dt_xlator.c
          +++ new/usr/src/lib/libdtrace/common/dt_xlator.c
↓ open down ↓ 42 lines elided ↑ open up ↑
  43   43   * has dn_op set to DT_TOK_XLATE and refers back to the translator itself.  The
  44   44   * code generator will then use this as the indicator for dynamic translation.
  45   45   */
  46   46  /*ARGSUSED*/
  47   47  static int
  48   48  dt_xlator_create_member(const char *name, ctf_id_t type, ulong_t off, void *arg)
  49   49  {
  50   50          dt_xlator_t *dxp = arg;
  51   51          dtrace_hdl_t *dtp = dxp->dx_hdl;
  52   52          dt_node_t *enp, *mnp;
       53 +        ctf_file_t *ctfp;
  53   54  
  54   55          if ((enp = dt_node_xalloc(dtp, DT_NODE_XLATOR)) == NULL)
  55   56                  return (dt_set_errno(dtp, EDT_NOMEM));
  56   57  
  57   58          enp->dn_link = dxp->dx_nodes;
  58   59          dxp->dx_nodes = enp;
  59   60  
  60   61          if ((mnp = dt_node_xalloc(dtp, DT_NODE_MEMBER)) == NULL)
  61   62                  return (dt_set_errno(dtp, EDT_NOMEM));
  62   63  
↓ open down ↓ 1 lines elided ↑ open up ↑
  64   65          dxp->dx_nodes = mnp;
  65   66  
  66   67          /*
  67   68           * For the member expression, we use a DT_NODE_XLATOR/TOK_XLATE whose
  68   69           * xlator refers back to the translator and whose dn_xmember refers to
  69   70           * the current member.  These refs will be used by dt_cg.c and dt_as.c.
  70   71           */
  71   72          enp->dn_op = DT_TOK_XLATE;
  72   73          enp->dn_xlator = dxp;
  73   74          enp->dn_xmember = mnp;
  74      -        dt_node_type_assign(enp, dxp->dx_dst_ctfp, type, B_FALSE);
       75 +        /*
       76 +         * XXX: Is it ok for the CTF of the type to not be from the dst ctf?
       77 +         *
       78 +         * I suspect it's actually unnecessary, but I'm also unclear on
       79 +         * dynamic translators
       80 +         */
       81 +        dt_resolve_forward_decl(&ctfp, &type);
       82 +        dt_node_type_assign(enp, ctfp, type, B_FALSE);
  75   83  
  76   84          /*
  77   85           * For the member itself, we use a DT_NODE_MEMBER as usual with the
  78   86           * appropriate name, output type, and member expression set to 'enp'.
  79   87           */
  80   88          if (dxp->dx_members != NULL) {
  81   89                  assert(enp->dn_link->dn_kind == DT_NODE_MEMBER);
  82   90                  enp->dn_link->dn_list = mnp;
  83   91          } else
  84   92                  dxp->dx_members = mnp;
↓ open down ↓ 302 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX