Debian Codegraph @

generic/tclDTrace.d

raw
1 /*
2 * tclDTrace.d --
3 *
4 * Tcl DTrace provider.
5 *
6 * Copyright (c) 2007-2008 Daniel A. Steffen <[email protected]>
7 *
8 * See the file "license.terms" for information on usage and redistribution of
9 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
10 */
11
12 typedef struct Tcl_Obj Tcl_Obj;
13
14 /*
15 * Tcl DTrace probes
16 */
17
18 provider tcl {
19 /***************************** proc probes *****************************/
20 /*
21 * tcl*:::proc-entry probe
22 * triggered immediately before proc bytecode execution
23 * arg0: proc name (string)
24 * arg1: number of arguments (int)
25 * arg2: array of proc argument objects (Tcl_Obj**)
26 */
27 probe proc__entry(const char *name, int objc, struct Tcl_Obj **objv);
28 /*
29 * tcl*:::proc-return probe
30 * triggered immediately after proc bytecode execution
31 * arg0: proc name (string)
32 * arg1: return code (int)
33 */
34 probe proc__return(const char *name, int code);
35 /*
36 * tcl*:::proc-result probe
37 * triggered after proc-return probe and result processing
38 * arg0: proc name (string)
39 * arg1: return code (int)
40 * arg2: proc result (string)
41 * arg3: proc result object (Tcl_Obj*)
42 */
43 probe proc__result(const char *name, int code, const char *result,
44 struct Tcl_Obj *resultobj);
45 /*
46 * tcl*:::proc-args probe
47 * triggered before proc-entry probe, gives access to string
48 * representation of proc arguments
49 * arg0: proc name (string)
50 * arg1-arg9: proc arguments or NULL (strings)
51 */
52 probe proc__args(const char *name, const char *arg1, const char *arg2,
53 const char *arg3, const char *arg4, const char *arg5,
54 const char *arg6, const char *arg7, const char *arg8,
55 const char *arg9);
56 /*
57 * tcl*:::proc-info probe
58 * triggered before proc-entry probe, gives access to TIP 280
59 * information for the proc invocation (i.e. [info frame 0])
60 * arg0: TIP 280 cmd (string)
61 * arg1: TIP 280 type (string)
62 * arg2: TIP 280 proc (string)
63 * arg3: TIP 280 file (string)
64 * arg4: TIP 280 line (int)
65 * arg5: TIP 280 level (int)
66 * arg6: TclOO method (string)
67 * arg7: TclOO class/object (string)
68 */
69 probe proc__info(const char *cmd, const char *type, const char *proc,
70 const char *file, int line, int level, const char *method,
71 const char *class);
72
73 /***************************** cmd probes ******************************/
74 /*
75 * tcl*:::cmd-entry probe
76 * triggered immediately before commmand execution
77 * arg0: command name (string)
78 * arg1: number of arguments (int)
79 * arg2: array of command argument objects (Tcl_Obj**)
80 */
81 probe cmd__entry(const char *name, int objc, struct Tcl_Obj **objv);
82 /*
83 * tcl*:::cmd-return probe
84 * triggered immediately after commmand execution
85 * arg0: command name (string)
86 * arg1: return code (int)
87 */
88 probe cmd__return(const char *name, int code);
89 /*
90 * tcl*:::cmd-result probe
91 * triggered after cmd-return probe and result processing
92 * arg0: command name (string)
93 * arg1: return code (int)
94 * arg2: command result (string)
95 * arg3: command result object (Tcl_Obj*)
96 */
97 probe cmd__result(const char *name, int code, const char *result,
98 struct Tcl_Obj *resultobj);
99 /*
100 * tcl*:::cmd-args probe
101 * triggered before cmd-entry probe, gives access to string
102 * representation of command arguments
103 * arg0: command name (string)
104 * arg1-arg9: command arguments or NULL (strings)
105 */
106 probe cmd__args(const char *name, const char *arg1, const char *arg2,
107 const char *arg3, const char *arg4, const char *arg5,
108 const char *arg6, const char *arg7, const char *arg8,
109 const char *arg9);
110 /*
111 * tcl*:::cmd-info probe
112 * triggered before cmd-entry probe, gives access to TIP 280
113 * information for the command invocation (i.e. [info frame 0])
114 * arg0: TIP 280 cmd (string)
115 * arg1: TIP 280 type (string)
116 * arg2: TIP 280 proc (string)
117 * arg3: TIP 280 file (string)
118 * arg4: TIP 280 line (int)
119 * arg5: TIP 280 level (int)
120 * arg6: TclOO method (string)
121 * arg7: TclOO class/object (string)
122 */
123 probe cmd__info(const char *cmd, const char *type, const char *proc,
124 const char *file, int line, int level, const char *method,
125 const char *class);
126
127 /***************************** inst probes *****************************/
128 /*
129 * tcl*:::inst-start probe
130 * triggered immediately before execution of a bytecode
131 * arg0: bytecode name (string)
132 * arg1: depth of stack (int)
133 * arg2: top of stack (Tcl_Obj**)
134 */
135 probe inst__start(const char *name, int depth, struct Tcl_Obj **stack);
136 /*
137 * tcl*:::inst-done probe
138 * triggered immediately after execution of a bytecode
139 * arg0: bytecode name (string)
140 * arg1: depth of stack (int)
141 * arg2: top of stack (Tcl_Obj**)
142 */
143 probe inst__done(const char *name, int depth, struct Tcl_Obj **stack);
144
145 /***************************** obj probes ******************************/
146 /*
147 * tcl*:::obj-create probe
148 * triggered immediately after a new Tcl_Obj has been created
149 * arg0: object created (Tcl_Obj*)
150 */
151 probe obj__create(struct Tcl_Obj* obj);
152 /*
153 * tcl*:::obj-free probe
154 * triggered immediately before a Tcl_Obj is freed
155 * arg0: object to be freed (Tcl_Obj*)
156 */
157 probe obj__free(struct Tcl_Obj* obj);
158
159 /***************************** tcl probes ******************************/
160 /*
161 * tcl*:::tcl-probe probe
162 * triggered when the ::tcl::dtrace command is called
163 * arg0-arg9: command arguments (strings)
164 */
165 probe tcl__probe(const char *arg0, const char *arg1, const char *arg2,
166 const char *arg3, const char *arg4, const char *arg5,
167 const char *arg6, const char *arg7, const char *arg8,
168 const char *arg9);
169 };
170
171 /*
172 * Tcl types and constants for use in DTrace scripts
173 */
174
175 typedef struct Tcl_ObjType {
176 const char *name;
177 void *freeIntRepProc;
178 void *dupIntRepProc;
179 void *updateStringProc;
180 void *setFromAnyProc;
181 } Tcl_ObjType;
182
183 struct Tcl_Obj {
184 int refCount;
185 char *bytes;
186 int length;
187 const Tcl_ObjType *typePtr;
188 union {
189 long longValue;
190 double doubleValue;
191 void *otherValuePtr;
192 int64_t wideValue;
193 struct {
194 void *ptr1;
195 void *ptr2;
196 } twoPtrValue;
197 struct {
198 void *ptr;
199 unsigned long value;
200 } ptrAndLongRep;
201 } internalRep;
202 };
203
204 enum return_codes {
205 TCL_OK = 0,
206 TCL_ERROR,
207 TCL_RETURN,
208 TCL_BREAK,
209 TCL_CONTINUE
210 };
211
212 #pragma D attributes Evolving/Evolving/Common provider tcl provider
213 #pragma D attributes Private/Private/Common provider tcl module
214 #pragma D attributes Private/Private/Common provider tcl function
215 #pragma D attributes Evolving/Evolving/Common provider tcl name
216 #pragma D attributes Evolving/Evolving/Common provider tcl args
217
218 /*
219 * Local Variables:
220 * mode: c
221 * c-basic-offset: 4
222 * fill-column: 78
223 * End:
224 */