void dt_probe_destroy(dt_probe_t *prp) { dt_probe_instance_t *pip, *pip_next; dtrace_hdl_t *dtp; if (prp->pr_pvp != NULL) dtp = prp->pr_pvp->pv_hdl; else dtp = yypcb->pcb_hdl; dt_node_list_free(&prp->pr_nargs); dt_node_list_free(&prp->pr_xargs); dt_free(dtp, prp->pr_nargv); dt_free(dtp, prp->pr_xargv); for (pip = prp->pr_inst; pip != NULL; pip = pip_next) { pip_next = pip->pi_next; dt_free(dtp, pip->pi_rname); dt_free(dtp, pip->pi_fname); dt_free(dtp, pip->pi_offs); dt_free(dtp, pip->pi_enoffs); dt_free(dtp, pip); } dt_free(dtp, prp->pr_mapping); dt_free(dtp, prp->pr_argv); dt_free(dtp, prp); }
void dt_decl_free(dt_decl_t *ddp) { dt_decl_t *ndp; for (; ddp != NULL; ddp = ndp) { ndp = ddp->dd_next; free(ddp->dd_name); dt_node_list_free(&ddp->dd_node); free(ddp); } }
/* * Process a control line #directive by looking up the directive name in our * lookup table and invoking the corresponding function with the token list. * According to K&R[A12.9], we silently ignore null directive lines. */ void dt_pragma(dt_node_t *pnp) { const struct dt_pragmadesc *dpd; dt_node_t *dnp; int kind = DT_PRAGMA_DIR; for (dnp = pnp; dnp != NULL; dnp = dnp->dn_list) { if (dnp->dn_kind == DT_NODE_INT) { dt_pragma_line("line", dnp); break; } if (dnp->dn_kind != DT_NODE_IDENT) xyerror(D_PRAGCTL_INVAL, "invalid control directive\n"); if (kind == DT_PRAGMA_DIR && strcmp(dnp->dn_string, "pragma") == 0) { kind = DT_PRAGMA_SUB; continue; } if (kind == DT_PRAGMA_SUB && strcmp(dnp->dn_string, "D") == 0) { kind = DT_PRAGMA_DCP; continue; } for (dpd = dt_pragmas; dpd->dpd_name != NULL; dpd++) { if (dpd->dpd_kind <= kind && strcmp(dpd->dpd_name, dnp->dn_string) == 0) break; } yylineno--; /* since we've already seen \n */ if (dpd->dpd_name != NULL) { dpd->dpd_func(dpd->dpd_name, dnp->dn_list); yylineno++; break; } switch (kind) { case DT_PRAGMA_DIR: xyerror(D_PRAGCTL_INVAL, "invalid control directive: " "#%s\n", dnp->dn_string); /*NOTREACHED*/ case DT_PRAGMA_SUB: break; /* K&R[A12.8] says to ignore unknown pragmas */ case DT_PRAGMA_DCP: default: xyerror(D_PRAGMA_INVAL, "invalid D pragma: %s\n", dnp->dn_string); } yylineno++; break; } dt_node_list_free(&pnp); }