2012-12-11 45 views
2

我使用Issue 13405修補了Python 2.7.3,然後使用--with-dtrace配置選項編譯python。Python Dtrace已修補,但仍然運行測試腳本的「無效探針說明符」

當我運行test_dtrace腳本測試失敗與錯誤:

invalid probe specifier

,如下圖所示:

====================================================================== 
FAIL: test_function_entry_return (test_dtrace.DTraceTestsNormal) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "test_dtrace.py", line 99, in test_function_entry_return 
    self.assertEqual(actual_result, expected_result) 
AssertionError: 'dtrace: invalid probe specifier python*$target:::function-entry{ printf("Function entry %d ", timestamp);}python*$target:::function-entry,python*$target:::function-return{ printf("%d\t**%s*%s*%s*%d\\n", timestamp,  probename, copyinstr(arg0),  copyinstr(arg1), arg2);}python*$target:::function-return/(copyinstr(arg0)=="/Users/ramandeep/src/src/Python-2.7.3/dtrace_sample.py") &&(copyinstr(arg1)=="test_entry_return_and_stack")/{ self->trace = 0;}: probe description python*36447:::function-entry does not match any probes' != ... 

回答

0

探頭需要一些變通方法:

It's rather annoying that dtrace doesn't honor the PATH variable, and when you run the strings command on /usr/lib/libdtrace.dylib you'll see that it hardcodes the use of gcc (not even cpp or clang).

Did you run autoconf or autoreconf after applying the patch? If not, @[email protected] would not be a substitutable string. It's fairly common (at least in the Python community) to omit modified configure scripts from these sorts of patches because the changes to generated configure scripts between different versions of autoconf are so massive that they dwarf the actual functional changes in the patch, often by a couple orders of magnitude.

Adding this stanza to the top of phelper.d gets past the issues in the headers:

 
#ifdef __APPLE__ 
#define _SYS_TIME_H_ 
#define _SYS_SELECT_H_ 
#define __MATH_H__ 
#define _OS__OSBYTEORDER_H 
#define _FD_SET 
#define __GNUC_VA_LIST 
#endif /* __APPLE__ */ 

還有一個項目,以一個dd python bindingslibusdtopendtrace這可能有幫助。

參考