Debugging Python and C++ exposed by boost together

前端 未结 2 1099
星月不相逢
星月不相逢 2020-12-14 19:08

I can debug Python code using ffffd -pydb prog.py. All the python command line arguments can be passed too after prog.py. In my case, many classes ha

2条回答
  •  一生所求
    2020-12-14 19:26

    I had a similar problem, but failed to get the solutions in Chan's answer to work (on MAC OS X 10.12.4). Instead the following worked for me.

    1. Write a python script test.py that imports and uses the boost.Python module.
    2. start python in the debugger

      lldb python3 test.py
      

      giving

      > lldb python3 test.py
      (lldb) target create "python3"
      Current executable set to 'python3' (x86_64).
      (lldb) settings set -- target.run-args  "test.py"
      (lldb) run
      Process 46189 launched: '/Users/me/anaconda/bin/python3' (x86_64)
      test.cpython-36m-darwin.so was compiled with optimization - stepping may behave oddly; variables may not be available.
      Process 46189 stopped
      * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10d4b3000)
      frame #0: 0x00000001019f49c2 test.cpython-36m-darwin.so`std::__1::enable_if::type (anonymous namespace)::Render2D::add_particle(float*, float, float, float, float) const [inlined] mylib::SSE::packed<8ul, float>::loadu(
         944        { return {_mm256_load_ps(p)}; }
         945        /// load from unaligned memory location
         946        static __always__inline packed loadu(const element_type*p) noexcept
      -> 947        { return {_mm256_loadu_ps(p)}; }
         948        /// load from aligned memory location, using template arg for alignment
         949        template
      
         950        static __always_inline enable_if_t< aligned, packed>
      

    No need to obtain the pid and start the debugger from a separate window or set any breakpoints.

提交回复
热议问题