xref: /onnv-gate/usr/src/cmd/mdb/common/modules/dtrace/mkdof.sh (revision 265:a968e4ece133)
1*265Smws#!/bin/sh
2*265Smws#
3*265Smws# CDDL HEADER START
4*265Smws#
5*265Smws# The contents of this file are subject to the terms of the
6*265Smws# Common Development and Distribution License, Version 1.0 only
7*265Smws# (the "License").  You may not use this file except in compliance
8*265Smws# with the License.
9*265Smws#
10*265Smws# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11*265Smws# or http://www.opensolaris.org/os/licensing.
12*265Smws# See the License for the specific language governing permissions
13*265Smws# and limitations under the License.
14*265Smws#
15*265Smws# When distributing Covered Code, include this CDDL HEADER in each
16*265Smws# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17*265Smws# If applicable, add the following below this CDDL HEADER, with the
18*265Smws# fields enclosed by brackets "[]" replaced with your own identifying
19*265Smws# information: Portions Copyright [yyyy] [name of copyright owner]
20*265Smws#
21*265Smws# CDDL HEADER END
22*265Smws#
23*265Smws#
24*265Smws# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25*265Smws# Use is subject to license terms.
26*265Smws#
27*265Smws#ident	"%Z%%M%	%I%	%E% SMI"
28*265Smws
29*265Smwsecho "\
30*265Smws/*\n\
31*265Smws * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.\n\
32*265Smws * Use is subject to license terms.\n\
33*265Smws */\n\
34*265Smws\n\
35*265Smws#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n\
36*265Smws\n\
37*265Smws#include <sys/dtrace.h>\n\
38*265Smws\n\
39*265Smwsconst char *\n\
40*265Smwsdof_sec_name(uint32_t type)\n\
41*265Smws{\n\
42*265Smws	switch (type) {"
43*265Smws
44*265Smwspattern='^#define[	 ]DOF_SECT_\([A-Z0-9_]*\)[	 ]*.*$'
45*265Smwsreplace='	case DOF_SECT_\1: return ("\1");'
46*265Smws
47*265Smwssed -n "s/$pattern/$replace/p"
48*265Smws
49*265Smwsecho "\
50*265Smws	default: return (NULL);\n\
51*265Smws	}\n\
52*265Smws}"
53