author  Mike Sullivan <Mike.Sullivan@Oracle.COM> 
Mon, 11 Mar 2013 10:38:09 0700  
branch  s11update 
changeset 2520  ceec631e74d1 
parent 841  1a62cefa636d 
child 1246  164605dfef4e 
permissions  rwrr 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

1 
diff git Python2.6.4/Include/frameobject.h Python2.6.4/Include/frameobject.h 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

2 
 Python2.6.4/Include/frameobject.h 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

3 
+++ Python2.6.4/Include/frameobject.h 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

4 
@@ 41,6 +41,7 @@ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

5 
/* As of 2.3 f_lineno is only valid when tracing is active (i.e. when 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

6 
f_trace is set)  at other times use PyCode_Addr2Line instead. */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

7 
int f_lineno; /* Current line number */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

8 
+ int f_calllineno; /* line number of call site */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

9 
int f_iblock; /* index in f_blockstack */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

10 
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

11 
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

12 
diff git Python2.6.4/Makefile.pre.in Python2.6.4/Makefile.pre.in 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

13 
 Python2.6.4/Makefile.pre.in 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

14 
+++ Python2.6.4/Makefile.pre.in 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

15 
@@ 201,6 +201,7 @@ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

16 
GRAMMAR_C= $(srcdir)/Python/graminit.c 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

17 
GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

18 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

19 
+DTRACE_OBJS=Python/dtrace.o Python/phelper.o 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

20 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

21 
########################################################################## 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

22 
# Parser 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

23 
@@ 290,6 +291,7 @@ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

24 
Python/formatter_unicode.o \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

25 
Python/formatter_string.o \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

26 
Python/$(DYNLOADFILE) \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

27 
+ $(DTRACE_OBJS) \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

28 
$(LIBOBJS) \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

29 
$(MACHDEP_OBJS) \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

30 
$(THREADOBJ) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

31 
@@ 577,6 +579,18 @@ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

32 
Python/formatter_string.o: $(srcdir)/Python/formatter_string.c \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

33 
$(STRINGLIB_HEADERS) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

34 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

35 
+Python/phelper.o: $(srcdir)/Python/phelper.d 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

36 
+ dtrace o [email protected] DPHELPER $(DFLAGS) $(CPPFLAGS) C G s $(srcdir)/Python/phelper.d 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

37 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

38 
+Python/python.h: $(srcdir)/Python/python.d 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

39 
+ dtrace o [email protected] $(DFLAGS) C h s $(srcdir)/Python/python.d 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

40 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

41 
+Python/ceval.o: Python/ceval.c Python/python.h 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

42 
+ $(CC) c $(BASECFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) DPy_BUILD_CORE o [email protected] $< 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

43 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

44 
+Python/dtrace.o: $(srcdir)/Python/python.d Python/ceval.o 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

45 
+ dtrace o [email protected] $(DFLAGS) C G s $(srcdir)/Python/python.d Python/ceval.o 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

46 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

47 
############################################################################ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

48 
# Header files 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

49 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

50 
diff git Python2.6.4/Objects/frameobject.c Python2.6.4/Objects/frameobject.c 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

51 
 Python2.6.4/Objects/frameobject.c 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

52 
+++ Python2.6.4/Objects/frameobject.c 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

53 
@@ 698,6 +698,7 @@ 
841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

54 
f>f_tstate = tstate; 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

55 

841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

56 
f>f_lasti = 1; 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

57 
+ f>f_calllineno = code>co_firstlineno; 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

58 
f>f_lineno = code>co_firstlineno; 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

59 
f>f_iblock = 0; 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

60 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

61 
diff git Python2.6.4/Python/ceval.c Python2.6.4/Python/ceval.c 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

62 
 Python2.6.4/Python/ceval.c 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

63 
+++ Python2.6.4/Python/ceval.c 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

64 
@@ 19,6 +19,11 @@ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

65 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

66 
#include <ctype.h> 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

67 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

68 
+#define HAVE_DTRACE 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

69 
+#ifdef HAVE_DTRACE 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

70 
+#include "python.h" 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

71 
+#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

72 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

73 
#ifndef WITH_TSC 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

74 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

75 
#define READ_TIMESTAMP(var) 
841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

76 
@@ 546,6 +551,55 @@ 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

77 
NULL); 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

78 
} 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

79 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

80 
+#ifdef HAVE_DTRACE 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

81 
+static void 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

82 
+dtrace_entry(PyFrameObject *f) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

83 
+{ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

84 
+ const char *filename; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

85 
+ const char *fname; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

86 
+ int lineno; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

87 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

88 
+ filename = PyString_AsString(f>f_code>co_filename); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

89 
+ fname = PyString_AsString(f>f_code>co_name); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

90 
+ lineno = PyCode_Addr2Line(f>f_code, f>f_lasti); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

91 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

92 
+ PYTHON_FUNCTION_ENTRY((char *)filename, (char *)fname, lineno); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

93 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

94 
+ /* 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

95 
+ * Currently a USDT tailcall will not receive the correct arguments. 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

96 
+ * Disable the tail call here. 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

97 
+ */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

98 
+#if defined(__sparc) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

99 
+ asm("nop"); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

100 
+#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

101 
+} 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

102 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

103 
+static void 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

104 
+dtrace_return(PyFrameObject *f) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

105 
+{ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

106 
+ const char *filename; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

107 
+ const char *fname; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

108 
+ int lineno; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

109 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

110 
+ filename = PyString_AsString(f>f_code>co_filename); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

111 
+ fname = PyString_AsString(f>f_code>co_name); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

112 
+ lineno = PyCode_Addr2Line(f>f_code, f>f_lasti); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

113 
+ PYTHON_FUNCTION_RETURN((char *)filename, (char *)fname, lineno); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

114 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

115 
+ /* 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

116 
+ * Currently a USDT tailcall will not receive the correct arguments. 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

117 
+ * Disable the tail call here. 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

118 
+ */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

119 
+#if defined(__sparc) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

120 
+ asm("nop"); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

121 
+#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

122 
+} 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

123 
+#else 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

124 
+#define PYTHON_FUNCTION_ENTRY_ENABLED 0 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

125 
+#define PYTHON_FUNCTION_RETURN_ENABLED 0 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

126 
+#define dtrace_entry() 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

127 
+#define dtrace_return() 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

128 
+#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

129 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

130 
/* Interpreter main loop */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

131 

841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

132 
@@ 557,9 +611,84 @@ 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

133 
return PyEval_EvalFrameEx(f, 0); 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

134 
} 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

135 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

136 
+/* 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

137 
+ * These shenanigans look like utter madness, but what we're actually doing is 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

138 
+ * making sure that the ustack helper will see the PyFrameObject pointer on the 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

139 
+ * stack. We have two tricky cases: 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

140 
+ * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

141 
+ * amd64 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

142 
+ * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

143 
+ * We use up the six registers for passing arguments, meaning the call can't 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

144 
+ * use a register for passing 'f', and has to push it onto the stack in a known 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

145 
+ * location. 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

146 
+ * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

147 
+ * And how does "throwflag" figure in to this? PN 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

148 
+ * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

149 
+ * SPARC 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

150 
+ * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

151 
+ * Here the problem is that (on 32bit) the compiler is reusing %i0 before 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

152 
+ * some calls inside PyEval_EvalFrameReal(), which means that when it's saved, 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

153 
+ * it's just some junk value rather than the real first argument. So, instead, 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

154 
+ * we trace our proxy PyEval_EvalFrame(), where we 'know' the compiler won't 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

155 
+ * decide to reuse %i0. We also need to defeat optimization of our proxy. 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

156 
+ */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

157 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

158 
+#if defined(HAVE_DTRACE) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

159 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

160 
+#if defined(__amd64) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

161 
+PyObject *PyEval_EvalFrameExReal(long, long, long, long, long, long, 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

162 
+ PyFrameObject *, int throwflag); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

163 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

164 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

165 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

166 
PyObject * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

167 
PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

168 
{ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

169 
+ volatile PyObject *f2; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

170 
+ f2 = PyEval_EvalFrameExReal(0, 0, 0, 0, 0, 0, f, throwflag); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

171 
+ return (PyObject *)f2; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

172 
+} 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

173 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

174 
+PyObject * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

175 
+PyEval_EvalFrameExReal(long a1, long a2, long a3, long a4, long a5, long a6, 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

176 
+ PyFrameObject *f, int throwflag) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

177 
+{ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

178 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

179 
+#elif defined(__sparc) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

180 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

181 
+PyObject *PyEval_EvalFrameExReal(PyFrameObject *f, int throwflag); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

182 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

183 
+volatile int dummy; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

184 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

185 
+PyObject * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

186 
+PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

187 
+{ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

188 
+ volatile PyObject *f2; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

189 
+ f2 = PyEval_EvalFrameExReal(f, throwflag); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

190 
+ dummy = f>ob_refcnt; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

191 
+ return (PyObject *)f2; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

192 
+} 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

193 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

194 
+PyObject * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

195 
+PyEval_EvalFrameExReal(PyFrameObject *f, int throwflag) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

196 
+{ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

197 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

198 
+#else /* __amd64  __sparc */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

199 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

200 
+PyObject * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

201 
+PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

202 
+{ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

203 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

204 
+#endif /* __amd64  __sparc */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

205 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

206 
+#else /* don't HAVE_DTRACE */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

207 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

208 
+PyObject * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

209 
+PyEval_EvalFrameexEx(PyFrameObject *f, int throwflag)) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

210 
+{ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

211 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

212 
+#endif /* HAVE_DTRACE */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

213 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

214 
#ifdef DXPAIRS 
841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

215 
int lastopcode = 0; 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

216 
#endif 
841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

217 
@@ 782,6 +911,9 @@ 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

218 
} 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

219 
} 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

220 

841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

221 
+ if (PYTHON_FUNCTION_ENTRY_ENABLED()) 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

222 
+ dtrace_entry(f); 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

223 
+ 
841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

224 
co = f>f_code; 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

225 
names = co>co_names; 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

226 
consts = co>co_consts; 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

227 
@@ 2406,6 +2538,10 @@ 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

228 
PyObject **sp; 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

229 
PCALL(PCALL_ALL); 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

230 
sp = stack_pointer; 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

231 
+#ifdef HAVE_DTRACE 
841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

232 
+ f>f_calllineno = PyCode_Addr2Line(f>f_code, 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

233 
+ f>f_lasti); 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

234 
+#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

235 
#ifdef WITH_TSC 
841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

236 
x = call_function(&sp, oparg, &intr0, &intr1); 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

237 
#else 
841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

238 
@@ 2448,6 +2584,10 @@ 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

239 
} else 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

240 
Py_INCREF(func); 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

241 
sp = stack_pointer; 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

242 
+#ifdef HAVE_DTRACE 
841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

243 
+ f>f_calllineno = PyCode_Addr2Line(f>f_code, 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

244 
+ f>f_lasti); 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

245 
+#endif 
841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

246 
READ_TIMESTAMP(intr0); 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

247 
x = ext_do_call(func, &sp, flags, na, nk); 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

248 
READ_TIMESTAMP(intr1); 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

249 
@@ 2746,6 +2886,8 @@ 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

250 

841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

251 
/* pop frame */ 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

252 
exit_eval_frame: 
841
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

253 
+ if (PYTHON_FUNCTION_RETURN_ENABLED()) 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

254 
+ dtrace_return(f); 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

255 
Py_LeaveRecursiveCall(); 
1a62cefa636d
7121707 python 2.6.4 should be updated to latest 2.6.X release
Rich Burridge <rich.burridge@oracle.com>
parents:
115
diff
changeset

256 
tstate>frame = f>f_back; 
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

257 

c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

258 
diff git Python2.6.4/Python/phelper.d Python2.6.4/Python/phelper.d 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

259 
new file mode 100644 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

260 
 /dev/null 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

261 
+++ Python2.6.4/Python/phelper.d 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

262 
@@ 0,0 +1,139 @@ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

263 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

264 
+/* 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

265 
+ * Python ustack helper. This relies on the first argument (PyFrame *) being 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
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 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

267 
+ * this is the case. 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

268 
+ * 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
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 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

270 
+ * eight. 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

271 
+ */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

272 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

273 
+/* 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

274 
+ * Yes, this is as gross as it looks. DTrace cannot handle static functions, 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

275 
+ * and our stat_impl.h has them in ILP32. 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

276 
+ */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

277 
+#define _SYS_STAT_H 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

278 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

279 
+#include <stdio.h> 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

280 
+#include <sys/types.h> 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

281 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

282 
+#include "pyport.h" 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

283 
+#include "object.h" 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

284 
+#include "pystate.h" 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

285 
+#include "pyarena.h" 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

286 
+#include "pythonrun.h" 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

287 
+#include "compile.h" 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

288 
+#include "frameobject.h" 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

289 
+#include "stringobject.h" 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

290 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

291 
+#if defined(__i386) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

292 
+#define startframe PyEval_EvalFrameEx 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

293 
+#define endframe PyEval_EvalCodeEx 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

294 
+#elif defined(__amd64) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

295 
+#define PyEval_EvalFrameEx PyEval_EvalFrameExReal 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

296 
+#define startframe PyEval_EvalFrameExReal 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

297 
+#define endframe PyEval_EvalCodeEx 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

298 
+#elif defined(__sparc) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

299 
+#define PyEval_EvalFrameEx PyEval_EvalFrameExReal 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

300 
+#define startframe PyEval_EvalFrameEx 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

301 
+#define endframe PyEval_EvalFrameExReal 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

302 
+#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

303 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

304 
+#ifdef __sparcv9 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

305 
+#define STACK_BIAS (20481) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

306 
+#else 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

307 
+#define STACK_BIAS 0 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

308 
+#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

309 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

310 
+/* 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

311 
+ * Not defining PHELPER lets us test this code as a normal D script. 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

312 
+ */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

313 
+#ifdef PHELPER 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

314 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

315 
+#define at_evalframe(addr) \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

316 
+ ((uintptr_t)addr >= ((uintptr_t)&``startframe) && \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

317 
+ (uintptr_t)addr < ((uintptr_t)&``endframe)) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

318 
+#define probe dtrace:helper:ustack: 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

319 
+#define print_result(r) (r) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

320 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

321 
+#if defined(__i386)  defined(__amd64) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

322 
+#define frame_ptr_addr ((uintptr_t)arg1 + sizeof(uintptr_t) * 2) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

323 
+#elif defined(__sparc) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

324 
+#define frame_ptr_addr ((uintptr_t)arg1 + STACK_BIAS + sizeof(uintptr_t) * 8) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

325 
+#else 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

326 
+#error unknown architecture 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

327 
+#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

328 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

329 
+#else /* PHELPER */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

330 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

331 
+#define at_evalframe(addr) (1) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

332 
+#define probe pid$target::PyEval_EvalFrame:entry 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

333 
+#define print_result(r) (trace(r)) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

334 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

335 
+#if defined(__i386)  defined(__amd64) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

336 
+#define frame_ptr_addr ((uintptr_t)uregs[R_SP] + sizeof(uintptr_t)) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

337 
+#elif defined(__sparc) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

338 
+/* 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

339 
+ * Not implemented: we could just use R_I0, but what's the point? 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

340 
+ */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

341 
+#else 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

342 
+#error unknown architecture 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

343 
+#endif 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

344 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

345 
+#endif /* PHELPER */ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

346 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

347 
+extern uintptr_t PyEval_EvalFrameEx; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

348 
+extern uintptr_t PyEval_EvalCodeEx; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

349 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

350 
+#define copyin_obj(addr, obj) ((obj *)copyin((uintptr_t)addr, sizeof(obj))) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

351 
+#define pystr_addr(addr) ((char *)addr + offsetof(PyStringObject, ob_sval)) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

352 
+#define copyin_str(dest, addr, obj) \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

353 
+ (copyinto((uintptr_t)pystr_addr(addr), obj>ob_size, (dest))) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

354 
+#define add_str(addr, obj) \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

355 
+ copyin_str(this>result + this>pos, addr, obj); \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

356 
+ this>pos += obj>ob_size; \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

357 
+ this>result[this>pos] = '\0'; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

358 
+#define add_digit(nr, div) ((nr / div) ? \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

359 
+ (this>result[this>pos++] = '0' + ((nr / div) % 10)) : \ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

360 
+ (this>result[this>pos] = '\0')) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

361 
+#define add_char(c) (this>result[this>pos++] = c) 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

362 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

363 
+probe /at_evalframe(arg0)/ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

364 
+{ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

365 
+ this>framep = *(uintptr_t *)copyin(frame_ptr_addr, sizeof(uintptr_t)); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

366 
+ this>frameo = copyin_obj(this>framep, PyFrameObject); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

367 
+ this>codep = this>frameo>f_code; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

368 
+ this>lineno = this>frameo>f_calllineno; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

369 
+ this>codeo = copyin_obj(this>codep, PyCodeObject); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

370 
+ this>filenamep = this>codeo>co_filename; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

371 
+ this>fnamep = this>codeo>co_name; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

372 
+ this>filenameo = copyin_obj(this>filenamep, PyStringObject); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

373 
+ this>fnameo = copyin_obj(this>fnamep, PyStringObject); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

374 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

375 
+ this>len = 1 + this>filenameo>ob_size + 1 + 5 + 2 + 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

376 
+ this>fnameo>ob_size + 1 + 1; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

377 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

378 
+ this>result = (char *)alloca(this>len); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

379 
+ this>pos = 0; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

380 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

381 
+ add_char('@'); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

382 
+ add_str(this>filenamep, this>filenameo); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

383 
+ add_char(':'); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

384 
+ add_digit(this>lineno, 10000); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

385 
+ add_digit(this>lineno, 1000); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

386 
+ add_digit(this>lineno, 100); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

387 
+ add_digit(this>lineno, 10); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

388 
+ add_digit(this>lineno, 1); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

389 
+ add_char(' '); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

390 
+ add_char('('); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

391 
+ add_str(this>fnamep, this>fnameo); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

392 
+ add_char(')'); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

393 
+ this>result[this>pos] = '\0'; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

394 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

395 
+ print_result(stringof(this>result)); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

396 
+} 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

397 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

398 
+probe /!at_evalframe(arg0)/ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

399 
+{ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

400 
+ NULL; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

401 
+} 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

402 
diff git Python2.6.4/Python/python.d Python2.6.4/Python/python.d 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

403 
new file mode 100644 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

404 
 /dev/null 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

405 
+++ Python2.6.4/Python/python.d 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

406 
@@ 0,0 +1,10 @@ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

407 
+provider python { 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

408 
+ probe function__entry(const char *, const char *, int); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

409 
+ probe function__return(const char *, const char *, int); 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

410 
+}; 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

411 
+ 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

412 
+#pragma D attributes Evolving/Evolving/Common provider python provider 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

413 
+#pragma D attributes Private/Private/Common provider python module 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

414 
+#pragma D attributes Private/Private/Common provider python function 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

415 
+#pragma D attributes Evolving/Evolving/Common provider python name 
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset

416 
+#pragma D attributes Evolving/Evolving/Common provider python args 