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>


 116         ctf_sect_t dm_strtab;   /* string table for module */
 117         ctf_sect_t dm_ctdata;   /* CTF data for module */
 118         ctf_file_t *dm_ctfp;    /* CTF container handle */
 119         uint_t *dm_symbuckets;  /* symbol table hash buckets (chain indices) */
 120         dt_sym_t *dm_symchains; /* symbol table hash chains buffer */
 121         void *dm_asmap;         /* symbol pointers sorted by value */
 122         uint_t dm_symfree;      /* index of next free hash element */
 123         uint_t dm_nsymbuckets;  /* number of elements in bucket array */
 124         uint_t dm_nsymelems;    /* number of elements in hash table */
 125         uint_t dm_asrsv;        /* actual reserved size of dm_asmap */
 126         uint_t dm_aslen;        /* number of entries in dm_asmap */
 127         uint_t dm_flags;        /* module flags (see below) */
 128         int dm_modid;           /* modinfo(1M) module identifier */
 129         GElf_Addr dm_text_va;   /* virtual address of text section */
 130         GElf_Xword dm_text_size; /* size in bytes of text section */
 131         GElf_Addr dm_data_va;   /* virtual address of data section */
 132         GElf_Xword dm_data_size; /* size in bytes of data section */
 133         GElf_Addr dm_bss_va;    /* virtual address of BSS */
 134         GElf_Xword dm_bss_size; /* size in bytes of BSS */
 135         dt_idhash_t *dm_extern; /* external symbol definitions */




 136 } dt_module_t;
 137 
 138 #define DT_DM_LOADED    0x1     /* module symbol and type data is loaded */
 139 #define DT_DM_KERNEL    0x2     /* module is associated with a kernel object */
 140 #define DT_DM_PRIMARY   0x4     /* module is a krtld primary kernel object */
 141 
 142 typedef struct dt_provmod {
 143         char *dp_name;                          /* name of provider module */
 144         struct dt_provmod *dp_next;             /* next module */
 145 } dt_provmod_t;
 146 
 147 typedef struct dt_ahashent {
 148         struct dt_ahashent *dtahe_prev;         /* prev on hash chain */
 149         struct dt_ahashent *dtahe_next;         /* next on hash chain */
 150         struct dt_ahashent *dtahe_prevall;      /* prev on list of all */
 151         struct dt_ahashent *dtahe_nextall;      /* next on list of all */
 152         uint64_t dtahe_hashval;                 /* hash value */
 153         size_t dtahe_size;                      /* size of data */
 154         dtrace_aggdata_t dtahe_data;            /* data */
 155         void (*dtahe_aggregate)(int64_t *, int64_t *, size_t); /* function */


 496         EDT_ERRABORT,           /* abort due to error */
 497         EDT_DROPABORT,          /* abort due to drop */
 498         EDT_DIRABORT,           /* abort explicitly directed */
 499         EDT_BADRVAL,            /* invalid return value from callback */
 500         EDT_BADNORMAL,          /* invalid normalization */
 501         EDT_BUFTOOSMALL,        /* enabling exceeds size of buffer */
 502         EDT_BADTRUNC,           /* invalid truncation */
 503         EDT_BUSY,               /* device busy (active kernel debugger) */
 504         EDT_ACCESS,             /* insufficient privileges to use DTrace */
 505         EDT_NOENT,              /* dtrace device not available */
 506         EDT_BRICKED,            /* abort due to systemic unresponsiveness */
 507         EDT_HARDWIRE,           /* failed to load hard-wired definitions */
 508         EDT_ELFVERSION,         /* libelf is out-of-date w.r.t libdtrace */
 509         EDT_NOBUFFERED,         /* attempt to buffer output without handler */
 510         EDT_UNSTABLE,           /* description matched unstable set of probes */
 511         EDT_BADSETOPT,          /* invalid setopt library action */
 512         EDT_BADSTACKPC,         /* invalid stack program counter size */
 513         EDT_BADAGGVAR,          /* invalid aggregation variable identifier */
 514         EDT_OVERSION,           /* client is requesting deprecated version */
 515         EDT_ENABLING_ERR,       /* failed to enable probe */
 516         EDT_NOPROBES            /* no probes sites for declared provider */

 517 };
 518 
 519 /*
 520  * Interfaces for parsing and comparing DTrace attribute tuples, which describe
 521  * stability and architectural binding information.  The dtrace_attribute_t
 522  * structure and associated constant definitions are found in <sys/dtrace.h>.
 523  */
 524 extern dtrace_attribute_t dt_attr_min(dtrace_attribute_t, dtrace_attribute_t);
 525 extern dtrace_attribute_t dt_attr_max(dtrace_attribute_t, dtrace_attribute_t);
 526 extern char *dt_attr_str(dtrace_attribute_t, char *, size_t);
 527 extern int dt_attr_cmp(dtrace_attribute_t, dtrace_attribute_t);
 528 
 529 /*
 530  * Interfaces for parsing and handling DTrace version strings.  Version binding
 531  * is a feature of the D compiler that is handled completely independently of
 532  * the DTrace kernel infrastructure, so the definitions are here in libdtrace.
 533  * Version strings are compiled into an encoded uint32_t which can be compared
 534  * using C comparison operators.  Version definitions are found in dt_open.c.
 535  */
 536 #define DT_VERSION_STRMAX       16      /* enough for "255.4095.4095\0" */




 116         ctf_sect_t dm_strtab;   /* string table for module */
 117         ctf_sect_t dm_ctdata;   /* CTF data for module */
 118         ctf_file_t *dm_ctfp;    /* CTF container handle */
 119         uint_t *dm_symbuckets;  /* symbol table hash buckets (chain indices) */
 120         dt_sym_t *dm_symchains; /* symbol table hash chains buffer */
 121         void *dm_asmap;         /* symbol pointers sorted by value */
 122         uint_t dm_symfree;      /* index of next free hash element */
 123         uint_t dm_nsymbuckets;  /* number of elements in bucket array */
 124         uint_t dm_nsymelems;    /* number of elements in hash table */
 125         uint_t dm_asrsv;        /* actual reserved size of dm_asmap */
 126         uint_t dm_aslen;        /* number of entries in dm_asmap */
 127         uint_t dm_flags;        /* module flags (see below) */
 128         int dm_modid;           /* modinfo(1M) module identifier */
 129         GElf_Addr dm_text_va;   /* virtual address of text section */
 130         GElf_Xword dm_text_size; /* size in bytes of text section */
 131         GElf_Addr dm_data_va;   /* virtual address of data section */
 132         GElf_Xword dm_data_size; /* size in bytes of data section */
 133         GElf_Addr dm_bss_va;    /* virtual address of BSS */
 134         GElf_Xword dm_bss_size; /* size in bytes of BSS */
 135         dt_idhash_t *dm_extern; /* external symbol definitions */
 136         pid_t dm_pid;           /* pid for this module */
 137         uint_t dm_nctflibs;     /* number of ctf children libraries */
 138         ctf_file_t **dm_libctfp; /* process library ctf pointers */
 139         char **dm_libctfn;      /* names of process ctf containers */
 140 } dt_module_t;
 141 
 142 #define DT_DM_LOADED    0x1     /* module symbol and type data is loaded */
 143 #define DT_DM_KERNEL    0x2     /* module is associated with a kernel object */
 144 #define DT_DM_PRIMARY   0x4     /* module is a krtld primary kernel object */
 145 
 146 typedef struct dt_provmod {
 147         char *dp_name;                          /* name of provider module */
 148         struct dt_provmod *dp_next;             /* next module */
 149 } dt_provmod_t;
 150 
 151 typedef struct dt_ahashent {
 152         struct dt_ahashent *dtahe_prev;         /* prev on hash chain */
 153         struct dt_ahashent *dtahe_next;         /* next on hash chain */
 154         struct dt_ahashent *dtahe_prevall;      /* prev on list of all */
 155         struct dt_ahashent *dtahe_nextall;      /* next on list of all */
 156         uint64_t dtahe_hashval;                 /* hash value */
 157         size_t dtahe_size;                      /* size of data */
 158         dtrace_aggdata_t dtahe_data;            /* data */
 159         void (*dtahe_aggregate)(int64_t *, int64_t *, size_t); /* function */


 500         EDT_ERRABORT,           /* abort due to error */
 501         EDT_DROPABORT,          /* abort due to drop */
 502         EDT_DIRABORT,           /* abort explicitly directed */
 503         EDT_BADRVAL,            /* invalid return value from callback */
 504         EDT_BADNORMAL,          /* invalid normalization */
 505         EDT_BUFTOOSMALL,        /* enabling exceeds size of buffer */
 506         EDT_BADTRUNC,           /* invalid truncation */
 507         EDT_BUSY,               /* device busy (active kernel debugger) */
 508         EDT_ACCESS,             /* insufficient privileges to use DTrace */
 509         EDT_NOENT,              /* dtrace device not available */
 510         EDT_BRICKED,            /* abort due to systemic unresponsiveness */
 511         EDT_HARDWIRE,           /* failed to load hard-wired definitions */
 512         EDT_ELFVERSION,         /* libelf is out-of-date w.r.t libdtrace */
 513         EDT_NOBUFFERED,         /* attempt to buffer output without handler */
 514         EDT_UNSTABLE,           /* description matched unstable set of probes */
 515         EDT_BADSETOPT,          /* invalid setopt library action */
 516         EDT_BADSTACKPC,         /* invalid stack program counter size */
 517         EDT_BADAGGVAR,          /* invalid aggregation variable identifier */
 518         EDT_OVERSION,           /* client is requesting deprecated version */
 519         EDT_ENABLING_ERR,       /* failed to enable probe */
 520         EDT_NOPROBES,           /* no probes sites for declared provider */
 521         EDT_CANTLOAD            /* failed to load a module */
 522 };
 523 
 524 /*
 525  * Interfaces for parsing and comparing DTrace attribute tuples, which describe
 526  * stability and architectural binding information.  The dtrace_attribute_t
 527  * structure and associated constant definitions are found in <sys/dtrace.h>.
 528  */
 529 extern dtrace_attribute_t dt_attr_min(dtrace_attribute_t, dtrace_attribute_t);
 530 extern dtrace_attribute_t dt_attr_max(dtrace_attribute_t, dtrace_attribute_t);
 531 extern char *dt_attr_str(dtrace_attribute_t, char *, size_t);
 532 extern int dt_attr_cmp(dtrace_attribute_t, dtrace_attribute_t);
 533 
 534 /*
 535  * Interfaces for parsing and handling DTrace version strings.  Version binding
 536  * is a feature of the D compiler that is handled completely independently of
 537  * the DTrace kernel infrastructure, so the definitions are here in libdtrace.
 538  * Version strings are compiled into an encoded uint32_t which can be compared
 539  * using C comparison operators.  Version definitions are found in dt_open.c.
 540  */
 541 #define DT_VERSION_STRMAX       16      /* enough for "255.4095.4095\0" */