Date: Wed, 5 Nov 2008 19:35:09 +0000 (UTC) From: Craig Rodrigues <rodrigc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r184696 - in head/cddl: . contrib/opensolaris/cmd/dtrace contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace contrib/opensolaris/lib/libdtrace/common Message-ID: <200811051935.mA5JZ9GB035415@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rodrigc Date: Wed Nov 5 19:35:09 2008 New Revision: 184696 URL: http://svn.freebsd.org/changeset/base/184696 Log: Merge latest DTrace changes from Perforce. Approved by: jb Modified: head/cddl/Makefile.inc head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h Modified: head/cddl/Makefile.inc ============================================================================== --- head/cddl/Makefile.inc Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/Makefile.inc Wed Nov 5 19:35:09 2008 (r184696) @@ -4,3 +4,5 @@ OPENSOLARIS_USR_DISTDIR= ${.CURDIR}/../. OPENSOLARIS_SYS_DISTDIR= ${.CURDIR}/../../../sys/cddl/contrib/opensolaris IGNORE_PRAGMA= YES + +CFLAGS+= -DNEED_SOLARIS_BOOLEAN Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Wed Nov 5 19:35:09 2008 (r184696) @@ -1576,7 +1576,7 @@ main(int argc, char *argv[]) if ((v = make_argv(optarg)) == NULL) fatal("failed to allocate memory"); - P = dtrace_proc_create(g_dtp, v[0], v); + P = dtrace_proc_create(g_dtp, v[0], v, NULL, NULL); if (P == NULL) dfatal(NULL); /* dtrace_errmsg() only */ Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst Wed Nov 5 19:35:09 2008 (r184696) @@ -23,7 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # Exception list: names tests that are bypassed when running in Java # mode (relative to /opt/SUNWdtrt/tst) @@ -49,6 +49,7 @@ common/usdt/tst.dlclose2.ksh common/usdt/tst.dlclose3.ksh common/usdt/tst.eliminate.ksh common/usdt/tst.enabled.ksh +common/usdt/tst.enabled2.ksh common/usdt/tst.entryreturn.ksh common/usdt/tst.fork.ksh common/usdt/tst.header.ksh Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Wed Nov 5 19:35:09 2008 (r184696) @@ -868,15 +868,19 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, i /* * We may have already processed this object file in an earlier linker * invocation. Check to see if the present instruction sequence matches - * the one we would install. + * the one we would install below. */ if (isenabled) { - if (ip[0] == DT_OP_CLR_O0) + if (ip[0] == DT_OP_NOP) { + (*off) += sizeof (ip[0]); return (0); + } } else { if (DT_IS_RESTORE(ip[1])) { - if (ip[0] == DT_OP_RET) + if (ip[0] == DT_OP_RET) { + (*off) += sizeof (ip[0]); return (0); + } } else if (DT_IS_MOV_O7(ip[1])) { if (DT_IS_RETL(ip[0])) return (0); @@ -910,7 +914,17 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, i return (-1); } - ip[0] = DT_OP_CLR_O0; + + /* + * On SPARC, we take advantage of the fact that the first + * argument shares the same register as for the return value. + * The macro handles the work of zeroing that register so we + * don't need to do anything special here. We instrument the + * instruction in the delay slot as we'll need to modify the + * return register after that instruction has been emulated. + */ + ip[0] = DT_OP_NOP; + (*off) += sizeof (ip[0]); } else { /* * If the call is followed by a restore, it's a tail call so @@ -919,11 +933,16 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, i * so change the call to a retl-like instruction that returns * to that register value + 8 (rather than the typical %o7 + * 8); the delay slot instruction is left, but should have no - * effect. Otherwise we change the call to be a nop. In the - * first and the last case we adjust the offset to land on what - * was once the delay slot of the call so we correctly get all - * the arguments as they would have been passed in a normal - * function call. + * effect. Otherwise we change the call to be a nop. We + * identify the subsequent instruction as the probe point in + * all but the leaf tail-call case to ensure that arguments to + * the probe are complete and consistent. An astute, though + * largely hypothetical, observer would note that there is the + * possibility of a false-positive probe firing if the function + * contained a branch to the instruction in the delay slot of + * the call. Fixing this would require significant in-kernel + * modifications, and isn't worth doing until we see it in the + * wild. */ if (DT_IS_RESTORE(ip[1])) { ip[0] = DT_OP_RET; Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Wed Nov 5 19:35:09 2008 (r184696) @@ -115,8 +115,9 @@ #define DT_VERS_1_5 DT_VERSION_NUMBER(1, 5, 0) #define DT_VERS_1_6 DT_VERSION_NUMBER(1, 6, 0) #define DT_VERS_1_6_1 DT_VERSION_NUMBER(1, 6, 1) -#define DT_VERS_LATEST DT_VERS_1_6_1 -#define DT_VERS_STRING "Sun D 1.6.1" +#define DT_VERS_1_6_2 DT_VERSION_NUMBER(1, 6, 2) +#define DT_VERS_LATEST DT_VERS_1_6_2 +#define DT_VERS_STRING "Sun D 1.6.2" const dt_version_t _dtrace_versions[] = { DT_VERS_1_0, /* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */ @@ -130,6 +131,7 @@ const dt_version_t _dtrace_versions[] = DT_VERS_1_5, /* D API 1.5 Solaris Express 7/07 */ DT_VERS_1_6, /* D API 1.6 */ DT_VERS_1_6_1, /* D API 1.6.1 */ + DT_VERS_1_6_2, /* D API 1.6.2 */ 0 }; Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Wed Nov 5 19:35:09 2008 (r184696) @@ -955,7 +955,8 @@ dt_proc_create_thread(dtrace_hdl_t *dtp, } struct ps_prochandle * -dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv) +dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv, + proc_child_func *pcf, void *child_arg) { dt_proc_hash_t *dph = dtp->dt_procs; dt_proc_t *dpr; @@ -981,7 +982,7 @@ dt_proc_create(dtrace_hdl_t *dtp, const #else (void) proc_clearflags(dpr->dpr_proc, PR_RLC); (void) proc_setflags(dpr->dpr_proc, PR_KLC); - if ((err = proc_create(file, argv, &dpr->dpr_proc)) != 0) + if ((err = proc_create(file, argv, pcf, child_arg, &dpr->dpr_proc)) != 0) return (dt_proc_error(dtp, dpr, "failed to execute %s: %s\n", file, strerror(err))); dpr->dpr_hdl = dtp; @@ -1183,10 +1184,11 @@ dt_proc_hash_destroy(dtrace_hdl_t *dtp) } struct ps_prochandle * -dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv) +dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv, + proc_child_func *pcf, void *child_arg) { dt_ident_t *idp = dt_idhash_lookup(dtp->dt_macros, "target"); - struct ps_prochandle *P = dt_proc_create(dtp, file, argv); + struct ps_prochandle *P = dt_proc_create(dtp, file, argv, pcf, child_arg); if (P != NULL && idp != NULL && idp->di_id == 0) #if defined(sun) Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h Wed Nov 5 19:35:09 2008 (r184696) @@ -99,7 +99,7 @@ typedef struct dt_proc_hash { } dt_proc_hash_t; extern struct ps_prochandle *dt_proc_create(dtrace_hdl_t *, - const char *, char *const *); + const char *, char *const *, proc_child_func *, void *); extern struct ps_prochandle *dt_proc_grab(dtrace_hdl_t *, pid_t, int, int); extern void dt_proc_release(dtrace_hdl_t *, struct ps_prochandle *); Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c Wed Nov 5 19:35:09 2008 (r184696) @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -436,8 +436,13 @@ dt_header_decl(dt_idhash_t *dhp, dt_iden if (fprintf(infop->dthi_out, ");\n") < 0) return (dt_set_errno(dtp, errno)); - if (fprintf(infop->dthi_out, "extern int " - "__dtraceenabled_%s___%s(void);\n", infop->dthi_pfname, fname) < 0) + if (fprintf(infop->dthi_out, + "#ifndef\t__sparc\n" + "extern int __dtraceenabled_%s___%s(void);\n" + "#else\n" + "extern int __dtraceenabled_%s___%s(long);\n" + "#endif\n", + infop->dthi_pfname, fname, infop->dthi_pfname, fname) < 0) return (dt_set_errno(dtp, errno)); return (0); @@ -499,13 +504,20 @@ dt_header_probe(dt_idhash_t *dhp, dt_ide return (dt_set_errno(dtp, errno)); if (!infop->dthi_empty) { - if (fprintf(infop->dthi_out, "#define\t%s_%s_ENABLED() \\\n", - infop->dthi_pmname, mname) < 0) - return (dt_set_errno(dtp, errno)); - - if (fprintf(infop->dthi_out, "\t__dtraceenabled_%s___%s()\n", + if (fprintf(infop->dthi_out, + "#ifndef\t__sparc\n" + "#define\t%s_%s_ENABLED() \\\n" + "\t__dtraceenabled_%s___%s()\n" + "#else\n" + "#define\t%s_%s_ENABLED() \\\n" + "\t__dtraceenabled_%s___%s(0)\n" + "#endif\n", + infop->dthi_pmname, mname, + infop->dthi_pfname, fname, + infop->dthi_pmname, mname, infop->dthi_pfname, fname) < 0) return (dt_set_errno(dtp, errno)); + } else { if (fprintf(infop->dthi_out, "#define\t%s_%s_ENABLED() (0)\n", infop->dthi_pmname, mname) < 0) Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h Wed Nov 5 17:12:18 2008 (r184695) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h Wed Nov 5 19:35:09 2008 (r184696) @@ -33,6 +33,7 @@ #include <stdarg.h> #include <stdio.h> #include <gelf.h> +#include <libproc.h> #ifdef __cplusplus extern "C" { @@ -413,7 +414,7 @@ extern int dtrace_aggregate_walk_valvarr */ extern struct ps_prochandle *dtrace_proc_create(dtrace_hdl_t *, - const char *, char *const *); + const char *, char *const *, proc_child_func *, void *); extern struct ps_prochandle *dtrace_proc_grab(dtrace_hdl_t *, pid_t, int); extern void dtrace_proc_release(dtrace_hdl_t *, struct ps_prochandle *);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811051935.mA5JZ9GB035415>