components/python/python27/patches/05-dtrace.patch
author Norm Jacobs <Norm.Jacobs@Oracle.COM>
Thu, 04 Aug 2011 19:59:04 -0700
changeset 458 2edc011b559e
child 1246 164605dfef4e
child 3367 ed5024e47b53
permissions -rw-r--r--
7004671 Add Python 2.7.1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
458
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     1
--- Python-2.7.1/Makefile.pre.in.~1~	Thu Oct 14 06:37:30 2010
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     2
+++ Python-2.7.1/Makefile.pre.in	Mon Jul 18 14:53:46 2011
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     3
@@ -198,6 +198,7 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     4
 # Used of signalmodule.o is not available
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     5
 SIGNAL_OBJS=	@[email protected]
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     6
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     7
+DTRACE_OBJS=Python/dtrace.o Python/phelper.o
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     8
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     9
 ##########################################################################
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    10
 # Grammar
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    11
@@ -298,6 +299,7 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    12
 		Python/formatter_unicode.o \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    13
 		Python/formatter_string.o \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    14
 		Python/$(DYNLOADFILE) \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    15
+		$(DTRACE_OBJS) \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    16
 		$(LIBOBJS) \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    17
 		$(MACHDEP_OBJS) \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    18
 		$(THREADOBJ)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    19
@@ -599,6 +601,18 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    20
 Python/formatter_string.o: $(srcdir)/Python/formatter_string.c \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    21
 				$(STRINGLIB_HEADERS)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    22
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    23
+Python/phelper.o: $(srcdir)/Python/phelper.d
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    24
+	dtrace -o [email protected] -DPHELPER $(DFLAGS) $(CPPFLAGS) -C -G -s $(srcdir)/Python/phelper.d
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    25
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    26
+Python/python.h: $(srcdir)/Python/python.d
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    27
+	dtrace -o [email protected] $(DFLAGS) -C -h -s $(srcdir)/Python/python.d
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    28
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    29
+Python/ceval.o: Python/ceval.c Python/python.h
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    30
+	$(CC) -c -I. -IPython $(BASECFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) $(CFLAGS) -DPy_BUILD_CORE -o [email protected] $<
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    31
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    32
+Python/dtrace.o: $(srcdir)/Python/python.d Python/ceval.o
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    33
+	dtrace -o [email protected] $(DFLAGS) -C -G -s $(srcdir)/Python/python.d Python/ceval.o
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    34
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    35
 ############################################################################
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    36
 # Header files
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    37
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    38
--- Python-2.7.1/Include/frameobject.h.~1~	Fri May  8 17:23:21 2009
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    39
+++ Python-2.7.1/Include/frameobject.h	Mon Jul 18 14:53:46 2011
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    40
@@ -44,6 +44,7 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    41
        PyCode_Addr2Line to calculate the line from the current
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    42
        bytecode index. */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    43
     int f_lineno;		/* Current line number */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    44
+    int f_calllineno;		/* line number of call site */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    45
     int f_iblock;		/* index in f_blockstack */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    46
     PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    47
     PyObject *f_localsplus[1];	/* locals+stack, dynamically sized */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    48
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    49
--- Python-2.7.1/Objects/frameobject.c.~1~	Sun May  9 09:46:46 2010
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    50
+++ Python-2.7.1/Objects/frameobject.c	Mon Jul 18 15:03:52 2011
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    51
@@ -736,6 +736,7 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    52
     f->f_tstate = tstate;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    53
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    54
     f->f_lasti = -1;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    55
+    f->f_calllineno = code->co_firstlineno;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    56
     f->f_lineno = code->co_firstlineno;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    57
     f->f_iblock = 0;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    58
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    59
--- Python-2.7.1/Python/ceval.c.~1~	Fri Sep 24 22:27:12 2010
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    60
+++ Python-2.7.1/Python/ceval.c	Mon Jul 18 15:15:35 2011
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    61
@@ -19,6 +19,11 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    62
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    63
 #include <ctype.h>
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    64
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    65
+#define HAVE_DTRACE
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    66
+#ifdef HAVE_DTRACE
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    67
+#include "python.h"
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    68
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    69
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    70
 #ifndef WITH_TSC
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    71
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    72
 #define READ_TIMESTAMP(var)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    73
@@ -671,7 +676,56 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    74
                       NULL);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    75
 }
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    76
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    77
+#ifdef HAVE_DTRACE
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    78
+static void
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    79
+dtrace_entry(PyFrameObject *f)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    80
+{
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    81
+	const char *filename;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    82
+	const char *fname;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    83
+	int lineno;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    84
+	
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    85
+	filename = PyString_AsString(f->f_code->co_filename);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    86
+	fname = PyString_AsString(f->f_code->co_name);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    87
+	lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    88
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    89
+	PYTHON_FUNCTION_ENTRY((char *)filename, (char *)fname, lineno);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    90
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    91
+	/*
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    92
+	 * Currently a USDT tail-call will not receive the correct arguments.
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    93
+	 * Disable the tail call here.
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    94
+	 */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    95
+#if defined(__sparc)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    96
+	asm("nop");
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    97
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    98
+}
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    99
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   100
+static void
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   101
+dtrace_return(PyFrameObject *f)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   102
+{
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   103
+	const char *filename;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   104
+	const char *fname;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   105
+	int lineno;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   106
+	
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   107
+	filename = PyString_AsString(f->f_code->co_filename);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   108
+	fname = PyString_AsString(f->f_code->co_name);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   109
+	lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   110
+	PYTHON_FUNCTION_RETURN((char *)filename, (char *)fname, lineno);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   111
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   112
+	/*
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   113
+	 * Currently a USDT tail-call will not receive the correct arguments.
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   114
+	 * Disable the tail call here.
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   115
+	 */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   116
+#if defined(__sparc)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   117
+	asm("nop");
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   118
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   119
+}
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   120
+#else
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   121
+#define	PYTHON_FUNCTION_ENTRY_ENABLED 0
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   122
+#define	PYTHON_FUNCTION_RETURN_ENABLED 0
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   123
+#define	dtrace_entry()
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   124
+#define	dtrace_return()
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   125
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   126
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   127
 /* Interpreter main loop */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   128
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   129
 PyObject *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   130
@@ -682,9 +736,84 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   131
     return PyEval_EvalFrameEx(f, 0);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   132
 }
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   133
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   134
+/*
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   135
+ * These shenanigans look like utter madness, but what we're actually doing is
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   136
+ * making sure that the ustack helper will see the PyFrameObject pointer on the
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   137
+ * stack. We have two tricky cases:
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   138
+ *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   139
+ * amd64
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   140
+ *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   141
+ * We use up the six registers for passing arguments, meaning the call can't
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   142
+ * use a register for passing 'f', and has to push it onto the stack in a known
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   143
+ * location.
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   144
+ *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   145
+ * And how does "throwflag" figure in to this? -PN
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   146
+ *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   147
+ * SPARC
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   148
+ *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   149
+ * Here the problem is that (on 32-bit) the compiler is re-using %i0 before
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   150
+ * some calls inside PyEval_EvalFrameReal(), which means that when it's saved,
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   151
+ * it's just some junk value rather than the real first argument. So, instead,
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   152
+ * we trace our proxy PyEval_EvalFrame(), where we 'know' the compiler won't
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   153
+ * decide to re-use %i0. We also need to defeat optimization of our proxy.
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   154
+ */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   155
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   156
+#if defined(HAVE_DTRACE)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   157
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   158
+#if defined(__amd64)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   159
+PyObject *PyEval_EvalFrameExReal(long, long, long, long, long, long,
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   160
+    PyFrameObject *, int throwflag);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   161
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   162
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   163
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   164
 PyObject *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   165
 PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   166
 {
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   167
+	volatile PyObject *f2;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   168
+	f2 = PyEval_EvalFrameExReal(0, 0, 0, 0, 0, 0, f, throwflag);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   169
+	return (PyObject *)f2;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   170
+}
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   171
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   172
+PyObject *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   173
+PyEval_EvalFrameExReal(long a1, long a2, long a3, long a4, long a5, long a6,
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   174
+    PyFrameObject *f, int throwflag)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   175
+{
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   176
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   177
+#elif defined(__sparc)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   178
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   179
+PyObject *PyEval_EvalFrameExReal(PyFrameObject *f, int throwflag);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   180
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   181
+volatile int dummy;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   182
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   183
+PyObject *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   184
+PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   185
+{
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   186
+	volatile PyObject *f2;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   187
+	f2 = PyEval_EvalFrameExReal(f, throwflag);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   188
+	dummy = f->ob_refcnt;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   189
+	return (PyObject *)f2;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   190
+}
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   191
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   192
+PyObject *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   193
+PyEval_EvalFrameExReal(PyFrameObject *f, int throwflag)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   194
+{
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   195
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   196
+#else /* __amd64 || __sparc */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   197
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   198
+PyObject *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   199
+PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   200
+{
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   201
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   202
+#endif /* __amd64 || __sparc */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   203
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   204
+#else /* don't HAVE_DTRACE */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   205
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   206
+PyObject *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   207
+PyEval_EvalFrameexEx(PyFrameObject *f, int throwflag))
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   208
+{
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   209
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   210
+#endif /* HAVE_DTRACE */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   211
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   212
 #ifdef DXPAIRS
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   213
     int lastopcode = 0;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   214
 #endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   215
@@ -909,6 +1038,11 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   216
         }
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   217
     }
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   218
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   219
+#ifdef HAVE_DTRACE
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   220
+    if (PYTHON_FUNCTION_ENTRY_ENABLED())
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   221
+        dtrace_entry(f);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   222
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   223
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   224
     co = f->f_code;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   225
     names = co->co_names;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   226
     consts = co->co_consts;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   227
@@ -2659,6 +2793,9 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   228
             PyObject **sp;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   229
             PCALL(PCALL_ALL);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   230
             sp = stack_pointer;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   231
+#ifdef HAVE_DTRACE
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   232
+            f->f_calllineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   233
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   234
 #ifdef WITH_TSC
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   235
             x = call_function(&sp, oparg, &intr0, &intr1);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   236
 #else
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   237
@@ -2700,6 +2837,9 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   238
             } else
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   239
                 Py_INCREF(func);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   240
             sp = stack_pointer;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   241
+#ifdef HAVE_DTRACE
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   242
+            f->f_calllineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   243
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   244
             READ_TIMESTAMP(intr0);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   245
             x = ext_do_call(func, &sp, flags, na, nk);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   246
             READ_TIMESTAMP(intr1);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   247
@@ -3000,6 +3140,10 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   248
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   249
     /* pop frame */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   250
 exit_eval_frame:
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   251
+#ifdef HAVE_DTRACE
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   252
+    if (PYTHON_FUNCTION_RETURN_ENABLED())
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   253
+        dtrace_return(f);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   254
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   255
     Py_LeaveRecursiveCall();
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   256
     tstate->frame = f->f_back;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   257
 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   258
diff --git Python-2.6.4/Python/phelper.d Python-2.6.4/Python/phelper.d
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   259
new file mode 100644
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   260
--- /dev/null
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   261
+++ Python-2.6.4/Python/phelper.d
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   262
@@ -0,0 +1,139 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   263
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   264
+/*
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   265
+ * Python ustack helper.  This relies on the first argument (PyFrame *) being
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   266
+ * on the stack; see Python/ceval.c for the contortions we go through to ensure
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   267
+ * this is the case.
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   268
+ *
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   269
+ * On x86, the PyFrame * is two slots up from the frame pointer; on SPARC, it's
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   270
+ * eight.
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   271
+ */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   272
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   273
+/*
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   274
+ * Yes, this is as gross as it looks. DTrace cannot handle static functions,
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   275
+ * and our stat_impl.h has them in ILP32.
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   276
+ */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   277
+#define _SYS_STAT_H
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   278
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   279
+#include <stdio.h>
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   280
+#include <sys/types.h>
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   281
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   282
+#include "pyport.h"
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   283
+#include "object.h"
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   284
+#include "pystate.h"
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   285
+#include "pyarena.h"
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   286
+#include "pythonrun.h"
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   287
+#include "compile.h"
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   288
+#include "frameobject.h"
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   289
+#include "stringobject.h"
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   290
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   291
+#if defined(__i386)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   292
+#define	startframe PyEval_EvalFrameEx
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   293
+#define	endframe PyEval_EvalCodeEx
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   294
+#elif defined(__amd64)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   295
+#define	PyEval_EvalFrameEx PyEval_EvalFrameExReal
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   296
+#define	startframe PyEval_EvalFrameExReal
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   297
+#define	endframe PyEval_EvalCodeEx
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   298
+#elif defined(__sparc)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   299
+#define	PyEval_EvalFrameEx PyEval_EvalFrameExReal
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   300
+#define	startframe PyEval_EvalFrameEx
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   301
+#define	endframe PyEval_EvalFrameExReal
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   302
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   303
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   304
+#ifdef __sparcv9
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   305
+#define	STACK_BIAS (2048-1)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   306
+#else
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   307
+#define	STACK_BIAS 0
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   308
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   309
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   310
+/*
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   311
+ * Not defining PHELPER lets us test this code as a normal D script.
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   312
+ */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   313
+#ifdef PHELPER
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   314
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   315
+#define	at_evalframe(addr) \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   316
+    ((uintptr_t)addr >= ((uintptr_t)&``startframe) && \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   317
+     (uintptr_t)addr < ((uintptr_t)&``endframe))
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   318
+#define	probe dtrace:helper:ustack:
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   319
+#define	print_result(r) (r)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   320
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   321
+#if defined(__i386) || defined(__amd64)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   322
+#define	frame_ptr_addr ((uintptr_t)arg1 + sizeof(uintptr_t) * 2)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   323
+#elif defined(__sparc)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   324
+#define	frame_ptr_addr ((uintptr_t)arg1 + STACK_BIAS + sizeof(uintptr_t) * 8)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   325
+#else
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   326
+#error unknown architecture
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   327
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   328
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   329
+#else /* PHELPER */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   330
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   331
+#define	at_evalframe(addr) (1)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   332
+#define	probe pid$target::PyEval_EvalFrame:entry
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   333
+#define print_result(r) (trace(r))
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   334
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   335
+#if defined(__i386) || defined(__amd64)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   336
+#define	frame_ptr_addr ((uintptr_t)uregs[R_SP] + sizeof(uintptr_t))
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   337
+#elif defined(__sparc)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   338
+/*
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   339
+ * Not implemented: we could just use R_I0, but what's the point?
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   340
+ */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   341
+#else
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   342
+#error unknown architecture
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   343
+#endif
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   344
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   345
+#endif /* PHELPER */
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   346
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   347
+extern uintptr_t PyEval_EvalFrameEx;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   348
+extern uintptr_t PyEval_EvalCodeEx;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   349
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   350
+#define	copyin_obj(addr, obj) ((obj *)copyin((uintptr_t)addr, sizeof(obj)))
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   351
+#define	pystr_addr(addr) ((char *)addr + offsetof(PyStringObject, ob_sval))
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   352
+#define	copyin_str(dest, addr, obj) \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   353
+    (copyinto((uintptr_t)pystr_addr(addr), obj->ob_size, (dest)))
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   354
+#define	add_str(addr, obj) \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   355
+    copyin_str(this->result + this->pos, addr, obj); \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   356
+    this->pos += obj->ob_size; \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   357
+    this->result[this->pos] = '\0';
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   358
+#define	add_digit(nr, div) ((nr / div) ? \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   359
+    (this->result[this->pos++] = '0' + ((nr / div) % 10)) : \
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   360
+    (this->result[this->pos] = '\0'))
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   361
+#define	add_char(c) (this->result[this->pos++] = c)
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   362
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   363
+probe /at_evalframe(arg0)/ 
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   364
+{
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   365
+	this->framep = *(uintptr_t *)copyin(frame_ptr_addr, sizeof(uintptr_t));
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   366
+	this->frameo = copyin_obj(this->framep, PyFrameObject);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   367
+	this->codep = this->frameo->f_code;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   368
+	this->lineno = this->frameo->f_calllineno;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   369
+	this->codeo = copyin_obj(this->codep, PyCodeObject);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   370
+	this->filenamep = this->codeo->co_filename;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   371
+	this->fnamep = this->codeo->co_name;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   372
+	this->filenameo = copyin_obj(this->filenamep, PyStringObject);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   373
+	this->fnameo = copyin_obj(this->fnamep, PyStringObject);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   374
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   375
+	this->len = 1 + this->filenameo->ob_size + 1 + 5 + 2 +
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   376
+	    this->fnameo->ob_size + 1 + 1;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   377
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   378
+	this->result = (char *)alloca(this->len);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   379
+	this->pos = 0;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   380
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   381
+	add_char('@');
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   382
+	add_str(this->filenamep, this->filenameo);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   383
+	add_char(':');
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   384
+	add_digit(this->lineno, 10000);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   385
+	add_digit(this->lineno, 1000);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   386
+	add_digit(this->lineno, 100);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   387
+	add_digit(this->lineno, 10);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   388
+	add_digit(this->lineno, 1);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   389
+	add_char(' ');
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   390
+	add_char('(');
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   391
+	add_str(this->fnamep, this->fnameo);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   392
+	add_char(')');
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   393
+	this->result[this->pos] = '\0';
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   394
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   395
+	print_result(stringof(this->result));
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   396
+}
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   397
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   398
+probe /!at_evalframe(arg0)/
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   399
+{
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   400
+	NULL;
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   401
+}
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   402
diff --git Python-2.6.4/Python/python.d Python-2.6.4/Python/python.d
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   403
new file mode 100644
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   404
--- /dev/null
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   405
+++ Python-2.6.4/Python/python.d
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   406
@@ -0,0 +1,10 @@
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   407
+provider python {
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   408
+	probe function__entry(const char *, const char *, int);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   409
+	probe function__return(const char *, const char *, int);
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   410
+};
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   411
+
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   412
+#pragma D attributes Evolving/Evolving/Common provider python provider
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   413
+#pragma D attributes Private/Private/Common provider python module
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   414
+#pragma D attributes Private/Private/Common provider python function
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   415
+#pragma D attributes Evolving/Evolving/Common provider python name
2edc011b559e 7004671 Add Python 2.7.1
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   416
+#pragma D attributes Evolving/Evolving/Common provider python args