DALI笔记Python调用C++扩展库联合调试的学习笔记

Posted songyuc

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DALI笔记Python调用C++扩展库联合调试的学习笔记相关的知识,希望对你有一定的参考价值。

我们目前计划了三种调试方式:

  • VisualStudio: VisualStudio可以支持WSL2系统;
  • VSCode联合调试:使用插件 Python C++ Debugger
  • TotalView:TotalView支持Python&C++联合调试;

关于VSCode使用GDB进行联合调试的方法,请参考知乎文章《编译、调试PyTorch源码》

1. VisualStudio联合调试

2. VSCode联合调试

关于在VSCode中调试python-C++代码,请参考《vscode python/C++ Debug 调试 Pytorch源码》
Python C++ Debugger主要支持对调用C++共享链接库的python代码的调试;

Demo of launch.json on Ubuntu


  "version": "0.2.0",
  "configurations": [
    
      "name": "Python C++ Debug",
      "type": "pythoncpp",
      "request": "launch",
      "pythonLaunchName": "Python: Current File",
      "cppAttachName": "(gdb) Attach",
    ,
    
      "name": "(gdb) Attach",
      "type": "cppdbg",
      "request": "attach",
      "processId": ""
    ,
    
      "name": "Python: Current File",
      "type": "python",
      "request": "launch",
      "program": "$file",
      "console": "integratedTerminal"
    
  ]

以上是关于DALI笔记Python调用C++扩展库联合调试的学习笔记的主要内容,如果未能解决你的问题,请参考以下文章