Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TensorFlow core debug; missing debug symbols

I'm trying to learn TensorFlow's internals by stepping from its CIFAR-10 model training's python code into its core C++ code. Using Eclipse+PyDev for step by step debugging of the python code works great, but I can't find how to step into the C++ code of the TensorFlow core. I tried using Eclipse CDT to build the C++ code in a separate project, and attach the debugger to the python process running cifar10_train.py as described here, but the symbols are never loaded and (obviously) deferred breakpoints are never hit.

Background and setup:

I'm running on Ubuntu 14.04 LTS, installed the TensorFlow code from sources as described here and my CDT project uses a Makefile containing

bazel build -c dbg //tensorflow/cc:tutorials_example_trainer.

like image 651
user5568317 Avatar asked Nov 16 '15 22:11

user5568317


1 Answers

TensorFlow loads a library called _pywrap_tensorflow.so that includes its C API (as defined in tensorflow/tensorflow/core/client/tensor_c_api.cc ).

In my case the library loaded during runtime was located in
~/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so
but the library that was built from the local source code was located in ~/.cache/bazel/_bazel_<username>/dbb3c677efbf9967e464a5c6a1e69337/tensorflow/bazel-out/local_linux-dbg/bin/tensorflow/python/_pywrap_tensorflow.so.

Copying the locally built library over the loaded library, and attaching to the python process as defined in the question solved the problem.

like image 53
user5568317 Avatar answered Sep 25 '22 01:09

user5568317