Debugging MXNet GDB with Python


#1

Compiled the code using

make -j $(nproc) USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda-9.0 USE_CUDNN=1 DEBUG=1

Updated python dependency
cd python
pip install -e .

Trying to debug specific part of function in C header file
Hence, ran
gdb python
(gdb) start tests/python/unittest/test_random.py
(gdb) b src/operator/random/sampler.h:100
No source file named src/operator/random/sampler.h.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (src/operator/random/sampler.h:100) pending.

Then, I continue, hoping that it would hit the breakpoint, it just doesn’t.
(gdb) c

Code executes and terminates (without halting at the breakpoint)

Where am I going wrong?


#2

@kellen @lebeg I remember you mentioned something about debugging not being possible in MXNet and possible work-around, can you shed some lights here? Thanks!


#3

@larroy might have some ideas


#4

Please compile with CMake and use -DCMAKE_BUILD_TYPE=Debug

The rest of what you are doing is correct. It will hit a breakpoint with gdb.

You can also try cgdb.