1

I have written a C++-library with bindings for python. My python code (a jupyer notebook) calling the library makes crashes. The problem lies within the library. I would like to debug this (using lldb, at best from within vs code). So far, I've tried to call the library from a python file test.py, issue lldb python3, place my breakpoints and run test.py. That works and stops on the breakpoints, but lldb crashes whenever I print a variable. This is not the case when running lldb directly on a C++ program that uses the library.

What's the best practice to debug the C++ code if called from python?

3
  • Show some code. Perhaps you're calling it from Python incorrectly. Commented Feb 20, 2023 at 17:01
  • It sounds like you are doing the right thing, but you've uncovered a bug in lldb. If it's something you can give reproducer steps for, please file a bug with github.com/llvm/llvm-project/issues and someone will take a look. Commented Feb 20, 2023 at 18:38
  • One thing you have to look out for when there are multiple Python versions around, is that lldb itself has to run with the Python that it was built against, not the one you've built locally - Python's C interface is not binary stable. If you use loader environment variables to point at your built Python, be sure to do so inside lldb, don't run lldb with these environment variables or it will pick up the wrong Python. Commented Feb 20, 2023 at 18:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.