From owner-svn-src-vendor@FreeBSD.ORG Tue Jun 3 01:24:52 2014 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5A0ECAA4; Tue, 3 Jun 2014 01:24:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 438B829A4; Tue, 3 Jun 2014 01:24:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s531OqYV043223; Tue, 3 Jun 2014 01:24:52 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s531Ol97043176; Tue, 3 Jun 2014 01:24:47 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201406030124.s531Ol97043176@svn.freebsd.org> From: Mark Johnston Date: Tue, 3 Jun 2014 01:24:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r266989 - vendor-sys/illumos/dist/uts/common/dtrace vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/cmd/dtrace vendor/illumos/dist/cmd/dtrace/test/tst/common/pid vendor/illum... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jun 2014 01:24:52 -0000 Author: markj Date: Tue Jun 3 01:24:46 2014 New Revision: 266989 URL: http://svnweb.freebsd.org/changeset/base/266989 Log: 4474 DTrace Userland CTF Support 4475 DTrace userland Keyword 4476 DTrace tests should be better citizens 4479 pid provider types 4480 dof emulation is missing checks illumos/illumos-gate@a386cc11a86ecb60f5a48078d22c1500e2ad003e Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid2.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid3.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidtype.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidtype2.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.user64mode.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.c (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.c (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh.out vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.c (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.linkmap.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.pidprint.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.pidprinttarg.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.c (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.ksh.out vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtypetarg.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.userlandkey.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.userlandkey.ksh.out vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.userstrings.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.userstrings.ksh.out Modified: vendor/illumos/dist/cmd/dtrace/dtrace.c vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.header.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.static.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.user.ksh vendor/illumos/dist/cmd/dtrace/test/tst/sparc/usdt/tst.tailcall.ksh vendor/illumos/dist/common/ctf/ctf_open.c vendor/illumos/dist/common/ctf/ctf_types.c vendor/illumos/dist/lib/libdtrace/common/dt_as.c vendor/illumos/dist/lib/libdtrace/common/dt_cc.c vendor/illumos/dist/lib/libdtrace/common/dt_decl.c vendor/illumos/dist/lib/libdtrace/common/dt_decl.h vendor/illumos/dist/lib/libdtrace/common/dt_dis.c vendor/illumos/dist/lib/libdtrace/common/dt_error.c vendor/illumos/dist/lib/libdtrace/common/dt_grammar.y vendor/illumos/dist/lib/libdtrace/common/dt_ident.c vendor/illumos/dist/lib/libdtrace/common/dt_impl.h vendor/illumos/dist/lib/libdtrace/common/dt_lex.l vendor/illumos/dist/lib/libdtrace/common/dt_module.c vendor/illumos/dist/lib/libdtrace/common/dt_module.h vendor/illumos/dist/lib/libdtrace/common/dt_open.c vendor/illumos/dist/lib/libdtrace/common/dt_parser.c vendor/illumos/dist/lib/libdtrace/common/dt_parser.h vendor/illumos/dist/lib/libdtrace/common/dt_pid.c vendor/illumos/dist/lib/libdtrace/common/dt_pid.h vendor/illumos/dist/lib/libdtrace/common/dt_print.c vendor/illumos/dist/lib/libdtrace/common/dt_printf.c vendor/illumos/dist/lib/libdtrace/common/dt_provider.c vendor/illumos/dist/lib/libdtrace/common/dt_xlator.c vendor/illumos/dist/lib/libdtrace/common/dtrace.h Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c vendor-sys/illumos/dist/uts/common/sys/ctf_api.h vendor-sys/illumos/dist/uts/common/sys/dtrace.h Modified: vendor/illumos/dist/cmd/dtrace/dtrace.c ============================================================================== --- vendor/illumos/dist/cmd/dtrace/dtrace.c Tue Jun 3 01:16:11 2014 (r266988) +++ vendor/illumos/dist/cmd/dtrace/dtrace.c Tue Jun 3 01:24:46 2014 (r266989) @@ -25,6 +25,7 @@ */ /* * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ #include @@ -488,6 +489,7 @@ static void print_probe_info(const dtrace_probeinfo_t *p) { char buf[BUFSIZ]; + char *user; int i; oprintf("\n\tProbe Description Attributes\n"); @@ -511,10 +513,14 @@ print_probe_info(const dtrace_probeinfo_ oprintf("\n\tArgument Types\n"); for (i = 0; i < p->dtp_argc; i++) { + if (p->dtp_argv[i].dtt_flags & DTT_FL_USER) + user = "userland "; + else + user = ""; if (ctf_type_name(p->dtp_argv[i].dtt_ctfp, p->dtp_argv[i].dtt_type, buf, sizeof (buf)) == NULL) (void) strlcpy(buf, "(unknown)", sizeof (buf)); - oprintf("\t\targs[%d]: %s\n", i, buf); + oprintf("\t\targs[%d]: %s%s\n", i, user, buf); } if (p->dtp_argc == 0) Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh ============================================================================== --- vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh Tue Jun 3 01:16:11 2014 (r266988) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh Tue Jun 3 01:24:46 2014 (r266989) @@ -45,10 +45,10 @@ cat > Makefile < main.c < Makefile < altlib.c < Makefile < Makefile <' + exit 2 +fi + +dtrace=$1 +t="season_8_mountain_of_madness_t" +pid=$$ + +rc=`$dtrace -n "BEGIN{ trace(pid$pid`$t)0); }"` + +exit $rc Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidtype2.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidtype2.ksh Tue Jun 3 01:24:46 2014 (r266989) @@ -0,0 +1,35 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# While it's hard to be completely certain that a type of the name we want +# doesn't exist, we're going to try to pick a name which is rather +# unique. This time we're also going to use the pid$target alias. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="season_8_mountain_of_madness_t" +pid=$$ + +rc=`$dtrace -n "BEGIN{ trace(pid`$t)0); }"` -p $pid + +exit $rc Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.user64mode.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.user64mode.ksh Tue Jun 3 01:24:46 2014 (r266989) @@ -0,0 +1,90 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# This test is purposefully using a 64-bit DTrace and thus 64-bit types +# when compared with a 32-bit process. This test uses the userland +# keyword and so the implicit copyin should access illegal memory and +# thus exit. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="zelda_info_t" +exe="tst.chasestrings.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -64 -qs /dev/stdin <t = (userland info_t *)arg0; + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + stringof(this->t->zi_gamename), this->t->zi_ndungeons, + stringof(this->t->zi_villain), this->t->zi_haszelda); + next = 1; +} + +pid$pid::has_dungeons:entry +/next == 1/ +{ + this->t = (userland info_t *)arg0; + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + stringof(this->t->zi_gamename), this->t->zi_ndungeons, + stringof(this->t->zi_villain), this->t->zi_haszelda); + next = 2; +} + +pid$pid::has_villain:entry +/next == 2/ +{ + this->t = (userland info_t *)arg0; + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + stringof(this->t->zi_gamename), this->t->zi_ndungeons, + stringof(this->t->zi_villain), this->t->zi_haszelda); + exit(0); +} + +ERROR +{ + exit(1); +} +EOF +rc=$? + +kill -9 $pid + +exit $rc Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.c Tue Jun 3 01:24:46 2014 (r266989) @@ -0,0 +1,46 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2013 (c) Joyent, Inc. All rights reserved. + */ + +/* + * This test tries to make sure that we have CTF data for a type that only this + * binary would reasonably have. In this case, the + * season_7_lisa_the_vegetarian_t. + */ +#include + +typedef struct season_7_lisa_the_vegetarian { + int fr_salad; +} season_7_lisa_the_vegetarian_t; + +int +sleeper(season_7_lisa_the_vegetarian_t *lp) +{ + for (;;) { + sleep(lp->fr_salad); + } + /*NOTREACHED*/ + return (0); +} + +int +main(void) +{ + season_7_lisa_the_vegetarian_t l; + l.fr_salad = 100; + + sleeper(&l); + + return (0); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.ksh Tue Jun 3 01:24:46 2014 (r266989) @@ -0,0 +1,44 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# Lookup a type that is inside a.out. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="season_7_lisa_the_vegetrian_t *" +exe="tst.aouttype.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"` + +kill -9 $pid + +exit $rc Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.c Tue Jun 3 01:24:46 2014 (r266989) @@ -0,0 +1,79 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2013 (c) Joyent, Inc. All rights reserved. + */ + +/* + * This test takes data from the current binary which is basically running in a + * loop between two functions and our goal is to have two unique types that they + * contain which we can print. + */ + +#include + +typedef struct zelda_info { + char *zi_gamename; + int zi_ndungeons; + char *zi_villain; + int zi_haszelda; +} zelda_info_t; + +static int +has_princess(zelda_info_t *z) +{ + return (z->zi_haszelda); +} + +static int +has_dungeons(zelda_info_t *z) +{ + return (z->zi_ndungeons != 0); +} + +static const char * +has_villain(zelda_info_t *z) +{ + return (z->zi_villain); +} + +int +main(void) +{ + zelda_info_t oot; + zelda_info_t la; + zelda_info_t lttp; + + oot.zi_gamename = "Ocarina of Time"; + oot.zi_ndungeons = 10; + oot.zi_villain = "Ganondorf"; + oot.zi_haszelda = 1; + + la.zi_gamename = "Link's Awakening"; + la.zi_ndungeons = 9; + la.zi_villain = "Nightmare"; + la.zi_haszelda = 0; + + lttp.zi_gamename = "A Link to the Past"; + lttp.zi_ndungeons = 12; + lttp.zi_villain = "Ganon"; + lttp.zi_haszelda = 1; + + for (;;) { + (void) has_princess(&oot); + (void) has_dungeons(&la); + (void) has_villain(<tp); + sleep(1); + } + + return (0); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh Tue Jun 3 01:24:46 2014 (r266989) @@ -0,0 +1,76 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# This test is checking that we can read members and that pointers inside +# members point to valid data that is intelligible, eg. strings. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="zelda_info_t" +exe="tst.chasestrings.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -qs /dev/stdin <t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons, + copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda); + next = 1; +} + +pid$pid::has_dungeons:entry +/next == 1/ +{ + this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons, + copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda); + next = 2; +} + +pid$pid::has_villain:entry +/next == 2/ +{ + this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); + printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n", + copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons, + copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda); + exit(0); +} +EOF +rc=$? + +kill -9 $pid + +exit $rc Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh.out Tue Jun 3 01:24:46 2014 (r266989) @@ -0,0 +1,4 @@ +game: Ocarina of Time, dungeon: 10, villain: Ganondorf, zelda: 1 +game: Link's Awakening, dungeon: 9, villain: Nightmare, zelda: 0 +game: A Link to the Past, dungeon: 12, villain: Ganon, zelda: 1 + Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.c Tue Jun 3 01:24:46 2014 (r266989) @@ -0,0 +1,29 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2013 (c) Joyent, Inc. All rights reserved. + */ + +/* + * We're linked against libc which has types, though we do not. + */ +#include + +int +main(void) +{ + for (;;) { + sleep(1000); + } + /*NOTREACHED*/ + return (0); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.ksh Tue Jun 3 01:24:46 2014 (r266989) @@ -0,0 +1,45 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# Here we want to make sure that the program in question does not have ctf data +# in its a.out; however, we can get types out of a linked libc. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +t="int" +exe="tst.libtype.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -eq 0 ]]; then + echo "CTF exists in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"` + +kill -9 $pid + +exit $rc Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.linkmap.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.linkmap.ksh Tue Jun 3 01:24:46 2014 (r266989) @@ -0,0 +1,44 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# We should be able to see both strstr from libc and from ld on an +# alternate linkmap. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 + +$dtrace -q -p $$ -s /dev/stdin <' + exit 2 +fi + +dtrace=$1 +t="final_fantasy_info_t" +exe="tst.printtype.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -qs /dev/stdin <' + exit 2 +fi + +dtrace=$1 +t="final_fantasy_info_t" +exe="tst.printtype.exe" + +elfdump "./$exe" | grep -q '.SUNW_ctf' +if [[ $? -ne 0 ]]; then + echo "CTF does not exist in $exe, that's a bug" >&2 + exit 1 +fi + +./$exe & +pid=$! + +$dtrace -p $pid -qs /dev/stdin < + +typedef struct final_fantasy_info { + int ff_gameid; + int ff_partysize; + int ff_hassummons; +} final_fantasy_info_t; + +static int +ff_getgameid(final_fantasy_info_t *f) +{ + return (0); +} + +static int +ff_getpartysize(final_fantasy_info_t *f) +{ + return (0); +} + +static int +ff_getsummons(final_fantasy_info_t *f) +{ + return (0); +} + +int +main(void) +{ + final_fantasy_info_t ffiii, ffx, ffi; + + ffi.ff_gameid = 1; + ffi.ff_partysize = 4; + ffi.ff_hassummons = 0; + + ffiii.ff_gameid = 6; + ffiii.ff_partysize = 4; + ffiii.ff_hassummons = 1; + + ffx.ff_gameid = 10; + ffx.ff_partysize = 3; + ffx.ff_hassummons = 1; + + for (;;) { + ff_getgameid(&ffi); + ff_getpartysize(&ffx); + ff_getsummons(&ffiii); + sleep(1); + } + /*NOTREACHED*/ + return (0); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.ksh Tue Jun 3 01:24:46 2014 (r266989) @@ -0,0 +1,69 @@ +#! /usr/bin/ksh +# +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013 Joyent, Inc. All rights reserved. +# + +# +# Use print() on userland CTF types and verify we get the data we expect. +# *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***