无法在macOS上使用gdb调试tensorflow

时间:2016-10-17 16:25:37

标签: python debugging gdb tensorflow

我正在尝试在macOS Sierra上使用GDB调试TensorFlow。我按照post上的说明操作。在我安装了tensorflow的开发者版本进行调试后,我尝试使用gdb附加python会话。

当我运行gdb -p <pid>时:

GNU gdb (GDB) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin16.0.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 18822
Reading symbols from /Users/dtong/.virtualenvs/tensorflow/bin/python3.5...(no debugging symbols found)...done.

warning: unhandled dyld version (15)
0x00007fffc4d83f4e in ?? ()
(gdb)

设置断点时:

(gdb) break TF_NewSession
Function "TF_NewSession" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (TF_NewSession) pending.

然后即使我按照帖子说的那样运行sess = tf.Session()。 GDB永远不会进入断点。

1 个答案:

答案 0 :(得分:1)

好吧,在我改为在macOS上使用lldb后,一切正常。所以我想这个问题的解决方案是“使用LLDB INSTEAD OF GDB”。