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>
*** 23,34 ****
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
- #pragma ident "%Z%%M% %I% %E% SMI"
-
#include <ctf_impl.h>
ssize_t
ctf_get_ctt_size(const ctf_file_t *fp, const ctf_type_t *tp, ssize_t *sizep,
ssize_t *incrementp)
--- 23,32 ----
*** 197,208 ****
/*
* Lookup the given type ID and print a string name for it into buf. Return
* the actual number of bytes (not including \0) needed to format the name.
*/
! ssize_t
! ctf_type_lname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len)
{
ctf_decl_t cd;
ctf_decl_node_t *cdp;
ctf_decl_prec_t prec, lp, rp;
int ptr, arr;
--- 195,207 ----
/*
* Lookup the given type ID and print a string name for it into buf. Return
* the actual number of bytes (not including \0) needed to format the name.
*/
! static ssize_t
! ctf_type_qlname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len,
! const char *qname)
{
ctf_decl_t cd;
ctf_decl_node_t *cdp;
ctf_decl_prec_t prec, lp, rp;
int ptr, arr;
*** 253,262 ****
--- 252,263 ----
switch (cdp->cd_kind) {
case CTF_K_INTEGER:
case CTF_K_FLOAT:
case CTF_K_TYPEDEF:
+ if (qname != NULL)
+ ctf_decl_sprintf(&cd, "%s`", qname);
ctf_decl_sprintf(&cd, "%s", name);
break;
case CTF_K_POINTER:
ctf_decl_sprintf(&cd, "*");
break;
*** 266,282 ****
case CTF_K_FUNCTION:
ctf_decl_sprintf(&cd, "()");
break;
case CTF_K_STRUCT:
case CTF_K_FORWARD:
! ctf_decl_sprintf(&cd, "struct %s", name);
break;
case CTF_K_UNION:
! ctf_decl_sprintf(&cd, "union %s", name);
break;
case CTF_K_ENUM:
! ctf_decl_sprintf(&cd, "enum %s", name);
break;
case CTF_K_VOLATILE:
ctf_decl_sprintf(&cd, "volatile");
break;
case CTF_K_CONST:
--- 267,292 ----
case CTF_K_FUNCTION:
ctf_decl_sprintf(&cd, "()");
break;
case CTF_K_STRUCT:
case CTF_K_FORWARD:
! ctf_decl_sprintf(&cd, "struct ");
! if (qname != NULL)
! ctf_decl_sprintf(&cd, "%s`", qname);
! ctf_decl_sprintf(&cd, "%s", name);
break;
case CTF_K_UNION:
! ctf_decl_sprintf(&cd, "union ");
! if (qname != NULL)
! ctf_decl_sprintf(&cd, "%s`", qname);
! ctf_decl_sprintf(&cd, "%s", name);
break;
case CTF_K_ENUM:
! ctf_decl_sprintf(&cd, "enum ");
! if (qname != NULL)
! ctf_decl_sprintf(&cd, "%s`", qname);
! ctf_decl_sprintf(&cd, "%s", name);
break;
case CTF_K_VOLATILE:
ctf_decl_sprintf(&cd, "volatile");
break;
case CTF_K_CONST:
*** 299,319 ****
ctf_decl_fini(&cd);
return (cd.cd_len);
}
/*
* Lookup the given type ID and print a string name for it into buf. If buf
* is too small, return NULL: the ECTF_NAMELEN error is set on 'fp' for us.
*/
char *
ctf_type_name(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len)
{
! ssize_t rv = ctf_type_lname(fp, type, buf, len);
return (rv >= 0 && rv < len ? buf : NULL);
}
/*
* Resolve the type down to a base type node, and then return the size
* of the type storage in bytes.
*/
ssize_t
--- 309,344 ----
ctf_decl_fini(&cd);
return (cd.cd_len);
}
+ ssize_t
+ ctf_type_lname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len)
+ {
+ return (ctf_type_qlname(fp, type, buf, len, NULL));
+ }
+
/*
* Lookup the given type ID and print a string name for it into buf. If buf
* is too small, return NULL: the ECTF_NAMELEN error is set on 'fp' for us.
*/
char *
ctf_type_name(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len)
{
! ssize_t rv = ctf_type_qlname(fp, type, buf, len, NULL);
! return (rv >= 0 && rv < len ? buf : NULL);
! }
!
! char *
! ctf_type_qname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len,
! const char *qname)
! {
! ssize_t rv = ctf_type_qlname(fp, type, buf, len, qname);
return (rv >= 0 && rv < len ? buf : NULL);
}
+
/*
* Resolve the type down to a base type node, and then return the size
* of the type storage in bytes.
*/
ssize_t