ImportError: No module named backtrace in file /usr/share/glib-2.0/gdb/gobject.py

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 7.0
    • glib2-2.36.3-5.el7
    • glib2-devel-2.36.3-5.el7

Issue

  • When using gdb or gcore python backtrace is displayed regarding gdb.backtrace in /usr/share/glib-2.0/gdb/gobject.py.

    [root@host]# gcore <PID>
    <snip>
    Using host libthread_db library "/lib64/libthread_db.so.1".
    Traceback (most recent call last):
      File "/usr/share/gdb/auto-load/usr/lib64/libgobject-2.0.so.0.3600.3-gdb.py", line 9, in <module>
        from gobject import register
      File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in <module>
        import gdb.backtrace
    ImportError: No module named backtrace
    Traceback (most recent call last):
      File "/usr/share/gdb/auto-load/usr/lib64/libgobject-2.0.so.0.3600.3-gdb.py", line 9, in <module>
        from gobject import register
      File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in <module>
        import gdb.backtrace
    ImportError: No module named backtrace
    
  • When using gdb or gcore may see following warning message

    gobject.pyc: gdb was not built with custom backtrace support, disabling.
    

Resolution

  • Despite the python bactrace about the missing gdb.backtrace module a core file is still produced.
  • Update to glib2-2.40.0-4.el7 & glib2-devel-2.40.0-4.el7 (or later) to addressed the Traceback and No module named backtrace messages.
    • Note: The following warning message will still be present: gobject.pyc: gdb was not built with custom backtrace support, disabling. Red Hat is still discussing the removal if this message in BZ 1055733

Root Cause

  • The backtrace.py is not an official module of upstream gdb; however, a python backtrace is being still being printed when it is not present on the system.

Diagnostic Steps

Upstream has dealt with this issue two different ways, with the second method being more elegantly done.

  1. gnome.org BZ 613732 via commit 91d4659bbf8cf88d8be905c7e0abbedce931b688

  2. gnome.org BZ 623552 via commit 20cda557e5766cc34af8efb3a6eb4cfcea149ea7

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments