xref: /illumos-gate/usr/src/cmd/dtrace/test/tst/common/print/tst.xlate.d (revision 3fe455549728ac525df3be56130ad8e075d645d7)
1 /*
2  * CDDL HEADER START
3  *
4  * This file and its contents are supplied under the terms of the
5  * Common Development and Distribution License ("CDDL"), version 1.0.
6  * You may only use this file in accordance with the terms of version
7  * 1.0 of the CDDL.
8  *
9  * A full copy of the text of the CDDL should have accompanied this
10  * source.  A copy of the CDDL is also available via the Internet at
11  * http://www.illumos.org/license/CDDL.
12  *
13  * CDDL HEADER END
14  */
15 
16 /*
17  * Copyright (c) 2012 by Delphix. All rights reserved.
18  * Copyright 2024 Ryan Zezeski
19  */
20 
21 #pragma D option quiet
22 
23 typedef struct pancakes {
24 	int i;
25 	string s;
26 	timespec_t t;
27 } pancakes_t;
28 
29 translator pancakes_t < void *V > {
30 	i = 2 * 10;
31 	s = strjoin("I like ", "pancakes");
32 	t = *(timespec_t *)`dtrace_zero;
33 };
34 
35 typedef struct stb {
36 	uint8_t v;
37 	uint8_t z;
38 } stb_t;
39 
40 translator stb_t < void *V > {
41 	v = 0x8877665544332211;
42 };
43 
44 typedef struct sth {
45 	uint16_t v;
46 	uint8_t z;
47 } sth_t;
48 
49 translator sth_t < void *V > {
50 	v = 0x8877665544332211;
51 };
52 
53 typedef struct stw {
54 	uint32_t v;
55 	uint8_t z;
56 } stw_t;
57 
58 translator stw_t < void *V > {
59 	v = 0x8877665544332211;
60 };
61 
62 typedef struct stx {
63 	uint64_t v;
64 	uint8_t z;
65 } stx_t;
66 
67 translator stx_t < void *V > {
68 	v = 0x8877665544332211;
69 };
70 
71 BEGIN
72 {
73 	print(*(xlate < pancakes_t * > ((void *)NULL)));
74 	printf("\n");
75 	print(*(xlate < stb_t * > ((void *)NULL)));
76 	printf("\n");
77 	print(*(xlate < sth_t * > ((void *)NULL)));
78 	printf("\n");
79 	print(*(xlate < stw_t * > ((void *)NULL)));
80 	printf("\n");
81 	print(*(xlate < stx_t * > ((void *)NULL)));
82 }
83 
84 BEGIN
85 {
86 	exit(0);
87 }
88