view usr/src/cmd/mdb/test/typedef/tst.cleanupstruct.ksh @ 14143:42d090a37218

3089 want ::typedef 3690 mdb on x86 should be able to print alternate register names 3688 Want mdb -e 3094 libctf should support removing a dynamic type 3095 libctf does not validate arrays correctly 3096 libctf does not validate function types correctly 3689 Want an mdb test suite driver Reviewed by: Richard Lowe <richlowe@richlowe.net> Reviewed by: Eric Schrock <eric.schrock@delphix.com> Approved by: Gordon Ross <gwr@nexenta.com>
author Robert Mustacchi <rm@joyent.com>
date Wed, 03 Apr 2013 15:25:37 -0700
parents
children
line wrap: on
line source

#
# One of the problems that we can encounter involves trying to typedef a struct
# that has an error in it. The problem here is that we actually create the type
# itself for the struct before we add members. So what we need is something that
# will fail validation. So here we go!
#

TMPFILE="/tmp/$(mktemp mtest.XXXXXX)"
if [[ -z "$TMPFILE" ]]; then
	echo "Failed to get a temp file" 2>&1
	exit 1
fi

$MDB <<EOF
::typedef "struct foo { int r; }" foo_t
::typedef -l ! cat > $TMPFILE
EOF

DATA=$(cat $TMPFILE)
rm -f $TMPFILE

[[ -z $DATA ]]