diff options
Diffstat (limited to 'usr')
| -rw-r--r-- | usr/src/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh | 83 | ||||
| -rw-r--r-- | usr/src/lib/libdtrace/common/dt_consume.c | 6 | ||||
| -rw-r--r-- | usr/src/lib/libdtrace/common/dt_printf.c | 4 | ||||
| -rw-r--r-- | usr/src/lib/libdtrace/i386/dt_isadep.c | 18 | ||||
| -rw-r--r-- | usr/src/pkgdefs/SUNWdtrt/prototype_com | 1 |
5 files changed, 95 insertions, 17 deletions
diff --git a/usr/src/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh b/usr/src/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh new file mode 100644 index 0000000000..ed375fdbf9 --- /dev/null +++ b/usr/src/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh @@ -0,0 +1,83 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > test.c <<EOF +void +thequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydog(void) +{ + while (1) + ; +} + +int +main(int argc, char *argv[]) +{ + thequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydog(); +} +EOF + +cc -o test test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi + +script() +{ + $dtrace -c ./test -qs /dev/stdin <<EOF + profile:::profile-1001hz + /pid == \$target/ + { + @[arg1] = count(); + } + + tick-1s + /n++ > 10/ + { + printa("%A %@d\n", @); + exit(0); + } +EOF +} + +script +status=$? + +cd / +/usr/bin/rm -rf $DIR + +exit $status diff --git a/usr/src/lib/libdtrace/common/dt_consume.c b/usr/src/lib/libdtrace/common/dt_consume.c index 62d39e07dd..564189a000 100644 --- a/usr/src/lib/libdtrace/common/dt_consume.c +++ b/usr/src/lib/libdtrace/common/dt_consume.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdlib.h> #include <strings.h> #include <errno.h> @@ -1063,7 +1061,7 @@ dt_print_usym(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, dtrace_actkind_t act) do { n = len; s = alloca(n); - } while ((len = dtrace_uaddr2str(dtp, pid, pc, s, n)) >= n); + } while ((len = dtrace_uaddr2str(dtp, pid, pc, s, n)) > n); return (dt_printf(dtp, fp, format, s)); } diff --git a/usr/src/lib/libdtrace/common/dt_printf.c b/usr/src/lib/libdtrace/common/dt_printf.c index 82f5ed6bb7..4400771214 100644 --- a/usr/src/lib/libdtrace/common/dt_printf.c +++ b/usr/src/lib/libdtrace/common/dt_printf.c @@ -328,7 +328,7 @@ pfprint_addr(dtrace_hdl_t *dtp, FILE *fp, const char *format, do { n = len; s = alloca(n); - } while ((len = dtrace_addr2str(dtp, val, s, n)) >= n); + } while ((len = dtrace_addr2str(dtp, val, s, n)) > n); return (dt_printf(dtp, fp, format, s)); } @@ -381,7 +381,7 @@ pfprint_uaddr(dtrace_hdl_t *dtp, FILE *fp, const char *format, do { n = len; s = alloca(n); - } while ((len = dtrace_uaddr2str(dtp, pid, val, s, n)) >= n); + } while ((len = dtrace_uaddr2str(dtp, pid, val, s, n)) > n); return (dt_printf(dtp, fp, format, s)); } diff --git a/usr/src/lib/libdtrace/i386/dt_isadep.c b/usr/src/lib/libdtrace/i386/dt_isadep.c index d3c685adcd..c1484a4074 100644 --- a/usr/src/lib/libdtrace/i386/dt_isadep.c +++ b/usr/src/lib/libdtrace/i386/dt_isadep.c @@ -20,12 +20,10 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdlib.h> #include <assert.h> #include <errno.h> @@ -349,11 +347,16 @@ dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp, fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, const char *pattern) { uint8_t *text; - ulong_t i, end; int size; + ulong_t i, end = symp->st_size; pid_t pid = Pstatus(P)->pr_pid; char dmodel = Pstatus(P)->pr_dmodel; + ftp->ftps_type = DTFTP_OFFSETS; + ftp->ftps_pc = (uintptr_t)symp->st_value; + ftp->ftps_size = (size_t)symp->st_size; + ftp->ftps_noffs = 0; + if ((text = malloc(symp->st_size)) == NULL) { dt_dprintf("mr sparkle: malloc() failed\n"); return (DT_PROC_ERR); @@ -374,13 +377,6 @@ dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp, return (0); } - ftp->ftps_type = DTFTP_OFFSETS; - ftp->ftps_pc = (uintptr_t)symp->st_value; - ftp->ftps_size = (size_t)symp->st_size; - ftp->ftps_noffs = 0; - - end = ftp->ftps_size; - if (strcmp("*", pattern) == 0) { for (i = 0; i < end; i += size) { ftp->ftps_offs[ftp->ftps_noffs++] = i; diff --git a/usr/src/pkgdefs/SUNWdtrt/prototype_com b/usr/src/pkgdefs/SUNWdtrt/prototype_com index c1d5ec0ac7..8e9ff5cb0d 100644 --- a/usr/src/pkgdefs/SUNWdtrt/prototype_com +++ b/usr/src/pkgdefs/SUNWdtrt/prototype_com @@ -860,6 +860,7 @@ f none SUNWdtrt/tst/common/printa/tst.dynwidth.d 0444 root bin f none SUNWdtrt/tst/common/printa/tst.dynwidth.d.out 0444 root bin f none SUNWdtrt/tst/common/printa/tst.fmt.d 0444 root bin f none SUNWdtrt/tst/common/printa/tst.fmt.d.out 0444 root bin +f none SUNWdtrt/tst/common/printa/tst.largeusersym.ksh 0444 root bin f none SUNWdtrt/tst/common/printa/tst.many.d 0444 root bin f none SUNWdtrt/tst/common/printa/tst.manyval.d 0444 root bin f none SUNWdtrt/tst/common/printa/tst.manyval.d.out 0444 root bin |
