1

I was trying to figure out the exact control flow and function call to better guide me while writing in cpython for a fairly large and complicated codebase. It feels like this should be easily doable using pdb() but I can't seem to figure it out. Using bp.set_trace() only reveals the Python file called during the execution. Is this the write way of going about it? Since a fair bit of codegen and dynamic dispatch of function calls is used I can't precisely find the C++ method definitions of the functions called from the Python code.

It seems like this should be straightforward but most SO threads don't focus precisely on this, just the code flow sequence

I was wondering if pdb.pm() would give me what I need but it doesn't exactly work unless an exception has occurred.

fibonachoceres
  • 727
  • 4
  • 14
  • Can't you use gdb normally? – user7860670 Oct 01 '19 at 10:17
  • see https://docs.python.org/2/library/traceback.html did that help ? – darune Oct 01 '19 at 10:30
  • I never tried this, but I think you may find what you want in this [thread](https://stackoverflow.com/questions/2615153/profiling-python-c-extensions). Google made wrapped pprof version for Python and it will generate a Callgrind profile that might help. You can use it with [Yep](https://pypi.org/project/yep/). – Astarixi Oct 01 '19 at 10:36

0 Answers0