David
David

Reputation: 762

Python source debugging with gdb for a C Module

So I'm getting a SIGSEGV signal from my Python C Module. The module has been tested/built in Windows and now I'm attempting to use it under Linux (Linux Mint 17 64-bit). I'm very new to gdb but is there a way to get it to show Python's Source code?

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.

stack trace (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
...

List of installed packages:

> 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)

Upvotes: 0

Views: 1065

Answers (1)

horns
horns

Reputation: 1933

If you want gdb to show you the code in a file, you need to tell it where to look for the file.

You can do this using the directory command followed by the path to the source files.

More info here

Upvotes: 1

Related Questions