tst.aouttype.ksh revision 271693
1576Sdarcy#! /usr/bin/ksh 22933Sakulyakh# 3576Sdarcy# 4576Sdarcy# This file and its contents are supplied under the terms of the 5576Sdarcy# Common Development and Distribution License ("CDDL"), version 1.0. 6576Sdarcy# You may only use this file in accordance with the terms of version 7576Sdarcy# 1.0 of the CDDL. 8576Sdarcy# 9576Sdarcy# A full copy of the text of the CDDL should have accompanied this 10576Sdarcy# source. A copy of the CDDL is also available via the Internet at 11576Sdarcy# http://www.illumos.org/license/CDDL. 12576Sdarcy# 13576Sdarcy 14576Sdarcy# 15576Sdarcy# Copyright (c) 2013 Joyent, Inc. All rights reserved. 16576Sdarcy# 17576Sdarcy 18576Sdarcy# 19576Sdarcy# Lookup a type that is inside a.out. 20576Sdarcy# 21576Sdarcy 22576Sdarcyif [ $# != 1 ]; then 23576Sdarcy echo expected one argument: '<'dtrace-path'>' 24576Sdarcy exit 2 25576Sdarcyfi 26576Sdarcy 27576Sdarcydtrace=$1 281465Sdarcyt="season_7_lisa_the_vegetrian_t *" 292933Sakulyakhexe="tst.aouttype.exe" 302933Sakulyakh 31698Sdarcyelfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf' 32576Sdarcyif [[ $? -ne 0 ]]; then 33576Sdarcy echo "CTF does not exist in $exe, that's a bug" >&2 34576Sdarcy exit 1 35576Sdarcyfi 36576Sdarcy 37576Sdarcy./$exe & 38576Sdarcypid=$! 39576Sdarcy 40576Sdarcyrc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"` 41576Sdarcy 42576Sdarcykill -9 $pid 43576Sdarcy 44576Sdarcyexit $rc 45576Sdarcy