author | John Beck <John.Beck@Oracle.COM> |
Tue, 20 Dec 2016 13:25:44 -0800 | |
changeset 7516 | 09c933391a1b |
parent 7095 | 6469e6424607 |
permissions | -rw-r--r-- |
1246
164605dfef4e
15799279 - Some Python 2.6 and 2.7 "gmake test" tests fail
Brian Cameron <brian.cameron@oracle.com>
parents:
458
diff
changeset
|
1 |
This patch adds Python dtrace support. Note it is necessary to modify |
164605dfef4e
15799279 - Some Python 2.6 and 2.7 "gmake test" tests fail
Brian Cameron <brian.cameron@oracle.com>
parents:
458
diff
changeset
|
2 |
test_sys.py to add an integer to the frameobject structure size since this |
164605dfef4e
15799279 - Some Python 2.6 and 2.7 "gmake test" tests fail
Brian Cameron <brian.cameron@oracle.com>
parents:
458
diff
changeset
|
3 |
patch adds "int f_calllineno" to the structure, so this test does not fail. |
1954
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
4 |
The patch comes from upstream: |
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
5 |
http://www.jcea.es/artic/python_dtrace-2_7_7_af8ecf2352e1.txt |
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
6 |
http://www.jcea.es/artic/python_dtrace.htm |
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
7 |
Follow http://bugs.python.org/issue13405 for plans to get it |
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
8 |
integrated into the main tree. |
1246
164605dfef4e
15799279 - Some Python 2.6 and 2.7 "gmake test" tests fail
Brian Cameron <brian.cameron@oracle.com>
parents:
458
diff
changeset
|
9 |
|
6445
0edecb568b2e
23858073 Upgrade Python 2.7 line to 2.7.12
John Beck <John.Beck@Oracle.COM>
parents:
6058
diff
changeset
|
10 |
--- Python-2.7.12/Makefile.pre.in.~1~ 2016-06-25 14:49:31.000000000 -0700 |
0edecb568b2e
23858073 Upgrade Python 2.7 line to 2.7.12
John Beck <John.Beck@Oracle.COM>
parents:
6058
diff
changeset
|
11 |
+++ Python-2.7.12/Makefile.pre.in 2016-07-07 13:45:26.859336399 -0700 |
7516
09c933391a1b
25293039 Upgrade Python 2.7 line to 2.7.13
John Beck <John.Beck@Oracle.COM>
parents:
7095
diff
changeset
|
12 |
@@ -232,6 +232,7 @@ |
458 | 13 |
# Used of signalmodule.o is not available |
14 |
SIGNAL_OBJS= @SIGNAL_OBJS@ |
|
15 |
||
16 |
+DTRACE_OBJS=Python/dtrace.o Python/phelper.o |
|
17 |
||
18 |
########################################################################## |
|
19 |
# Grammar |
|
7516
09c933391a1b
25293039 Upgrade Python 2.7 line to 2.7.13
John Beck <John.Beck@Oracle.COM>
parents:
7095
diff
changeset
|
20 |
@@ -365,6 +366,7 @@ |
458 | 21 |
Python/formatter_unicode.o \ |
22 |
Python/formatter_string.o \ |
|
23 |
Python/$(DYNLOADFILE) \ |
|
24 |
+ $(DTRACE_OBJS) \ |
|
25 |
$(LIBOBJS) \ |
|
26 |
$(MACHDEP_OBJS) \ |
|
27 |
$(THREADOBJ) |
|
7516
09c933391a1b
25293039 Upgrade Python 2.7 line to 2.7.13
John Beck <John.Beck@Oracle.COM>
parents:
7095
diff
changeset
|
28 |
@@ -751,6 +753,18 @@ |
458 | 29 |
Python/formatter_string.o: $(srcdir)/Python/formatter_string.c \ |
30 |
$(STRINGLIB_HEADERS) |
|
31 |
||
32 |
+Python/phelper.o: $(srcdir)/Python/phelper.d |
|
33 |
+ dtrace -o $@ -DPHELPER $(DFLAGS) $(CPPFLAGS) -C -G -s $(srcdir)/Python/phelper.d |
|
34 |
+ |
|
35 |
+Python/python.h: $(srcdir)/Python/python.d |
|
36 |
+ dtrace -o $@ $(DFLAGS) -C -h -s $(srcdir)/Python/python.d |
|
37 |
+ |
|
38 |
+Python/ceval.o: Python/ceval.c Python/python.h |
|
6058
dd8b0bdd3859
23311386 python2.7 dumps core on SPARC when DTrace on Python is running
John Beck <John.Beck@Oracle.COM>
parents:
5183
diff
changeset
|
39 |
+ $(patsubst $(CEVAL_PATSUBST),,$(CC) -c -I. -IPython $(BASECFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) $(CEVAL_CFLAGS)) -DPy_BUILD_CORE -o $@ $< |
458 | 40 |
+ |
41 |
+Python/dtrace.o: $(srcdir)/Python/python.d Python/ceval.o |
|
42 |
+ dtrace -o $@ $(DFLAGS) -C -G -s $(srcdir)/Python/python.d Python/ceval.o |
|
43 |
+ |
|
44 |
############################################################################ |
|
45 |
# Header files |
|
46 |
||
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
47 |
--- Python-2.7.6/Include/frameobject.h.~1~ 2013-11-09 23:36:39.000000000 -0800 |
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
48 |
+++ Python-2.7.6/Include/frameobject.h 2014-05-14 13:03:19.938777249 -0700 |
458 | 49 |
@@ -44,6 +44,7 @@ |
50 |
PyCode_Addr2Line to calculate the line from the current |
|
51 |
bytecode index. */ |
|
52 |
int f_lineno; /* Current line number */ |
|
53 |
+ int f_calllineno; /* line number of call site */ |
|
54 |
int f_iblock; /* index in f_blockstack */ |
|
55 |
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ |
|
56 |
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ |
|
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
57 |
--- Python-2.7.6/Objects/frameobject.c.~1~ 2013-11-09 23:36:41.000000000 -0800 |
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
58 |
+++ Python-2.7.6/Objects/frameobject.c 2014-05-14 12:56:06.970076859 -0700 |
6445
0edecb568b2e
23858073 Upgrade Python 2.7 line to 2.7.12
John Beck <John.Beck@Oracle.COM>
parents:
6058
diff
changeset
|
59 |
@@ -736,6 +736,7 @@ |
458 | 60 |
f->f_tstate = tstate; |
61 |
||
62 |
f->f_lasti = -1; |
|
63 |
+ f->f_calllineno = code->co_firstlineno; |
|
64 |
f->f_lineno = code->co_firstlineno; |
|
65 |
f->f_iblock = 0; |
|
66 |
||
5183
3a048793fc91
22331987 update Python 2.7 line to version 2.7.11
John Beck <John.Beck@Oracle.COM>
parents:
4698
diff
changeset
|
67 |
--- Python-2.7.11rc1/Python/ceval.c.~1~ 2015-11-21 13:43:46.000000000 -0800 |
3a048793fc91
22331987 update Python 2.7 line to version 2.7.11
John Beck <John.Beck@Oracle.COM>
parents:
4698
diff
changeset
|
68 |
+++ Python-2.7.11rc1/Python/ceval.c 2015-12-03 13:42:17.344605237 -0800 |
458 | 69 |
@@ -19,6 +19,11 @@ |
70 |
||
71 |
#include <ctype.h> |
|
72 |
||
73 |
+#define HAVE_DTRACE |
|
74 |
+#ifdef HAVE_DTRACE |
|
75 |
+#include "python.h" |
|
76 |
+#endif |
|
77 |
+ |
|
78 |
#ifndef WITH_TSC |
|
79 |
||
80 |
#define READ_TIMESTAMP(var) |
|
4698
4e27e549b58d
21162830 update Python 2.7 line to version 2.7.10
John Beck <John.Beck@Oracle.COM>
parents:
3555
diff
changeset
|
81 |
@@ -674,6 +679,55 @@ |
458 | 82 |
NULL); |
83 |
} |
|
84 |
||
85 |
+#ifdef HAVE_DTRACE |
|
86 |
+static void |
|
87 |
+dtrace_entry(PyFrameObject *f) |
|
88 |
+{ |
|
89 |
+ const char *filename; |
|
90 |
+ const char *fname; |
|
91 |
+ int lineno; |
|
92 |
+ |
|
93 |
+ filename = PyString_AsString(f->f_code->co_filename); |
|
94 |
+ fname = PyString_AsString(f->f_code->co_name); |
|
95 |
+ lineno = PyCode_Addr2Line(f->f_code, f->f_lasti); |
|
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
96 |
+ |
458 | 97 |
+ PYTHON_FUNCTION_ENTRY((char *)filename, (char *)fname, lineno); |
98 |
+ |
|
99 |
+ /* |
|
100 |
+ * Currently a USDT tail-call will not receive the correct arguments. |
|
101 |
+ * Disable the tail call here. |
|
102 |
+ */ |
|
103 |
+#if defined(__sparc) |
|
104 |
+ asm("nop"); |
|
105 |
+#endif |
|
106 |
+} |
|
107 |
+ |
|
108 |
+static void |
|
109 |
+dtrace_return(PyFrameObject *f) |
|
110 |
+{ |
|
111 |
+ const char *filename; |
|
112 |
+ const char *fname; |
|
113 |
+ int lineno; |
|
114 |
+ |
|
115 |
+ filename = PyString_AsString(f->f_code->co_filename); |
|
116 |
+ fname = PyString_AsString(f->f_code->co_name); |
|
117 |
+ lineno = PyCode_Addr2Line(f->f_code, f->f_lasti); |
|
118 |
+ PYTHON_FUNCTION_RETURN((char *)filename, (char *)fname, lineno); |
|
119 |
+ |
|
120 |
+ /* |
|
121 |
+ * Currently a USDT tail-call will not receive the correct arguments. |
|
122 |
+ * Disable the tail call here. |
|
123 |
+ */ |
|
124 |
+#if defined(__sparc) |
|
125 |
+ asm("nop"); |
|
126 |
+#endif |
|
127 |
+} |
|
128 |
+#else |
|
129 |
+#define PYTHON_FUNCTION_ENTRY_ENABLED 0 |
|
130 |
+#define PYTHON_FUNCTION_RETURN_ENABLED 0 |
|
131 |
+#define dtrace_entry() |
|
132 |
+#define dtrace_return() |
|
133 |
+#endif |
|
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
134 |
|
458 | 135 |
/* Interpreter main loop */ |
136 |
||
4698
4e27e549b58d
21162830 update Python 2.7 line to version 2.7.10
John Beck <John.Beck@Oracle.COM>
parents:
3555
diff
changeset
|
137 |
@@ -685,9 +739,84 @@ |
458 | 138 |
return PyEval_EvalFrameEx(f, 0); |
139 |
} |
|
140 |
||
141 |
+/* |
|
142 |
+ * These shenanigans look like utter madness, but what we're actually doing is |
|
143 |
+ * making sure that the ustack helper will see the PyFrameObject pointer on the |
|
144 |
+ * stack. We have two tricky cases: |
|
145 |
+ * |
|
146 |
+ * amd64 |
|
147 |
+ * |
|
148 |
+ * We use up the six registers for passing arguments, meaning the call can't |
|
149 |
+ * use a register for passing 'f', and has to push it onto the stack in a known |
|
150 |
+ * location. |
|
151 |
+ * |
|
152 |
+ * And how does "throwflag" figure in to this? -PN |
|
153 |
+ * |
|
154 |
+ * SPARC |
|
155 |
+ * |
|
156 |
+ * Here the problem is that (on 32-bit) the compiler is re-using %i0 before |
|
157 |
+ * some calls inside PyEval_EvalFrameReal(), which means that when it's saved, |
|
158 |
+ * it's just some junk value rather than the real first argument. So, instead, |
|
159 |
+ * we trace our proxy PyEval_EvalFrame(), where we 'know' the compiler won't |
|
160 |
+ * decide to re-use %i0. We also need to defeat optimization of our proxy. |
|
161 |
+ */ |
|
162 |
+ |
|
163 |
+#if defined(HAVE_DTRACE) |
|
164 |
+ |
|
165 |
+#if defined(__amd64) |
|
166 |
+PyObject *PyEval_EvalFrameExReal(long, long, long, long, long, long, |
|
167 |
+ PyFrameObject *, int throwflag); |
|
168 |
+ |
|
169 |
+ |
|
170 |
+ |
|
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
171 |
+PyObject * |
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
172 |
+PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) |
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
173 |
+{ |
458 | 174 |
+ volatile PyObject *f2; |
175 |
+ f2 = PyEval_EvalFrameExReal(0, 0, 0, 0, 0, 0, f, throwflag); |
|
176 |
+ return (PyObject *)f2; |
|
177 |
+} |
|
178 |
+ |
|
179 |
+PyObject * |
|
180 |
+PyEval_EvalFrameExReal(long a1, long a2, long a3, long a4, long a5, long a6, |
|
181 |
+ PyFrameObject *f, int throwflag) |
|
182 |
+{ |
|
183 |
+ |
|
184 |
+#elif defined(__sparc) |
|
185 |
+ |
|
186 |
+PyObject *PyEval_EvalFrameExReal(PyFrameObject *f, int throwflag); |
|
187 |
+ |
|
188 |
+volatile int dummy; |
|
189 |
+ |
|
190 |
+PyObject * |
|
191 |
+PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) |
|
192 |
+{ |
|
193 |
+ volatile PyObject *f2; |
|
194 |
+ f2 = PyEval_EvalFrameExReal(f, throwflag); |
|
195 |
+ dummy = f->ob_refcnt; |
|
196 |
+ return (PyObject *)f2; |
|
197 |
+} |
|
198 |
+ |
|
199 |
+PyObject * |
|
200 |
+PyEval_EvalFrameExReal(PyFrameObject *f, int throwflag) |
|
201 |
+{ |
|
202 |
+ |
|
203 |
+#else /* __amd64 || __sparc */ |
|
204 |
+ |
|
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
205 |
PyObject * |
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
206 |
PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) |
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
207 |
{ |
458 | 208 |
+ |
209 |
+#endif /* __amd64 || __sparc */ |
|
210 |
+ |
|
211 |
+#else /* don't HAVE_DTRACE */ |
|
212 |
+ |
|
213 |
+PyObject * |
|
214 |
+PyEval_EvalFrameexEx(PyFrameObject *f, int throwflag)) |
|
215 |
+{ |
|
216 |
+ |
|
217 |
+#endif /* HAVE_DTRACE */ |
|
218 |
+ |
|
5183
3a048793fc91
22331987 update Python 2.7 line to version 2.7.11
John Beck <John.Beck@Oracle.COM>
parents:
4698
diff
changeset
|
219 |
#ifdef DYNAMIC_EXECUTION_PROFILE |
3a048793fc91
22331987 update Python 2.7 line to version 2.7.11
John Beck <John.Beck@Oracle.COM>
parents:
4698
diff
changeset
|
220 |
#undef USE_COMPUTED_GOTOS |
458 | 221 |
#endif |
5183
3a048793fc91
22331987 update Python 2.7 line to version 2.7.11
John Beck <John.Beck@Oracle.COM>
parents:
4698
diff
changeset
|
222 |
@@ -1009,6 +1138,11 @@ |
458 | 223 |
} |
224 |
} |
|
225 |
||
226 |
+#ifdef HAVE_DTRACE |
|
227 |
+ if (PYTHON_FUNCTION_ENTRY_ENABLED()) |
|
228 |
+ dtrace_entry(f); |
|
229 |
+#endif |
|
230 |
+ |
|
231 |
co = f->f_code; |
|
232 |
names = co->co_names; |
|
233 |
consts = co->co_consts; |
|
7516
09c933391a1b
25293039 Upgrade Python 2.7 line to 2.7.13
John Beck <John.Beck@Oracle.COM>
parents:
7095
diff
changeset
|
234 |
@@ -2983,6 +3117,9 @@ |
458 | 235 |
PyObject **sp; |
236 |
PCALL(PCALL_ALL); |
|
237 |
sp = stack_pointer; |
|
238 |
+#ifdef HAVE_DTRACE |
|
239 |
+ f->f_calllineno = PyCode_Addr2Line(f->f_code, f->f_lasti); |
|
240 |
+#endif |
|
241 |
#ifdef WITH_TSC |
|
242 |
x = call_function(&sp, oparg, &intr0, &intr1); |
|
243 |
#else |
|
7516
09c933391a1b
25293039 Upgrade Python 2.7 line to 2.7.13
John Beck <John.Beck@Oracle.COM>
parents:
7095
diff
changeset
|
244 |
@@ -3024,6 +3161,9 @@ |
458 | 245 |
} else |
246 |
Py_INCREF(func); |
|
247 |
sp = stack_pointer; |
|
248 |
+#ifdef HAVE_DTRACE |
|
249 |
+ f->f_calllineno = PyCode_Addr2Line(f->f_code, f->f_lasti); |
|
250 |
+#endif |
|
251 |
READ_TIMESTAMP(intr0); |
|
252 |
x = ext_do_call(func, &sp, flags, na, nk); |
|
253 |
READ_TIMESTAMP(intr1); |
|
7516
09c933391a1b
25293039 Upgrade Python 2.7 line to 2.7.13
John Beck <John.Beck@Oracle.COM>
parents:
7095
diff
changeset
|
254 |
@@ -3333,6 +3473,10 @@ |
458 | 255 |
|
256 |
/* pop frame */ |
|
257 |
exit_eval_frame: |
|
258 |
+#ifdef HAVE_DTRACE |
|
259 |
+ if (PYTHON_FUNCTION_RETURN_ENABLED()) |
|
260 |
+ dtrace_return(f); |
|
261 |
+#endif |
|
262 |
Py_LeaveRecursiveCall(); |
|
263 |
tstate->frame = f->f_back; |
|
264 |
||
265 |
--- /dev/null |
|
266 |
+++ Python-2.6.4/Python/phelper.d |
|
267 |
@@ -0,0 +1,139 @@ |
|
268 |
+ |
|
269 |
+/* |
|
270 |
+ * Python ustack helper. This relies on the first argument (PyFrame *) being |
|
271 |
+ * on the stack; see Python/ceval.c for the contortions we go through to ensure |
|
272 |
+ * this is the case. |
|
273 |
+ * |
|
274 |
+ * On x86, the PyFrame * is two slots up from the frame pointer; on SPARC, it's |
|
275 |
+ * eight. |
|
276 |
+ */ |
|
277 |
+ |
|
278 |
+/* |
|
279 |
+ * Yes, this is as gross as it looks. DTrace cannot handle static functions, |
|
280 |
+ * and our stat_impl.h has them in ILP32. |
|
281 |
+ */ |
|
282 |
+#define _SYS_STAT_H |
|
283 |
+ |
|
284 |
+#include <stdio.h> |
|
285 |
+#include <sys/types.h> |
|
286 |
+ |
|
287 |
+#include "pyport.h" |
|
288 |
+#include "object.h" |
|
289 |
+#include "pystate.h" |
|
290 |
+#include "pyarena.h" |
|
291 |
+#include "pythonrun.h" |
|
292 |
+#include "compile.h" |
|
293 |
+#include "frameobject.h" |
|
294 |
+#include "stringobject.h" |
|
295 |
+ |
|
296 |
+#if defined(__i386) |
|
297 |
+#define startframe PyEval_EvalFrameEx |
|
298 |
+#define endframe PyEval_EvalCodeEx |
|
299 |
+#elif defined(__amd64) |
|
300 |
+#define PyEval_EvalFrameEx PyEval_EvalFrameExReal |
|
301 |
+#define startframe PyEval_EvalFrameExReal |
|
302 |
+#define endframe PyEval_EvalCodeEx |
|
303 |
+#elif defined(__sparc) |
|
304 |
+#define PyEval_EvalFrameEx PyEval_EvalFrameExReal |
|
305 |
+#define startframe PyEval_EvalFrameEx |
|
306 |
+#define endframe PyEval_EvalFrameExReal |
|
307 |
+#endif |
|
308 |
+ |
|
309 |
+#ifdef __sparcv9 |
|
310 |
+#define STACK_BIAS (2048-1) |
|
311 |
+#else |
|
312 |
+#define STACK_BIAS 0 |
|
313 |
+#endif |
|
314 |
+ |
|
315 |
+/* |
|
316 |
+ * Not defining PHELPER lets us test this code as a normal D script. |
|
317 |
+ */ |
|
318 |
+#ifdef PHELPER |
|
319 |
+ |
|
320 |
+#define at_evalframe(addr) \ |
|
321 |
+ ((uintptr_t)addr >= ((uintptr_t)&``startframe) && \ |
|
322 |
+ (uintptr_t)addr < ((uintptr_t)&``endframe)) |
|
323 |
+#define probe dtrace:helper:ustack: |
|
324 |
+#define print_result(r) (r) |
|
325 |
+ |
|
326 |
+#if defined(__i386) || defined(__amd64) |
|
327 |
+#define frame_ptr_addr ((uintptr_t)arg1 + sizeof(uintptr_t) * 2) |
|
328 |
+#elif defined(__sparc) |
|
329 |
+#define frame_ptr_addr ((uintptr_t)arg1 + STACK_BIAS + sizeof(uintptr_t) * 8) |
|
330 |
+#else |
|
331 |
+#error unknown architecture |
|
332 |
+#endif |
|
333 |
+ |
|
334 |
+#else /* PHELPER */ |
|
335 |
+ |
|
336 |
+#define at_evalframe(addr) (1) |
|
337 |
+#define probe pid$target::PyEval_EvalFrame:entry |
|
338 |
+#define print_result(r) (trace(r)) |
|
339 |
+ |
|
340 |
+#if defined(__i386) || defined(__amd64) |
|
341 |
+#define frame_ptr_addr ((uintptr_t)uregs[R_SP] + sizeof(uintptr_t)) |
|
342 |
+#elif defined(__sparc) |
|
343 |
+/* |
|
344 |
+ * Not implemented: we could just use R_I0, but what's the point? |
|
345 |
+ */ |
|
346 |
+#else |
|
347 |
+#error unknown architecture |
|
348 |
+#endif |
|
349 |
+ |
|
350 |
+#endif /* PHELPER */ |
|
351 |
+ |
|
352 |
+extern uintptr_t PyEval_EvalFrameEx; |
|
353 |
+extern uintptr_t PyEval_EvalCodeEx; |
|
354 |
+ |
|
355 |
+#define copyin_obj(addr, obj) ((obj *)copyin((uintptr_t)addr, sizeof(obj))) |
|
356 |
+#define pystr_addr(addr) ((char *)addr + offsetof(PyStringObject, ob_sval)) |
|
357 |
+#define copyin_str(dest, addr, obj) \ |
|
358 |
+ (copyinto((uintptr_t)pystr_addr(addr), obj->ob_size, (dest))) |
|
359 |
+#define add_str(addr, obj) \ |
|
360 |
+ copyin_str(this->result + this->pos, addr, obj); \ |
|
361 |
+ this->pos += obj->ob_size; \ |
|
362 |
+ this->result[this->pos] = '\0'; |
|
363 |
+#define add_digit(nr, div) ((nr / div) ? \ |
|
364 |
+ (this->result[this->pos++] = '0' + ((nr / div) % 10)) : \ |
|
365 |
+ (this->result[this->pos] = '\0')) |
|
366 |
+#define add_char(c) (this->result[this->pos++] = c) |
|
367 |
+ |
|
368 |
+probe /at_evalframe(arg0)/ |
|
369 |
+{ |
|
370 |
+ this->framep = *(uintptr_t *)copyin(frame_ptr_addr, sizeof(uintptr_t)); |
|
371 |
+ this->frameo = copyin_obj(this->framep, PyFrameObject); |
|
372 |
+ this->codep = this->frameo->f_code; |
|
373 |
+ this->lineno = this->frameo->f_calllineno; |
|
374 |
+ this->codeo = copyin_obj(this->codep, PyCodeObject); |
|
375 |
+ this->filenamep = this->codeo->co_filename; |
|
376 |
+ this->fnamep = this->codeo->co_name; |
|
377 |
+ this->filenameo = copyin_obj(this->filenamep, PyStringObject); |
|
378 |
+ this->fnameo = copyin_obj(this->fnamep, PyStringObject); |
|
379 |
+ |
|
380 |
+ this->len = 1 + this->filenameo->ob_size + 1 + 5 + 2 + |
|
381 |
+ this->fnameo->ob_size + 1 + 1; |
|
382 |
+ |
|
383 |
+ this->result = (char *)alloca(this->len); |
|
384 |
+ this->pos = 0; |
|
385 |
+ |
|
386 |
+ add_char('@'); |
|
387 |
+ add_str(this->filenamep, this->filenameo); |
|
388 |
+ add_char(':'); |
|
389 |
+ add_digit(this->lineno, 10000); |
|
390 |
+ add_digit(this->lineno, 1000); |
|
391 |
+ add_digit(this->lineno, 100); |
|
392 |
+ add_digit(this->lineno, 10); |
|
393 |
+ add_digit(this->lineno, 1); |
|
394 |
+ add_char(' '); |
|
395 |
+ add_char('('); |
|
396 |
+ add_str(this->fnamep, this->fnameo); |
|
397 |
+ add_char(')'); |
|
398 |
+ this->result[this->pos] = '\0'; |
|
399 |
+ |
|
400 |
+ print_result(stringof(this->result)); |
|
401 |
+} |
|
402 |
+ |
|
403 |
+probe /!at_evalframe(arg0)/ |
|
404 |
+{ |
|
405 |
+ NULL; |
|
406 |
+} |
|
407 |
diff --git Python-2.6.4/Python/python.d Python-2.6.4/Python/python.d |
|
408 |
new file mode 100644 |
|
409 |
--- /dev/null |
|
410 |
+++ Python-2.6.4/Python/python.d |
|
411 |
@@ -0,0 +1,10 @@ |
|
412 |
+provider python { |
|
413 |
+ probe function__entry(const char *, const char *, int); |
|
414 |
+ probe function__return(const char *, const char *, int); |
|
415 |
+}; |
|
416 |
+ |
|
417 |
+#pragma D attributes Evolving/Evolving/Common provider python provider |
|
418 |
+#pragma D attributes Private/Private/Common provider python module |
|
419 |
+#pragma D attributes Private/Private/Common provider python function |
|
420 |
+#pragma D attributes Evolving/Evolving/Common provider python name |
|
421 |
+#pragma D attributes Evolving/Evolving/Common provider python args |
|
4698
4e27e549b58d
21162830 update Python 2.7 line to version 2.7.10
John Beck <John.Beck@Oracle.COM>
parents:
3555
diff
changeset
|
422 |
--- Python-2.7.10/Lib/test/test_sys.py.~1~ 2015-05-10 10:17:04 -0800 |
4e27e549b58d
21162830 update Python 2.7 line to version 2.7.10
John Beck <John.Beck@Oracle.COM>
parents:
3555
diff
changeset
|
423 |
+++ Python-2.7.10/Lib/test/test_sys.py 2015-05-18 14:35:06 -0800 |
6445
0edecb568b2e
23858073 Upgrade Python 2.7 line to 2.7.12
John Beck <John.Beck@Oracle.COM>
parents:
6058
diff
changeset
|
424 |
@@ -635,7 +635,7 @@ |
1246
164605dfef4e
15799279 - Some Python 2.6 and 2.7 "gmake test" tests fail
Brian Cameron <brian.cameron@oracle.com>
parents:
458
diff
changeset
|
425 |
nfrees = len(x.f_code.co_freevars) |
164605dfef4e
15799279 - Some Python 2.6 and 2.7 "gmake test" tests fail
Brian Cameron <brian.cameron@oracle.com>
parents:
458
diff
changeset
|
426 |
extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\ |
164605dfef4e
15799279 - Some Python 2.6 and 2.7 "gmake test" tests fail
Brian Cameron <brian.cameron@oracle.com>
parents:
458
diff
changeset
|
427 |
ncells + nfrees - 1 |
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
428 |
- check(x, vsize('12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) |
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
429 |
+ check(x, vsize('12P4i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) |
1246
164605dfef4e
15799279 - Some Python 2.6 and 2.7 "gmake test" tests fail
Brian Cameron <brian.cameron@oracle.com>
parents:
458
diff
changeset
|
430 |
# function |
164605dfef4e
15799279 - Some Python 2.6 and 2.7 "gmake test" tests fail
Brian Cameron <brian.cameron@oracle.com>
parents:
458
diff
changeset
|
431 |
def func(): pass |
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
1246
diff
changeset
|
432 |
check(func, size('9P')) |
7095
6469e6424607
24811276 Fix 64-bit Python builds so pstack(1) will work
Chad Mynhier <chad.mynhier@oracle.com>
parents:
6445
diff
changeset
|
433 |
--- Python-2.7.12/Include/ceval.h.~1~ 2016-06-25 14:49:30.000000000 -0700 |
6469e6424607
24811276 Fix 64-bit Python builds so pstack(1) will work
Chad Mynhier <chad.mynhier@oracle.com>
parents:
6445
diff
changeset
|
434 |
+++ Python-2.7.12/Include/ceval.h 2016-10-12 07:33:22.132802000 -0700 |
6469e6424607
24811276 Fix 64-bit Python builds so pstack(1) will work
Chad Mynhier <chad.mynhier@oracle.com>
parents:
6445
diff
changeset
|
435 |
@@ -64,6 +64,7 @@ |
6469e6424607
24811276 Fix 64-bit Python builds so pstack(1) will work
Chad Mynhier <chad.mynhier@oracle.com>
parents:
6445
diff
changeset
|
436 |
PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *); |
6469e6424607
24811276 Fix 64-bit Python builds so pstack(1) will work
Chad Mynhier <chad.mynhier@oracle.com>
parents:
6445
diff
changeset
|
437 |
PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *); |
6469e6424607
24811276 Fix 64-bit Python builds so pstack(1) will work
Chad Mynhier <chad.mynhier@oracle.com>
parents:
6445
diff
changeset
|
438 |
PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc); |
6469e6424607
24811276 Fix 64-bit Python builds so pstack(1) will work
Chad Mynhier <chad.mynhier@oracle.com>
parents:
6445
diff
changeset
|
439 |
+#pragma no_inline(PyEval_EvalFrameEx) |
6469e6424607
24811276 Fix 64-bit Python builds so pstack(1) will work
Chad Mynhier <chad.mynhier@oracle.com>
parents:
6445
diff
changeset
|
440 |
|
6469e6424607
24811276 Fix 64-bit Python builds so pstack(1) will work
Chad Mynhier <chad.mynhier@oracle.com>
parents:
6445
diff
changeset
|
441 |
/* this used to be handled on a per-thread basis - now just two globals */ |
6469e6424607
24811276 Fix 64-bit Python builds so pstack(1) will work
Chad Mynhier <chad.mynhier@oracle.com>
parents:
6445
diff
changeset
|
442 |
PyAPI_DATA(volatile int) _Py_Ticker; |