18e648814SRui Paulo#! /usr/bin/ksh 28e648814SRui Paulo# 38e648814SRui Paulo# 48e648814SRui Paulo# This file and its contents are supplied under the terms of the 58e648814SRui Paulo# Common Development and Distribution License ("CDDL"), version 1.0. 68e648814SRui Paulo# You may only use this file in accordance with the terms of version 78e648814SRui Paulo# 1.0 of the CDDL. 88e648814SRui Paulo# 98e648814SRui Paulo# A full copy of the text of the CDDL should have accompanied this 108e648814SRui Paulo# source. A copy of the CDDL is also available via the Internet at 118e648814SRui Paulo# http://www.illumos.org/license/CDDL. 128e648814SRui Paulo# 138e648814SRui Paulo 148e648814SRui Paulo# 158e648814SRui Paulo# Copyright (c) 2013 Joyent, Inc. All rights reserved. 168e648814SRui Paulo# 178e648814SRui Paulo 188e648814SRui Paulo# 198e648814SRui Paulo# Use print() on userland CTF types and verify we get the data we 208e648814SRui Paulo# expect. This time, use $target to make sure that path works correctly. 218e648814SRui Paulo# 228e648814SRui Paulo 238e648814SRui Pauloif [ $# != 1 ]; then 248e648814SRui Paulo echo expected one argument: '<'dtrace-path'>' 258e648814SRui Paulo exit 2 268e648814SRui Paulofi 278e648814SRui Paulo 288e648814SRui Paulodtrace=$1 298e648814SRui Paulot="final_fantasy_info_t" 308e648814SRui Pauloexe="tst.printtype.exe" 318e648814SRui Paulo 32*a5ddd965SMark Johnstonelfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf' 338e648814SRui Pauloif [[ $? -ne 0 ]]; then 348e648814SRui Paulo echo "CTF does not exist in $exe, that's a bug" >&2 358e648814SRui Paulo exit 1 368e648814SRui Paulofi 378e648814SRui Paulo 388e648814SRui Paulo./$exe & 398e648814SRui Paulopid=$! 408e648814SRui Paulo 418e648814SRui Paulo$dtrace -p $pid -qs /dev/stdin <<EOF 428e648814SRui Paulopid\$target::ff_getgameid:entry 438e648814SRui Paulo/next == 0/ 448e648814SRui Paulo{ 458e648814SRui Paulo print(*args[0]); 468e648814SRui Paulo printf("\n"); 478e648814SRui Paulo next = 1; 488e648814SRui Paulo} 498e648814SRui Paulo 508e648814SRui Paulopid\$target::ff_getpartysize:entry 518e648814SRui Paulo/next == 1/ 528e648814SRui Paulo{ 538e648814SRui Paulo print(*args[0]); 548e648814SRui Paulo printf("\n"); 558e648814SRui Paulo next = 2; 568e648814SRui Paulo} 578e648814SRui Paulo 588e648814SRui Paulopid\$target::ff_getsummons:entry 598e648814SRui Paulo/next == 2/ 608e648814SRui Paulo{ 618e648814SRui Paulo print(*args[0]); 628e648814SRui Paulo printf("\n"); 638e648814SRui Paulo exit(0); 648e648814SRui Paulo} 658e648814SRui PauloEOF 668e648814SRui Paulorc=$? 678e648814SRui Paulo 688e648814SRui Paulokill -9 $pid 698e648814SRui Paulo 708e648814SRui Pauloexit $rc 71