[New-bugs-announce] [issue11996] libpython.py: nicer py-bt output

STINNER Victor report at bugs.python.org
Wed May 4 11:08:15 CEST 2011


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

py-bt is too much verbose, I'm unable to read it.

Example:
--------------------
$ gdb -args ./python -c 'import time, threading; threading.Thread(target=lambda:time.sleep(3)).start()'
...
[New Thread 0x7ffff69d9700 (LWP 17193)]
^C
Program received signal SIGINT, Interrupt.
sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
86	../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Aucun fichier ou dossier de ce type.
	in ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
(gdb) py-bt
#6 Frame 0xc52620, for file /home/haypo/prog/HG/cpython/Lib/threading.py, line 237, in wait (self=<_Condition(release=<built-in method release of _thread.lock object at remote 0xc1f1e0>, acquire=<built-in method acquire of _thread.lock object at remote 0xc1f1e0>, _lock=<_thread.lock at remote 0xc1f1e0>, _waiters=[<_thread.lock at remote 0xafb590>], _verbose=False) at remote 0xc1cbe0>, timeout=None, waiter=<_thread.lock at remote 0xafb590>, saved_state=None)
                waiter.acquire()
#10 Frame 0xbbb580, for file /home/haypo/prog/HG/cpython/Lib/threading.py, line 851, in join (self=<Thread(_target=<function at remote 0xbb5d30>, _block=<_Condition(release=<built-in method release of _thread.lock object at remote 0xc1f1e0>, acquire=<built-in method acquire of _thread.lock object at remote 0xc1f1e0>, _lock=<_thread.lock at remote 0xc1f1e0>, _waiters=[<_thread.lock at remote 0xafb590>], _verbose=False) at remote 0xc1cbe0>, _args=(), _initialized=True, _name='Thread-1', _daemonic=False, _kwargs={}, _stderr=<_io.TextIOWrapper at remote 0xac15a0>, _ident=140737330910976, _started=<_Event(_flag=True, _cond=<_Condition(release=<built-in method release of _thread.lock object at remote 0xad7e00>, acquire=<built-in method acquire of _thread.lock object at remote 0xad7e00>, _lock=<_thread.lock at remote 0xad7e00>, _waiters=[], _verbose=False) at remote 0xc1ce40>, _verbose=False) at remote 0xaec980>, _stopped=False, _verbose=False) at remote 0xc2fb70>, timeout=None)
                    self._block.wait()
#14 Frame 0xc42eb0, for file /home/haypo/prog/HG/cpython/Lib/threading.py, line 965, in _exitfunc (self=<_MainThread(_target=None, _block=<_Condition(release=<built-in method release of _thread.lock object at remote 0xc66290>, acquire=<built-in method acquire of _thread.lock object at remote 0xc66290>, _lock=<_thread.lock at remote 0xc66290>, _waiters=[], _verbose=False) at remote 0xc66110>, _args=(), _initialized=True, _name='MainThread', _daemonic=False, _kwargs={}, _stderr=<_io.TextIOWrapper at remote 0xac15a0>, _ident=140737353987840, _started=<_Event(_flag=True, _cond=<_Condition(release=<built-in method release of _thread.lock object at remote 0xc62fe0>, acquire=<built-in method acquire of _thread.lock object at remote 0xc62fe0>, _lock=<_thread.lock at remote 0xc62fe0>, _waiters=[], _verbose=False) at remote 0xc65d20>, _verbose=False) at remote 0xc65840>, _stopped=True, _verbose=False) at remote 0xc64c90>, t=<Thread(_target=<function at remote 0xbb5d30>, _block=<_Condition(release=<built-in method release o...(truncated)
            t.join()
--------------------

Attached patch uses a syntax closer to classic Python tracebacks:
--------------------
$ gdb -args ./python -c 'import time, threading; (gdb) run
...
[New Thread 0x7ffff69d9700 (LWP 17193)]
^C
Program received signal SIGINT, Interrupt.
sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
86	../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Aucun fichier ou dossier de ce type.
	in ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
(gdb) py-bt
Traceback (most recent call first):
  File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 237, in wait
  File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 851, in join
  File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 965, in _exitfunc
(gdb) info threads
  2 Thread 0x7ffff69d9700 (LWP 17193)  0x00007ffff72a0c73 in select () at ../sysdeps/unix/syscall-template.S:82
* 1 Thread 0x7ffff7fdb700 (LWP 17190)  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
(gdb) thread 2
[Switching to thread 2 (Thread 0x7ffff69d9700 (LWP 17193))]#0  0x00007ffff72a0c73 in select ()
    at ../sysdeps/unix/syscall-template.S:82
82	../sysdeps/unix/syscall-template.S: Aucun fichier ou dossier de ce type.
	in ../sysdeps/unix/syscall-template.S
(gdb) py-bt
Traceback (most recent call first):
  File "<string>", line 1, in <lambda>
  File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 690, in run
  File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 737, in _bootstrap_inner
  File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 710, in _bootstrap
--------------------

----------
components: Demos and Tools
files: gdb.patch
keywords: patch
messages: 135102
nosy: dmalcolm, haypo
priority: normal
severity: normal
status: open
title: libpython.py: nicer py-bt output
versions: Python 3.3
Added file: http://bugs.python.org/file21878/gdb.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11996>
_______________________________________


More information about the New-bugs-announce mailing list