Отладка исходного кода Python с помощью GDB для модуля C

0

Поэтому я получаю сигнал SIGSEGV от моего модуля Python C. Модуль был протестирован/построен в Windows, и теперь я пытаюсь использовать его под Linux (Linux Mint 17 64-bit). Я очень новичок в 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.

трассировка стека (Filtered):

(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

1 ответ

1
Лучший ответ

Если вы хотите, чтобы gdb показывал вам код в файле, вам нужно указать, где искать файл.

Вы можете сделать это, используя команду каталога, за которой следует путь к исходным файлам.

Больше информации здесь

  • 0
    Спасибо. Мне пришлось скачать исходный tar-код python и сделать directory /path/to/python/source . Не похоже, что какие-либо пакеты предоставляют источник из быстрого поиска, который я сделал. Есть ли способ заставить это сохраняться в новых сеансах GDB?

Ещё вопросы

Сообщество Overcoder
Наверх
Меню