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>


   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 
  23 /*
  24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  25  * Use is subject to license terms.
  26  */
  27 
  28 /*
  29  * Copyright (c) 2012 by Delphix. All rights reserved.

  30  */
  31 
  32 #include <strings.h>
  33 #include <stdio.h>
  34 
  35 #include <dt_impl.h>
  36 #include <dt_ident.h>
  37 
  38 /*ARGSUSED*/
  39 static void
  40 dt_dis_log(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
  41 {
  42         (void) fprintf(fp, "%-4s %%r%u, %%r%u, %%r%u", name,
  43             DIF_INSTR_R1(in), DIF_INSTR_R2(in), DIF_INSTR_RD(in));
  44 }
  45 
  46 /*ARGSUSED*/
  47 static void
  48 dt_dis_branch(const dtrace_difo_t *dp, const char *name,
  49         dif_instr_t in, FILE *fp)


 295                 break;
 296         case CTF_K_FORWARD:
 297                 (void) strcpy(ckind, "forward");
 298                 break;
 299         case CTF_K_TYPEDEF:
 300                 (void) strcpy(ckind, "typedef");
 301                 break;
 302         case CTF_K_VOLATILE:
 303                 (void) strcpy(ckind, "volatile");
 304                 break;
 305         case CTF_K_CONST:
 306                 (void) strcpy(ckind, "const");
 307                 break;
 308         case CTF_K_RESTRICT:
 309                 (void) strcpy(ckind, "restrict");
 310                 break;
 311         default:
 312                 (void) snprintf(ckind, sizeof (ckind), "0x%x", t->dtdt_ckind);
 313         }
 314 
 315         if (t->dtdt_flags & DIF_TF_BYREF) {
 316                 (void) snprintf(buf, len, "%s (%s) by ref (size %lu)",
 317                     kind, ckind, (ulong_t)t->dtdt_size);

 318         } else {
 319                 (void) snprintf(buf, len, "%s (%s) (size %lu)",
 320                     kind, ckind, (ulong_t)t->dtdt_size);
 321         }
 322 
 323         return (buf);
 324 }
 325 
 326 static void
 327 dt_dis_rtab(const char *rtag, const dtrace_difo_t *dp, FILE *fp,
 328     const dof_relodesc_t *rp, uint32_t len)
 329 {
 330         (void) fprintf(fp, "\n%-4s %-8s %-8s %s\n",
 331             rtag, "OFFSET", "DATA", "NAME");
 332 
 333         for (; len != 0; len--, rp++) {
 334                 (void) fprintf(fp, "%-4u %-8llu %-8llu %s\n",
 335                     rp->dofr_type, (u_longlong_t)rp->dofr_offset,
 336                     (u_longlong_t)rp->dofr_data,
 337                     &dp->dtdo_strtab[rp->dofr_name]);




   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 
  23 /*
  24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  25  * Use is subject to license terms.
  26  */
  27 
  28 /*
  29  * Copyright (c) 2013 by Delphix. All rights reserved.
  30  * Copyright (c) 2013 Joyent, Inc. All rights reserved.
  31  */
  32 
  33 #include <strings.h>
  34 #include <stdio.h>
  35 
  36 #include <dt_impl.h>
  37 #include <dt_ident.h>
  38 
  39 /*ARGSUSED*/
  40 static void
  41 dt_dis_log(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
  42 {
  43         (void) fprintf(fp, "%-4s %%r%u, %%r%u, %%r%u", name,
  44             DIF_INSTR_R1(in), DIF_INSTR_R2(in), DIF_INSTR_RD(in));
  45 }
  46 
  47 /*ARGSUSED*/
  48 static void
  49 dt_dis_branch(const dtrace_difo_t *dp, const char *name,
  50         dif_instr_t in, FILE *fp)


 296                 break;
 297         case CTF_K_FORWARD:
 298                 (void) strcpy(ckind, "forward");
 299                 break;
 300         case CTF_K_TYPEDEF:
 301                 (void) strcpy(ckind, "typedef");
 302                 break;
 303         case CTF_K_VOLATILE:
 304                 (void) strcpy(ckind, "volatile");
 305                 break;
 306         case CTF_K_CONST:
 307                 (void) strcpy(ckind, "const");
 308                 break;
 309         case CTF_K_RESTRICT:
 310                 (void) strcpy(ckind, "restrict");
 311                 break;
 312         default:
 313                 (void) snprintf(ckind, sizeof (ckind), "0x%x", t->dtdt_ckind);
 314         }
 315 
 316         if (t->dtdt_flags & (DIF_TF_BYREF | DIF_TF_BYUREF)) {
 317                 (void) snprintf(buf, len, "%s (%s) by %sref (size %lu)",
 318                     kind, ckind, (t->dtdt_flags & DIF_TF_BYUREF) ? "user " : "",
 319                     (ulong_t)t->dtdt_size);
 320         } else {
 321                 (void) snprintf(buf, len, "%s (%s) (size %lu)",
 322                     kind, ckind, (ulong_t)t->dtdt_size);
 323         }
 324 
 325         return (buf);
 326 }
 327 
 328 static void
 329 dt_dis_rtab(const char *rtag, const dtrace_difo_t *dp, FILE *fp,
 330     const dof_relodesc_t *rp, uint32_t len)
 331 {
 332         (void) fprintf(fp, "\n%-4s %-8s %-8s %s\n",
 333             rtag, "OFFSET", "DATA", "NAME");
 334 
 335         for (; len != 0; len--, rp++) {
 336                 (void) fprintf(fp, "%-4u %-8llu %-8llu %s\n",
 337                     rp->dofr_type, (u_longlong_t)rp->dofr_offset,
 338                     (u_longlong_t)rp->dofr_data,
 339                     &dp->dtdo_strtab[rp->dofr_name]);