![]() ![]() Now use the drop-down to choose “(gdb) Attach”, then click the green play button. Go back to VS Code, and focus on the file myadd.cpp. Open a new terminal, run ps aux | grep python, and look for the process that has the token. While the debugger is paused, we will need to start the second debugger and attach it to the Python debugger process.įirst we identify the Python process. ![]() The debugger will work through myscript.py and stop at the first breakpoint. While focused on myscript.py, click the debugger icon, then click on the little green right-arrow icon next to “Python: Current file”. Static PyObject * method_myadd ( PyObject * self, PyObject * args ) Step 5: Run two debuggers at onceĪdd a debug breakpoint in the Python script before it drops into myadd(), and add another one in myadd.cpp at the line z = x+y.įirst, we’ll start the Python debugger. I’ll be working from within the virtual environment from here on. Īctivating the environment changes the prompt as a reminder $. Running virtualenv with interpreter /usr/bin/python3.6. Make virtual environment $ virtualenv -python =python3.6 myadd #VISUAL STUDIO CODE C++ EXTENSION HOW TO#How to pause the debugger and switch from python to C++ (with screenshots). Configure the debugger so it can both run on python launch and attach to C++. Important to point the interpreter to virtual environment. My toy example is a C++ extension that just adds two numbers together. Chances are that, if you’re doing this kind of thing, you’ll be wanting to use a virtual environment too. I’m going to do the example from scratch in five steps: In this blog post, I give an example of how to get Visual Studio Code has the ability to debug mixed Python with C++Įxtensions. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |