当我使用 LLDB 调试 tensorflow 时,未触发 LLDB 断点 "TF_NewSession"

LLDB breakpoint "TF_NewSession" is not triggered when I debug tensorflow using LLDB

我想学习使用lldb调试的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" 因为 expected.However 无论我尝试了多少次,它都没有被触发。我的TensorFlow版本是官方的1.0.1。 谁能帮我解决这个问题?非常感谢!

对此有一个简单的解释:目前(TensorFlow 1.0.1 及更早版本)Python API 从不调用 TF_NewSession()。取而代之的是 calls the function TF_NewDeprecatedSession() (via a SWIG wrapper)。您应该在 TF_NewDeprecatedSession() 上设置断点。

为什么名字里有"deprecated"这个词?有一个ancient Google proverb.....