我正在尝试在 macOS Sierra 上使用 GDB 调试 TensorFlow。我按照 post 上的说明进行操作.在我安装了用于调试的 tensorflow 开发者版本后,我尝试使用 gdb 附加一个 python session 。
当我运行 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永远不会进入断点。
请您参考如下方法:
好吧,在我改用 macOS 上的 lldb 之后,一切正常。所以我想这个问题的解决方案是“使用 LLDB 而不是 GDB”。
