首页 文章

当我使用LLDB调试tensorflow时,不会触发LLDB断点“TF_NewSession”

提问于
浏览
0

我想学习使用lldb debuging的tensorflow的C源代码如下 .

在一个终端:

>>>import tensorflow as tf
>>>import os
>>>os.getpid()
42677

在另一个终端:

$lldb -p 42677
Process 42677 stopped
* thread #1: tid = 0x9f6c6e, 0x00007fff8fe37f4e libsystem_kernel.dylib`__select + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x00007fff8fe37f4e libsystem_kernel.dylib`__select + 10
libsystem_kernel.dylib`__select:
->  0x7fff8fe37f4e <+10>: jae    0x7fff8fe37f58            ; <+20>
    0x7fff8fe37f50 <+12>: movq   %rax, %rdi
    0x7fff8fe37f53 <+15>: jmp    0x7fff8fe30d94            ; cerror
    0x7fff8fe37f58 <+20>: retq

Executable module set to "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python".
Architecture set to: x86_64h-apple-macosx.
(lldb) breakpoint set --name TF_NewSession
Breakpoint 1: where = _pywrap_tensorflow.so`::TF_NewSession(TF_Graph *, const TF_SessionOptions *, TF_Status *) + 31 at c_api.cc:1701, address = 0x000000010ae44ddf
(lldb) continue
Process 42677 resuming

回到第一个终端:

>>>sess = tf.Session()

这应该按预期触发lldb断点“TF_NewSession” . 然而无论我尝试多少次都没有触发它 . 我的TensorFlow版本是官方1.0.1 . 有谁可以帮我解决这个问题?非常感谢!

1 回答

  • 0

    对此有一个简单的解释:当前(TensorFlow 1.0.1及更早版本)Python API从不调用 TF_NewSession() . 相反它calls函数TF_NewDeprecatedSession()(通过SWIG wrapper) . 您应该在 TF_NewDeprecatedSession() 上设置断点 .

    为什么名称中的单词"deprecated"?有一个ancient Google proverb ....

相关问题