Just run calibre via "calibre-debug -g" to get debug output.
Alternatively, run "calibre-debug" to get an interactive python console that can access calibre's code. You cannot simply add the calibre source code, you need it to be properly installed

which is difficult as it is a binary install. That is why calibre includes its own python console.
On linux, you can do a source install (for instance the repo packages) -- that would allow you to run bog-standard python debugging tools which can call on all of calibre's code.