xref: /illumos-gate/usr/src/tools/stabs/forth.c (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1996-2002 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate #include <unistd.h>
30*7c478bd9Sstevel@tonic-gate #include <math.h>
31*7c478bd9Sstevel@tonic-gate #include "stabs.h"
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate void forth_do_sou(struct tdesc *tdp, struct node *np);
34*7c478bd9Sstevel@tonic-gate void forth_do_enum(struct tdesc *tdp, struct node *np);
35*7c478bd9Sstevel@tonic-gate void forth_do_intrinsic(struct tdesc *tdp, struct node *np);
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate static void switch_on_type(struct mlist *mlp, struct tdesc *tdp,
38*7c478bd9Sstevel@tonic-gate     char *format, int level);
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate static void print_intrinsic(struct mlist *mlp, struct tdesc *tdp,
41*7c478bd9Sstevel@tonic-gate     char *format, int level);
42*7c478bd9Sstevel@tonic-gate static void print_forward(struct mlist *mlp, struct tdesc *tdp,
43*7c478bd9Sstevel@tonic-gate     char *format, int level);
44*7c478bd9Sstevel@tonic-gate static void print_pointer(struct mlist *mlp, struct tdesc *tdp,
45*7c478bd9Sstevel@tonic-gate     char *format, int level);
46*7c478bd9Sstevel@tonic-gate static void print_array(struct mlist *mlp, struct tdesc *tdp,
47*7c478bd9Sstevel@tonic-gate     char *format, int level);
48*7c478bd9Sstevel@tonic-gate static void print_function(struct mlist *mlp, struct tdesc *tdp,
49*7c478bd9Sstevel@tonic-gate     char *format, int level);
50*7c478bd9Sstevel@tonic-gate static void print_union(struct mlist *mlp, struct tdesc *tdp,
51*7c478bd9Sstevel@tonic-gate     char *format, int level);
52*7c478bd9Sstevel@tonic-gate static void print_enum(struct mlist *mlp, struct tdesc *tdp,
53*7c478bd9Sstevel@tonic-gate     char *format, int level);
54*7c478bd9Sstevel@tonic-gate static void print_forward(struct mlist *mlp, struct tdesc *tdp,
55*7c478bd9Sstevel@tonic-gate     char *format, int level);
56*7c478bd9Sstevel@tonic-gate static void print_typeof(struct mlist *mlp, struct tdesc *tdp,
57*7c478bd9Sstevel@tonic-gate     char *format, int level);
58*7c478bd9Sstevel@tonic-gate static void print_struct(struct mlist *mlp, struct tdesc *tdp,
59*7c478bd9Sstevel@tonic-gate     char *format, int level);
60*7c478bd9Sstevel@tonic-gate static void print_volatile(struct mlist *mlp, struct tdesc *tdp,
61*7c478bd9Sstevel@tonic-gate     char *format, int level);
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate void
forth_do_intrinsic(struct tdesc * tdp,struct node * np)64*7c478bd9Sstevel@tonic-gate forth_do_intrinsic(struct tdesc *tdp, struct node *np)
65*7c478bd9Sstevel@tonic-gate {
66*7c478bd9Sstevel@tonic-gate }
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate void
forth_do_sou(struct tdesc * tdp,struct node * np)69*7c478bd9Sstevel@tonic-gate forth_do_sou(struct tdesc *tdp, struct node *np)
70*7c478bd9Sstevel@tonic-gate {
71*7c478bd9Sstevel@tonic-gate 	struct mlist *mlp;
72*7c478bd9Sstevel@tonic-gate 	struct child *chp;
73*7c478bd9Sstevel@tonic-gate 	char *format;
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate 	printf("\n");
76*7c478bd9Sstevel@tonic-gate 	printf("vocabulary %s-words\n", np->name);
77*7c478bd9Sstevel@tonic-gate 	printf("h# %x constant %s-sz\n", tdp->size, np->name);
78*7c478bd9Sstevel@tonic-gate 	printf("%x ' %s-words c-struct .%s\n",
79*7c478bd9Sstevel@tonic-gate 		tdp->size, np->name, np->name);
80*7c478bd9Sstevel@tonic-gate 	printf("also %s-words definitions\n\n", np->name);
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate 	/*
83*7c478bd9Sstevel@tonic-gate 	 * Run thru all the fields of a struct and print them out
84*7c478bd9Sstevel@tonic-gate 	 */
85*7c478bd9Sstevel@tonic-gate 	for (mlp = tdp->data.members.back; mlp != NULL; mlp = mlp->prev) {
86*7c478bd9Sstevel@tonic-gate 		/*
87*7c478bd9Sstevel@tonic-gate 		 * If there's a child list, only print those members.
88*7c478bd9Sstevel@tonic-gate 		 */
89*7c478bd9Sstevel@tonic-gate 		if (np->child) {
90*7c478bd9Sstevel@tonic-gate 			if (mlp->name == NULL)
91*7c478bd9Sstevel@tonic-gate 				continue;
92*7c478bd9Sstevel@tonic-gate 			chp = find_child(np, mlp->name);
93*7c478bd9Sstevel@tonic-gate 			if (chp == NULL)
94*7c478bd9Sstevel@tonic-gate 				continue;
95*7c478bd9Sstevel@tonic-gate 			format = chp->format;
96*7c478bd9Sstevel@tonic-gate 		} else
97*7c478bd9Sstevel@tonic-gate 			format = NULL;
98*7c478bd9Sstevel@tonic-gate 		if (mlp->fdesc == NULL)
99*7c478bd9Sstevel@tonic-gate 			continue;
100*7c478bd9Sstevel@tonic-gate 		switch_on_type(mlp, mlp->fdesc, format, 0);
101*7c478bd9Sstevel@tonic-gate 	}
102*7c478bd9Sstevel@tonic-gate 	printf("\nkdbg-words definitions\n");
103*7c478bd9Sstevel@tonic-gate 	printf("previous\n\n");
104*7c478bd9Sstevel@tonic-gate 	printf("\\ end %s section\n\n", np->name);
105*7c478bd9Sstevel@tonic-gate }
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate void
forth_do_enum(struct tdesc * tdp,struct node * np)108*7c478bd9Sstevel@tonic-gate forth_do_enum(struct tdesc *tdp, struct node *np)
109*7c478bd9Sstevel@tonic-gate {
110*7c478bd9Sstevel@tonic-gate 	int nelem = 0;
111*7c478bd9Sstevel@tonic-gate 	struct elist *elp;
112*7c478bd9Sstevel@tonic-gate 
113*7c478bd9Sstevel@tonic-gate 	printf("\n");
114*7c478bd9Sstevel@tonic-gate 	for (elp = tdp->data.emem; elp != NULL; elp = elp->next) {
115*7c478bd9Sstevel@tonic-gate 		printf("here ,\" %s\" %x\n", elp->name, elp->number);
116*7c478bd9Sstevel@tonic-gate 		nelem++;
117*7c478bd9Sstevel@tonic-gate 	}
118*7c478bd9Sstevel@tonic-gate 	printf("%x c-enum .%s\n", nelem, np->name);
119*7c478bd9Sstevel@tonic-gate }
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate static void
switch_on_type(struct mlist * mlp,struct tdesc * tdp,char * format,int level)122*7c478bd9Sstevel@tonic-gate switch_on_type(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
123*7c478bd9Sstevel@tonic-gate {
124*7c478bd9Sstevel@tonic-gate 	switch (tdp->type) {
125*7c478bd9Sstevel@tonic-gate 	case INTRINSIC:
126*7c478bd9Sstevel@tonic-gate 		print_intrinsic(mlp, tdp, format, level);
127*7c478bd9Sstevel@tonic-gate 		break;
128*7c478bd9Sstevel@tonic-gate 	case POINTER:
129*7c478bd9Sstevel@tonic-gate 		print_pointer(mlp, tdp, format, level);
130*7c478bd9Sstevel@tonic-gate 		break;
131*7c478bd9Sstevel@tonic-gate 	case ARRAY:
132*7c478bd9Sstevel@tonic-gate 		print_array(mlp, tdp, format, level);
133*7c478bd9Sstevel@tonic-gate 		break;
134*7c478bd9Sstevel@tonic-gate 	case FUNCTION:
135*7c478bd9Sstevel@tonic-gate 		print_function(mlp, tdp, format, level);
136*7c478bd9Sstevel@tonic-gate 		break;
137*7c478bd9Sstevel@tonic-gate 	case UNION:
138*7c478bd9Sstevel@tonic-gate 		print_union(mlp, tdp, format, level);
139*7c478bd9Sstevel@tonic-gate 		break;
140*7c478bd9Sstevel@tonic-gate 	case ENUM:
141*7c478bd9Sstevel@tonic-gate 		print_enum(mlp, tdp, format, level);
142*7c478bd9Sstevel@tonic-gate 		break;
143*7c478bd9Sstevel@tonic-gate 	case FORWARD:
144*7c478bd9Sstevel@tonic-gate 		print_forward(mlp, tdp, format, level);
145*7c478bd9Sstevel@tonic-gate 		break;
146*7c478bd9Sstevel@tonic-gate 	case TYPEOF:
147*7c478bd9Sstevel@tonic-gate 		print_typeof(mlp, tdp, format, level);
148*7c478bd9Sstevel@tonic-gate 		break;
149*7c478bd9Sstevel@tonic-gate 	case STRUCT:
150*7c478bd9Sstevel@tonic-gate 		print_struct(mlp, tdp, format, level);
151*7c478bd9Sstevel@tonic-gate 		break;
152*7c478bd9Sstevel@tonic-gate 	case VOLATILE:
153*7c478bd9Sstevel@tonic-gate 		print_volatile(mlp, tdp, format, level);
154*7c478bd9Sstevel@tonic-gate 		break;
155*7c478bd9Sstevel@tonic-gate 	default:
156*7c478bd9Sstevel@tonic-gate 		fprintf(stderr, "Switch to Unknown type\n");
157*7c478bd9Sstevel@tonic-gate 		error = B_TRUE;
158*7c478bd9Sstevel@tonic-gate 		break;
159*7c478bd9Sstevel@tonic-gate 	}
160*7c478bd9Sstevel@tonic-gate }
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate static void
print_forward(struct mlist * mlp,struct tdesc * tdp,char * format,int level)163*7c478bd9Sstevel@tonic-gate print_forward(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
164*7c478bd9Sstevel@tonic-gate {
165*7c478bd9Sstevel@tonic-gate 	fprintf(stderr, "%s never defined\n", mlp->name);
166*7c478bd9Sstevel@tonic-gate 	error = B_TRUE;
167*7c478bd9Sstevel@tonic-gate }
168*7c478bd9Sstevel@tonic-gate 
169*7c478bd9Sstevel@tonic-gate static void
print_typeof(struct mlist * mlp,struct tdesc * tdp,char * format,int level)170*7c478bd9Sstevel@tonic-gate print_typeof(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
171*7c478bd9Sstevel@tonic-gate {
172*7c478bd9Sstevel@tonic-gate 	switch_on_type(mlp, tdp->data.tdesc, format, level);
173*7c478bd9Sstevel@tonic-gate }
174*7c478bd9Sstevel@tonic-gate 
175*7c478bd9Sstevel@tonic-gate static void
print_volatile(struct mlist * mlp,struct tdesc * tdp,char * format,int level)176*7c478bd9Sstevel@tonic-gate print_volatile(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
177*7c478bd9Sstevel@tonic-gate {
178*7c478bd9Sstevel@tonic-gate 	switch_on_type(mlp, tdp->data.tdesc, format, level);
179*7c478bd9Sstevel@tonic-gate }
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate static void
print_intrinsic(struct mlist * mlp,struct tdesc * tdp,char * format,int level)182*7c478bd9Sstevel@tonic-gate print_intrinsic(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
183*7c478bd9Sstevel@tonic-gate {
184*7c478bd9Sstevel@tonic-gate 	format = convert_format(format, ".x");
185*7c478bd9Sstevel@tonic-gate 
186*7c478bd9Sstevel@tonic-gate 	if (level != 0) {
187*7c478bd9Sstevel@tonic-gate 		switch (tdp->size) {
188*7c478bd9Sstevel@tonic-gate 		case 1:
189*7c478bd9Sstevel@tonic-gate 			printf("' c@ ' %s", format);
190*7c478bd9Sstevel@tonic-gate 			break;
191*7c478bd9Sstevel@tonic-gate 		case 2:
192*7c478bd9Sstevel@tonic-gate 			printf("' w@ ' %s", format);
193*7c478bd9Sstevel@tonic-gate 			break;
194*7c478bd9Sstevel@tonic-gate 		case 4:
195*7c478bd9Sstevel@tonic-gate 			printf("' l@ ' %s", format);
196*7c478bd9Sstevel@tonic-gate 			break;
197*7c478bd9Sstevel@tonic-gate 		case 8:
198*7c478bd9Sstevel@tonic-gate 			printf("' x@ ' %s", format);
199*7c478bd9Sstevel@tonic-gate 			break;
200*7c478bd9Sstevel@tonic-gate 		}
201*7c478bd9Sstevel@tonic-gate 	/*
202*7c478bd9Sstevel@tonic-gate 	 * Check for bit field.
203*7c478bd9Sstevel@tonic-gate 	 */
204*7c478bd9Sstevel@tonic-gate 	} else if (mlp->size != 0 &&
205*7c478bd9Sstevel@tonic-gate 	    ((mlp->size % 8) != 0 || (mlp->offset % mlp->size) != 0)) {
206*7c478bd9Sstevel@tonic-gate 		int offset, shift, mask;
207*7c478bd9Sstevel@tonic-gate 
208*7c478bd9Sstevel@tonic-gate 		offset = (mlp->offset / 32) * 4;
209*7c478bd9Sstevel@tonic-gate 		shift = 32 - ((mlp->offset % 32) + mlp->size);
210*7c478bd9Sstevel@tonic-gate 		mask = ((int)pow(2, mlp->size) - 1) << shift;
211*7c478bd9Sstevel@tonic-gate 		printf("' %s %x %x %x bits-field %s\n",
212*7c478bd9Sstevel@tonic-gate 			format, shift, mask, offset, mlp->name);
213*7c478bd9Sstevel@tonic-gate 	} else if (mlp->name != NULL) {
214*7c478bd9Sstevel@tonic-gate 		switch (tdp->size) {
215*7c478bd9Sstevel@tonic-gate 		case 1:
216*7c478bd9Sstevel@tonic-gate 			printf("' %s %x byte-field %s\n",
217*7c478bd9Sstevel@tonic-gate 				format, mlp->offset / 8, mlp->name);
218*7c478bd9Sstevel@tonic-gate 			break;
219*7c478bd9Sstevel@tonic-gate 		case 2:
220*7c478bd9Sstevel@tonic-gate 			printf("' %s %x short-field %s\n",
221*7c478bd9Sstevel@tonic-gate 				format, mlp->offset / 8, mlp->name);
222*7c478bd9Sstevel@tonic-gate 			break;
223*7c478bd9Sstevel@tonic-gate 		case 4:
224*7c478bd9Sstevel@tonic-gate 			printf("' %s %x long-field %s\n",
225*7c478bd9Sstevel@tonic-gate 				format, mlp->offset / 8, mlp->name);
226*7c478bd9Sstevel@tonic-gate 			break;
227*7c478bd9Sstevel@tonic-gate 		case 8:
228*7c478bd9Sstevel@tonic-gate 			printf("' %s %x ext-field %s\n",
229*7c478bd9Sstevel@tonic-gate 				format, mlp->offset / 8, mlp->name);
230*7c478bd9Sstevel@tonic-gate 			break;
231*7c478bd9Sstevel@tonic-gate 		}
232*7c478bd9Sstevel@tonic-gate 	}
233*7c478bd9Sstevel@tonic-gate }
234*7c478bd9Sstevel@tonic-gate 
235*7c478bd9Sstevel@tonic-gate static void
print_pointer(struct mlist * mlp,struct tdesc * tdp,char * format,int level)236*7c478bd9Sstevel@tonic-gate print_pointer(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
237*7c478bd9Sstevel@tonic-gate {
238*7c478bd9Sstevel@tonic-gate 	format = convert_format(format, ".x");
239*7c478bd9Sstevel@tonic-gate 	if (level != 0) {
240*7c478bd9Sstevel@tonic-gate 		switch (tdp->size) {
241*7c478bd9Sstevel@tonic-gate 		case 1:
242*7c478bd9Sstevel@tonic-gate 			printf("' c@ ' %s", format);
243*7c478bd9Sstevel@tonic-gate 			break;
244*7c478bd9Sstevel@tonic-gate 		case 2:
245*7c478bd9Sstevel@tonic-gate 			printf("' w@ ' %s", format);
246*7c478bd9Sstevel@tonic-gate 			break;
247*7c478bd9Sstevel@tonic-gate 		case 4:
248*7c478bd9Sstevel@tonic-gate 			printf("' l@ ' %s", format);
249*7c478bd9Sstevel@tonic-gate 			break;
250*7c478bd9Sstevel@tonic-gate 		case 8:
251*7c478bd9Sstevel@tonic-gate 			printf("' x@ ' %s", format);
252*7c478bd9Sstevel@tonic-gate 			break;
253*7c478bd9Sstevel@tonic-gate 		}
254*7c478bd9Sstevel@tonic-gate 	} else {
255*7c478bd9Sstevel@tonic-gate 		printf("' %s %x ptr-field %s\n",
256*7c478bd9Sstevel@tonic-gate 		    format, mlp->offset / 8, mlp->name);
257*7c478bd9Sstevel@tonic-gate 	}
258*7c478bd9Sstevel@tonic-gate }
259*7c478bd9Sstevel@tonic-gate 
260*7c478bd9Sstevel@tonic-gate static void
print_array(struct mlist * mlp,struct tdesc * tdp,char * format,int level)261*7c478bd9Sstevel@tonic-gate print_array(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
262*7c478bd9Sstevel@tonic-gate {
263*7c478bd9Sstevel@tonic-gate 	struct ardef *ap = tdp->data.ardef;
264*7c478bd9Sstevel@tonic-gate 	int items, inc, limit;
265*7c478bd9Sstevel@tonic-gate 
266*7c478bd9Sstevel@tonic-gate 	if (level > 0) {
267*7c478bd9Sstevel@tonic-gate 		printf("' noop ' .x");
268*7c478bd9Sstevel@tonic-gate 	} else {
269*7c478bd9Sstevel@tonic-gate 		items = ap->indices->range_end - ap->indices->range_start + 1;
270*7c478bd9Sstevel@tonic-gate 		inc = (mlp->size / items) / 8;
271*7c478bd9Sstevel@tonic-gate 		limit = mlp->size / 8;
272*7c478bd9Sstevel@tonic-gate 		switch_on_type(mlp, ap->contents, format, level + 1);
273*7c478bd9Sstevel@tonic-gate 		printf(" %x %x %x array-field", limit, inc, mlp->offset / 8);
274*7c478bd9Sstevel@tonic-gate 		printf(" %s\n", mlp->name);
275*7c478bd9Sstevel@tonic-gate 	}
276*7c478bd9Sstevel@tonic-gate }
277*7c478bd9Sstevel@tonic-gate 
278*7c478bd9Sstevel@tonic-gate static void
print_function(struct mlist * mlp,struct tdesc * tdp,char * format,int level)279*7c478bd9Sstevel@tonic-gate print_function(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
280*7c478bd9Sstevel@tonic-gate {
281*7c478bd9Sstevel@tonic-gate 	fprintf(stderr, "function in struct %s\n", tdp->name);
282*7c478bd9Sstevel@tonic-gate 	error = B_TRUE;
283*7c478bd9Sstevel@tonic-gate }
284*7c478bd9Sstevel@tonic-gate 
285*7c478bd9Sstevel@tonic-gate static void
print_struct(struct mlist * mlp,struct tdesc * tdp,char * format,int level)286*7c478bd9Sstevel@tonic-gate print_struct(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
287*7c478bd9Sstevel@tonic-gate {
288*7c478bd9Sstevel@tonic-gate 	format = convert_format(format, ".x");
289*7c478bd9Sstevel@tonic-gate 	if (level != 0)
290*7c478bd9Sstevel@tonic-gate 		printf("' noop ' %s", format);
291*7c478bd9Sstevel@tonic-gate 	else {
292*7c478bd9Sstevel@tonic-gate 		printf("' %s %x struct-field %s\n",
293*7c478bd9Sstevel@tonic-gate 			format, mlp->offset / 8, mlp->name);
294*7c478bd9Sstevel@tonic-gate 	}
295*7c478bd9Sstevel@tonic-gate }
296*7c478bd9Sstevel@tonic-gate 
297*7c478bd9Sstevel@tonic-gate static void
print_union(struct mlist * mlp,struct tdesc * tdp,char * format,int level)298*7c478bd9Sstevel@tonic-gate print_union(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
299*7c478bd9Sstevel@tonic-gate {
300*7c478bd9Sstevel@tonic-gate 	format = convert_format(format, ".x");
301*7c478bd9Sstevel@tonic-gate 	if (level != 0)
302*7c478bd9Sstevel@tonic-gate 		printf("' noop ' %s", format);
303*7c478bd9Sstevel@tonic-gate 	else {
304*7c478bd9Sstevel@tonic-gate 		printf("' %s %x struct-field %s\n",
305*7c478bd9Sstevel@tonic-gate 			format, mlp->offset / 8, mlp->name);
306*7c478bd9Sstevel@tonic-gate 	}
307*7c478bd9Sstevel@tonic-gate }
308*7c478bd9Sstevel@tonic-gate 
309*7c478bd9Sstevel@tonic-gate static void
print_enum(struct mlist * mlp,struct tdesc * tdp,char * format,int level)310*7c478bd9Sstevel@tonic-gate print_enum(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
311*7c478bd9Sstevel@tonic-gate {
312*7c478bd9Sstevel@tonic-gate 	format = convert_format(format, ".d");
313*7c478bd9Sstevel@tonic-gate 
314*7c478bd9Sstevel@tonic-gate 	if (level != 0)
315*7c478bd9Sstevel@tonic-gate 		printf("' l@ ' %s", format);
316*7c478bd9Sstevel@tonic-gate 	else
317*7c478bd9Sstevel@tonic-gate 		printf("' %s %x long-field %s\n",
318*7c478bd9Sstevel@tonic-gate 			format, mlp->offset / 8, mlp->name);
319*7c478bd9Sstevel@tonic-gate }
320