1266989Smarkj#! /usr/bin/ksh 2266989Smarkj# 3266989Smarkj# 4266989Smarkj# This file and its contents are supplied under the terms of the 5266989Smarkj# Common Development and Distribution License ("CDDL"), version 1.0. 6266989Smarkj# You may only use this file in accordance with the terms of version 7266989Smarkj# 1.0 of the CDDL. 8266989Smarkj# 9266989Smarkj# A full copy of the text of the CDDL should have accompanied this 10266989Smarkj# source. A copy of the CDDL is also available via the Internet at 11266989Smarkj# http://www.illumos.org/license/CDDL. 12266989Smarkj# 13266989Smarkj 14266989Smarkj# 15266989Smarkj# Copyright (c) 2013 Joyent, Inc. All rights reserved. 16266989Smarkj# 17266989Smarkj 18266989Smarkj# 19266989Smarkj# Use print() on userland CTF types and verify we get the data we expect. 20266989Smarkj# 21266989Smarkj 22266989Smarkjif [ $# != 1 ]; then 23266989Smarkj echo expected one argument: '<'dtrace-path'>' 24266989Smarkj exit 2 25266989Smarkjfi 26266989Smarkj 27266989Smarkjdtrace=$1 28266989Smarkjt="final_fantasy_info_t" 29266989Smarkjexe="tst.printtype.exe" 30266989Smarkj 31266989Smarkjelfdump "./$exe" | grep -q '.SUNW_ctf' 32266989Smarkjif [[ $? -ne 0 ]]; then 33266989Smarkj echo "CTF does not exist in $exe, that's a bug" >&2 34266989Smarkj exit 1 35266989Smarkjfi 36266989Smarkj 37266989Smarkj./$exe & 38266989Smarkjpid=$! 39266989Smarkj 40266989Smarkj$dtrace -qs /dev/stdin <<EOF 41266989Smarkjpid$pid::ff_getgameid:entry 42266989Smarkj/next == 0/ 43266989Smarkj{ 44266989Smarkj print(*args[0]); 45266989Smarkj printf("\n"); 46266989Smarkj next = 1; 47266989Smarkj} 48266989Smarkj 49266989Smarkjpid$pid::ff_getpartysize:entry 50266989Smarkj/next == 1/ 51266989Smarkj{ 52266989Smarkj print(*args[0]); 53266989Smarkj printf("\n"); 54266989Smarkj next = 2; 55266989Smarkj} 56266989Smarkj 57266989Smarkjpid$pid::ff_getsummons:entry 58266989Smarkj/next == 2/ 59266989Smarkj{ 60266989Smarkj print(*args[0]); 61266989Smarkj printf("\n"); 62266989Smarkj exit(0); 63266989Smarkj} 64266989SmarkjEOF 65266989Smarkjrc=$? 66266989Smarkj 67266989Smarkjkill -9 $pid 68266989Smarkj 69266989Smarkjexit $rc 70