Pybind11 is a wonderful library to build native c++ functions callable within Python. Let's see how we can debug a module built with Pybind11.
For this project, we will use the very simple Pybind11 example module. Let's get started.
Clone the repository
$ git clone https://github.com/pybind/python_example.git
$ cd python_example
Install the package
$ python setup.py install
Run gdb on Python
$ gdb -q python
Break into the desired function, such as
(gdb) b add
(gdb) b src/main.cpp:4
Run the command
(gdb) r tests/test.py
That is it!
Valuable post useful for everyone. Keep on sharing.
ReplyDeletePython Online Training in Hyderabad
Python Institute in Hyderabad
Python Course in Hyderabad