我正在从python ad开发C扩展我获得了一些段错误(在开发过程中不可避免......).
我正在寻找一种方法来显示段错误发生在哪一行代码(一个想法就像跟踪每一行代码),我该怎么做?
我正在运行ubuntu,并安装了python-dbg软件包.当尝试直接使用已安装的版本时,一切都很好:
$ gdb python2.7-dbg
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
---x snipped x---
Reading symbols from /usr/bin/python2.7-dbg...done.
(gdb) r
Starting program: /usr/bin/python2.7-dbg
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Python 2.7.3 (default, Feb 27 2014, 19:39:25)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Program received signal SIGINT, Interrupt.
0x00007ffff6997743 in __select_nocancel () at ../sysdeps/unix/syscall-template.S:82
82 ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) py-bt (<--- works, just has nothing to do)
(gdb) …Run Code Online (Sandbox Code Playgroud) 我使用安装在 pyenv 中的 python3.6.1。我在我的代码上运行 gdb 时遇到问题。当我运行gdb --args python mycode.py它以错误结束"/home/vydra/.pyenv/shims/python": not in executable format: File format not recognized