Bug 1613614 - py-bt is broken, results in exception
Summary: py-bt is broken, results in exception
Keywords:
Status: CLOSED DUPLICATE of bug 1639242
Alias: None
Product: Fedora
Classification: Fedora
Component: python3
Version: 28
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Charalampos Stratakis
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1639242 1660220
TreeView+ depends on / blocked
 
Reported: 2018-08-08 02:10 UTC by Ellie
Modified: 2018-12-17 20:55 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1639242 (view as bug list)
Environment:
Last Closed: 2018-12-04 16:21:21 UTC


Attachments (Terms of Use)

Description Ellie 2018-08-08 02:10:22 UTC
Description of problem:
py-bt is broken, results in exception:

(gdb) py-bt
Traceback (most recent call first):
  (frame information optimized out)
Python Exception <class 'TypeError'> 'FakeRepr' object is not subscriptable: 
Error occurred in Python command: 'FakeRepr' object is not subscriptable

It worked fine in a recent version before that.

Version-Release number of selected component (if applicable):
python3: python3-3.6.6-1.fc28.src.rpm
gdb: 8.1-25.fc28

How reproducible:
100%

Steps to Reproduce:
1. Open gdb
2. Attach to python3 process
3. Type py-bt

Actual results:
doesn't work, gives error Python Exception <class 'TypeError'> 'FakeRepr' object is not subscriptable

Expected results:
works

Additional info:

Comment 1 Victor Stinner 2018-10-15 10:59:57 UTC
I reproduced the issue:

$ sudo dnf debuginfo-install python3

$ cat x.py
import time
def dodo():
    print("dodo")
    time.sleep(3600)
dodo()

vstinner@apu$ gdb -args python3 x.py
GNU gdb (GDB) Fedora 8.1.1-3.fc28
(...)
Reading symbols from python3...Reading symbols from /usr/lib/debug/usr/bin/python3.6-3.6.6-1.fc28.x86_64.debug...done.
done.
Dwarf Error: could not find partial DIE containing offset 0x316 [in module /usr/lib/debug/usr/bin/python3.6-3.6.6-1.fc28.x86_64.debug]

(gdb) run
Starting program: /usr/bin/python3 x.py
(...)
dodo

^C
Program received signal SIGINT, Interrupt.
0x00007ffff6bf2787 in select () from /lib64/libc.so.6

(gdb) py-bt
Traceback (most recent call first):
  <unknown at remote 0x7ffff7e5f7e0>
Python Exception <class 'TypeError'> 'FakeRepr' object is not subscriptable: 
Error occurred in Python command: 'FakeRepr' object is not subscriptable


The root issue comes from gdb:
"Dwarf Error: could not find partial DIE containing offset 0x316 [in module /usr/lib/debug/usr/bin/python3.6-3.6.6-1.fc28.x86_64.debug]"

I debugged /usr/lib/debug/usr/lib64/libpython3.6m.so.1.0-3.6.6-1.fc28.x86_64.debug-gdb.py : the FakeRepr error indirectly comes from the fact that gdb fails to read debug symbols (the Dwarf Error).


On the Python side, python-gdb.py should be enhanced to better handle such error (exception while computing the line number), but the root issue is in gdb which fails to read debug symbols.

Comment 2 Victor Stinner 2018-10-15 11:27:00 UTC
> On the Python side, python-gdb.py should be enhanced to better handle such error (exception while computing the line number)

I created https://bugs.python.org/issue34989 and proposed a fix for that.

Comment 3 Victor Stinner 2018-10-15 11:31:25 UTC
> the root issue is in gdb which fails to read debug symbols

I created bug #1639242 to track the gdb issue.

Comment 4 Cédric Bellegarde 2018-11-23 21:57:56 UTC
Looks issue if fixed on python side, any chance to get the fix in Fedora 29?

Comment 5 Petr Viktorin 2018-11-26 09:11:06 UTC
The Python change is just to get a better error message.
The issue needs to be fixed in gdb.

Comment 6 Victor Stinner 2018-12-04 16:21:21 UTC
gdb has been fixed in Fedora 28 and 29 and I confirm that it fixed the py-bt command:
https://bugzilla.redhat.com/show_bug.cgi?id=1639242#c10

*** This bug has been marked as a duplicate of bug 1639242 ***


Note You need to log in before you can comment on or make changes to this bug.