[英]cannot insert breakpoint x in shared object library , (python using .so library from c++)
I'm trying to analyze c++ which is made into a .so file using pybind11.我正在尝试分析使用 pybind11 制作成 .so 文件的 c++。 The .so file has python API so the main python program uses the python API and calls functions in the .so file.
.so 文件具有 python API,因此主 python 程序使用 python API 并调用 .so 文件中的函数。 I use two debugger for python (pdb) and c++ (gdb).
我为 python (pdb) 和 c++ (gdb) 使用了两个调试器。 When I set breakpoint in the gdb, I get this error :
当我在 gdb 中设置断点时,出现此错误:
Cannot insert breakpoint 1.
Cannot access memory at address 0xb41798
when I set breakpoint in c++, there is no complaint, but when the program resumes in python, I have this error message in c++ debug window.当我在 c++ 中设置断点时,没有任何抱怨,但是当程序在 python 中恢复时,我在 c++ 调试窗口中出现此错误消息。 How can I solve this problem?
我怎么解决这个问题?
ADD : here is how I run the debuggers .添加:这是我运行调试器的方式。
for pdb : python3 -m pdb test.py
for gdb : ddd /usr/loca/.../dlib...gnu.so 10498
where 10498 was the process id of the python program对于 pdb:
python3 -m pdb test.py
对于 gdb: ddd /usr/loca/.../dlib...gnu.so 10498
其中 10498 是 python 程序的进程 ID
I made the .so file (dlib c++ to .so file containing python API) like this :我制作了 .so 文件(dlib c++ 到包含 python API 的 .so 文件),如下所示:
sudo python3 setup.py install --clean --set USE_AVX_INSTRUCTIONS=1 --set DLIB_USE_CUDA=1 --set CUDA_NVCC_FLAGS="--expt-relaxed-constexpr" --compiler-flags "-O0 -g"
the setup.cfg file has setup.cfg 文件有
[build_ext]
debug = 1
maybe a problem in the way I made the .so file in?也许我制作 .so 文件的方式有问题?
for gdb :
ddd /usr/loca/.../dlib...gnu.so 10498
对于 gdb:
ddd /usr/loca/.../dlib...gnu.so 10498
Your DDD invocation is incorrect: the process 10498
is not running your dlib...gnu.so
binary, it is running python3
binary with the .so
loaded into it.您的 DDD 调用不正确:进程
10498
没有运行您的dlib...gnu.so
二进制文件,它正在运行加载了.so
python3
二进制文件。
You need to invoke it like so: ddd python3 10498
.您需要像这样调用它:
ddd python3 10498
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.