Print this page
4474 DTrace Userland CTF Support
4475 DTrace userland Keyword
4476 DTrace tests should be better citizens
4479 pid provider types
4480 dof emulation missing checks
Reviewed by: Bryan Cantrill <bryan@joyent.com>

*** 19,29 **** * CDDL HEADER END */ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. ! * Copyright (c) 2011, Joyent Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. */ /* * DTrace D Language Compiler --- 19,29 ---- * CDDL HEADER END */ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. ! * Copyright (c) 2013, Joyent Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. */ /* * DTrace D Language Compiler
*** 660,669 **** --- 660,671 ---- } static void dt_action_trace(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) { + int ctflib; + dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp); boolean_t istrace = (dnp->dn_ident->di_id == DT_ACT_TRACE); const char *act = istrace ? "trace" : "print"; if (dt_node_is_void(dnp->dn_args)) {
*** 691,716 **** * to the fully-qualified CTF type ID for the result of the DIF * action. We use the ID instead of the name to handles complex types * like arrays and function pointers that can't be resolved by * ctf_type_lookup(). This is later processed by dtrace_dof_create() * and turned into a reference into the string table so that we can ! * get the type information when we process the data after the fact. */ if (dnp->dn_ident->di_id == DT_ACT_PRINT) { dt_node_t *dret; size_t n; dt_module_t *dmp; dret = yypcb->pcb_dret; dmp = dt_module_lookup_by_ctf(dtp, dret->dn_ctfp); ! n = snprintf(NULL, 0, "%s`%d", dmp->dm_name, dret->dn_type) + 1; sdp->dtsd_strdata = dt_alloc(dtp, n); if (sdp->dtsd_strdata == NULL) longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); ! (void) snprintf(sdp->dtsd_strdata, n, "%s`%d", dmp->dm_name, ! dret->dn_type); } ap->dtad_difo = dt_as(yypcb); ap->dtad_kind = DTRACEACT_DIFEXPR; } --- 693,734 ---- * to the fully-qualified CTF type ID for the result of the DIF * action. We use the ID instead of the name to handles complex types * like arrays and function pointers that can't be resolved by * ctf_type_lookup(). This is later processed by dtrace_dof_create() * and turned into a reference into the string table so that we can ! * get the type information when we process the data after the fact. In ! * the case where we are referring to userland CTF data, we also need to ! * to identify which ctf container in question we care about and encode ! * that within the name. */ if (dnp->dn_ident->di_id == DT_ACT_PRINT) { dt_node_t *dret; size_t n; dt_module_t *dmp; dret = yypcb->pcb_dret; dmp = dt_module_lookup_by_ctf(dtp, dret->dn_ctfp); ! if (dmp->dm_pid != 0) { ! ctflib = dt_module_getlibid(dtp, dmp, dret->dn_ctfp); ! assert(ctflib >= 0); ! n = snprintf(NULL, 0, "%s`%d`%d", dmp->dm_name, ! ctflib, dret->dn_type) + 1; ! } else { ! n = snprintf(NULL, 0, "%s`%d", dmp->dm_name, ! dret->dn_type) + 1; ! } sdp->dtsd_strdata = dt_alloc(dtp, n); if (sdp->dtsd_strdata == NULL) longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); ! if (dmp->dm_pid != 0) { ! (void) snprintf(sdp->dtsd_strdata, n, "%s`%d`%d", ! dmp->dm_name, ctflib, dret->dn_type); ! } else { ! (void) snprintf(sdp->dtsd_strdata, n, "%s`%d", ! dmp->dm_name, dret->dn_type); ! } } ap->dtad_difo = dt_as(yypcb); ap->dtad_kind = DTRACEACT_DIFEXPR; }