简体   繁体   中英

Cannot debug tensorflow using gdb on macOS

I am trying to debug TensorFlow using GDB on macOS Sierra. I followed the instructions on the post .After I installed developer version of tensorflow for debug I tried to use gdb to attach a python session.

When I run 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)

When I set the breakpoint:

(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.

Then even I run sess = tf.Session() as the post says. GDB will never enter into breakpoint.

Well, after I change to use lldb on macOS, everything works fine. So I guess the solution to this problem is "USING LLDB INSTEAD OF GDB".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM