What is the best approach to debug in TensorFlow when working with the C++ code base?

In the past, I’ve had issues debugging in TensorFlow where the problem was somewhere in the C++ code base and I was using gdb, these included debug builds being too large (using -O0) and running out of space, recompile time etc. Does anyone have recommendations to handle debugging in TensorFlow?


I think that some of these problems are well known. For a recent experience you can follow this:

In the end there is a draft proposal so If you have something technical to share about your experience please leave a comment in the ticket.


Thanks, that does contain some useful info.


I found that the best way to debug is printf-debugging without checking again from the head of the repository (because that would result in longer compile times again).

If possible, building with ASAN also helps. The OSSFuzz docker container allows that.