2

I’m working with VLLM (open-source) which includes C++ extension code compiled for Python. I installed it using

CXXFLAGS="-Og -g" pip install -e .

I want to debug the C++ code from Python by attaching a debugger to the running Python process. I can step into functions, but when I try to inspect local variables, I see messages like d = value has been optimized out

Additionally, compilation is quite slow, and I want to know how to speed up rebuilds after making changes to C++ files.

My questions:

  1. How can I correctly debug the C++ code (via gdb) from Python and see all local variables?

  2. Are there flags or approaches to reduce compile time during development, without losing debugging capabilities?

Environment:

  • Python 3.11
  • Linux Ubuntu 24.04
  • VLLM from source
  • pip installation from source (pip install -e .)
  • Compiler: GCC 12.3.0 (used to build VLLM C++ extensions)

Any guidance on best practices for debugging Python extensions written in C++ and improving the development workflow would be appreciated.

1
  • If you don't want these value has been optimized out, then you have to use -O0 instead of -Og. See here. Commented Sep 17 at 21:44

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.