summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2008-11-05 19:35:09 +0000
committerrodrigc <rodrigc@FreeBSD.org>2008-11-05 19:35:09 +0000
commit9f34c4004df81e0f9ef5b1f40c4e24d9c220cf0d (patch)
tree0d63fb2a232ee601ee234ff3e8526ea1411a7f97 /cddl
parent8a6828b297af8141ab3609d76007dfbdc128f0cd (diff)
downloadFreeBSD-src-9f34c4004df81e0f9ef5b1f40c4e24d9c220cf0d.zip
FreeBSD-src-9f34c4004df81e0f9ef5b1f40c4e24d9c220cf0d.tar.gz
Merge latest DTrace changes from Perforce.
Approved by: jb
Diffstat (limited to 'cddl')
-rw-r--r--cddl/Makefile.inc2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/dtrace.c2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst3
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c37
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c6
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c10
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h2
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c28
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h3
9 files changed, 66 insertions, 27 deletions
diff --git a/cddl/Makefile.inc b/cddl/Makefile.inc
index bece244..99ef333 100644
--- a/cddl/Makefile.inc
+++ b/cddl/Makefile.inc
@@ -4,3 +4,5 @@ OPENSOLARIS_USR_DISTDIR= ${.CURDIR}/../../../cddl/contrib/opensolaris
OPENSOLARIS_SYS_DISTDIR= ${.CURDIR}/../../../sys/cddl/contrib/opensolaris
IGNORE_PRAGMA= YES
+
+CFLAGS+= -DNEED_SOLARIS_BOOLEAN
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
index f909e22..2580e63 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
@@ -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 */
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst b/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst
index f075618..261f870 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/jdtrace/exception.lst
@@ -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
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
index bc46df5..30377b5 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
@@ -868,15 +868,19 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
/*
* 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, int isenabled, GElf_Rela *rela,
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, int isenabled, GElf_Rela *rela,
* 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;
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
index ec7dec0..4830822 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
@@ -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
};
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
index b8662bf..f420a0c 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
@@ -955,7 +955,8 @@ dt_proc_create_thread(dtrace_hdl_t *dtp, dt_proc_t *dpr, uint_t stop)
}
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 char *file, char *const *argv)
#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)
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h
index a6c4382..b469f55 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h
@@ -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 *);
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c
index 1785668..e4fa801 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c
@@ -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_ident_t *idp, void *data)
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_ident_t *idp, void *data)
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)
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
index 895f776..00b32ee 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
@@ -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_valvarrevsorted(dtrace_hdl_t *,
*/
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 *);
OpenPOWER on IntegriCloud