【问题标题】:Python Dtrace patched, but still getting "invalid probe specifier" running test scriptsPython Dtrace 已修补,但运行测试脚本时仍出现“无效的探针说明符”
【发布时间】:2023-04-06 19:47:01
【问题描述】:

我用Issue 13405 修补了Python 2.7.3,然后用--with-dtrace 配置选项编译了python。

当我运行 test_dtrace 脚本时,测试失败并出现错误:

无效的探测说明符

如下图:

======================================================================
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' !=  ...

【问题讨论】:

    标签: python osx-mountain-lion cpython dtrace probe


    【解决方案1】:

    探测需要一些解决方法:

    dtrace 不支持 PATH 变量,这很烦人,当您在 /usr/lib/libdtrace.dylib 上运行 strings 命令时,您会看到它硬编码了 gcc 的使用(甚至不是 cpp 或 clang) .

    您在应用补丁后是否运行了 autoconf 或 autoreconf?如果不, @DTRACEOBJS@ 不会是可替换的字符串。这是相当普遍的(在 至少在 Python 社区中)从这些中省略修改过的配置脚本 各种补丁,因为生成的配置脚本之间的更改 不同版本的 autoconf 非常庞大,以至于它们使实际版本相形见绌 补丁的功能变化,通常是几个数量级。

    将此节添加到 phelper.d 的顶部可以过去 标题中的问题:

    #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__ */

    还有一个项目可以将python bindings 添加到libusdtopendtrace,这可能会有所帮助。

    参考文献

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-02
      • 2019-08-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多