How to use pdb or gdb debug from python into C/C++ code?

Thanks a lot!

I have tried to compile python from source. However, the problem remains.

Is it because I still didn’t compile python successfully to work with gdb? Here is the make test result

----------------------------------------------------------------------
Ran 73 tests in 1.854s

FAILED (failures=5)
test test_urllib2 failed
3 tests failed again:
    test_gdb test_urllib2 test_venv

Total duration: 13 min 22 sec
Tests result: FAILURE
make: *** [test] Error 1
Focus on one: /Users/Natsume/Downloads/Python-3.6.2/debug

I tried to compile it twice, but the same result like above.
What else should I try? thanks!