to different IDE setups. If you get the key concepts, you will know how to set up different IDE for your Python C++ debugger easily.
Debugging Python Interpreter is the Key
You want to debug a .so
which is a python binding on *nix systems. Your c++ debugger (like gdb
) should track
the corresponding (c)python interpreter (instead of the .py
) as the program entry point for gdb. That is because
your c-python is written in C, a program that gdb would understand.
Items to Check and Approaches
According to this idea, several checking points would be:
- is the .so compiled with debugging symbols (for gdb or the other c++ debugger)?
- a typical approach is to launch the python and then gdb attaches to the python process. (launch-attach approach)
IDE Integration
Take visual studio code as example, the Python C++ Debugger extension is essentially the launch-attach approach, which is also described in this article.
Don't be confused by so many complicated and different launch.json
or settings.json
for vscode from different
posts and different step-by-step instructions. By grabbing the above "key concepts", it will help you to apply the
rules to different IDEs.