繁体   English   中英

使用gdb针对C模块进行Python源调试

[英]Python source debugging with gdb for a C Module

因此,我从Python C模块收到了SIGSEGV信号。 该模块已在Windows中测试/构建,现在我正尝试在Linux(Linux Mint 17 64位)下使用它。 我对gdb还是很陌生,但是有办法让它显示Python的源代码吗?

Program received signal SIGSEGV, Segmentation fault.
PyErr_SetObject (exception=0xae3818, value=0x7ffff7e229f0) at ../Python/errors.c:70
70      ../Python/errors.c: No such file or directory.

堆栈跟踪(已过滤):

(gdb) bt
#0  PyErr_SetObject (exception=0xae3818, value=0x7ffff7e229f0) at ../Python/errors.c:70
#1  0x000000000043675f in PyErr_SetString (exception=0xae3818, string=<optimized out>) at ../Python/errors.c:147
...

已安装软件包的列表:

> dpkg-query -l |grep python3
ii  libpython3-dbg:amd64                        3.4.0-0ubuntu2                                     amd64        debug build of the Python 3 Interpreter (version 3.4)
ii  libpython3-dev:amd64                        3.4.0-0ubuntu2                                     amd64        header files and a static library for Python (default)
ii  libpython3-stdlib:amd64                     3.4.0-0ubuntu2                                     amd64        interactive high-level object-oriented language (default python3 version)
ii  libpython3.4:amd64                          3.4.0-2ubuntu1                                     amd64        Shared Python runtime library (version 3.4)
ii  libpython3.4-dbg:amd64                      3.4.0-2ubuntu1                                     amd64        Debug Build of the Python Interpreter (version 3.4)
ii  libpython3.4-dev:amd64                      3.4.0-2ubuntu1                                     amd64        Header files and a static library for Python (v3.4)
ii  libpython3.4-minimal:amd64                  3.4.0-2ubuntu1                                     amd64        Minimal subset of the Python language (version 3.4)
ii  libpython3.4-stdlib:amd64                   3.4.0-2ubuntu1                                     amd64        Interactive high-level object-oriented language (standard library, version 3.4)
ii  python3                                     3.4.0-0ubuntu2                                     amd64        interactive high-level object-oriented language (default python3 version)
ii  python3-apt                                 0.9.3.5                                            amd64        Python 3 interface to libapt-pkg
ii  python3-aptdaemon                           1.1.1-1ubuntu5.1                                   all          Python 3 module for the server and client of aptdaemon
ii  python3-aptdaemon.gtk3widgets               1.1.1-1ubuntu5.1                                   all          Python 3 GTK+ 3 widgets to run an aptdaemon client
ii  python3-aptdaemon.pkcompat                  1.1.1-1ubuntu5.1                                   all          PackageKit compatibilty for AptDaemon
ii  python3-cairo                               1.10.0+dfsg-3ubuntu2                               amd64        Python 3 bindings for the Cairo vector graphics library
ii  python3-chardet                             2.0.1-1                                            all          universal encoding detector
ii  python3-commandnotfound                     0.3ubuntu12                                        all          Python 3 bindings for command-not-found.
ii  python3-dbg                                 3.4.0-0ubuntu2                                     amd64        debug build of the Python 3 Interpreter (version 3.4)
ii  python3-dbus                                1.2.0-2build2                                      amd64        simple interprocess messaging system (Python 3 interface)
ii  python3-dbus.mainloop.qt                    4.10.4+dfsg-1ubuntu1                               amd64        D-Bus Support for PyQt4 with Python 3
ii  python3-debian                              0.1.21+nmu2ubuntu2                                 all          Python 3 modules to work with Debian-related data formats
ii  python3-defer                               1.0.6-2build1                                      all          Small framework for asynchronous programming (Python 3)
ii  python3-dev                                 3.4.0-0ubuntu2                                     amd64        header files and a static library for Python (default)
ii  python3-gdbm:amd64                          3.4.0-0ubuntu1                                     amd64        GNU dbm database support for Python 3.x
ii  python3-gi                                  3.12.0-1ubuntu1                                    amd64        Python 3 bindings for gobject-introspection libraries
ii  python3-gi-cairo                            3.12.0-1ubuntu1                                    amd64        Python 3 Cairo bindings for the GObject library
ii  python3-icu                                 1.5-2ubuntu4                                       amd64        Python 3 extension wrapping the ICU C++ API
ii  python3-minimal                             3.4.0-0ubuntu2                                     amd64        minimal subset of the Python language (default python3 version)
ii  python3-pkg-resources                       3.3-1ubuntu1                                       all          Package Discovery and Resource Access using pkg_resources
ii  python3-problem-report                      2.14.1-0ubuntu3.5                                  all          Python 3 library to handle problem reports
ii  python3-pyicu                               1.5-2ubuntu4                                       amd64        dummy transitional package for PyICU Python 3 extension
ii  python3-six                                 1.5.2-1                                            all          Python 2 and 3 compatibility library (Python 3 interface)
ii  python3-xkit                                0.5.0ubuntu2                                       all          library for the manipulation of xorg.conf files (Python 3)
ii  python3.4                                   3.4.0-2ubuntu1                                     amd64        Interactive high-level object-oriented language (version 3.4)
ii  python3.4-dbg                               3.4.0-2ubuntu1                                     amd64        Debug Build of the Python Interpreter (version 3.4)
ii  python3.4-dev                               3.4.0-2ubuntu1                                     amd64        Header files and a static library for Python (v3.4)
ii  python3.4-minimal                           3.4.0-2ubuntu1                                     amd64        Minimal subset of the Python language (version 3.4)

如果希望gdb向您显示文件中的代码,则需要告诉它在哪里查找文件。

您可以使用directory命令执行此操作,后跟源文件的路径。

更多信息在这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM