[New-bugs-announce] [issue12605] Enhancements to gdb 7 debugging hooks
Dave Malcolm
report at bugs.python.org
Thu Jul 21 23:02:14 CEST 2011
New submission from Dave Malcolm <dmalcolm at redhat.com>:
I'm attaching patches to handle some more "events" in the gdb7 debugging hooks for CPython (aka Tools/gdb/libpython.py).
Currently, the hooks only care about C frames that are the bytecode interpreter (i.e. PyEval_EvalFrameEx)
This patch changes this, dividing C frames into:
- "python frames":
- "bytecode frames" i.e. PyEval_EvalFrameEx
- "other python frames": C frames that are of interest from a python
perspective, but aren't bytecode
- everything else
so that the "py-bt", "py-up" and "py-down" commands will now work on the other kinds of "python" frames, in addition to the bytecode frames.
Specifically, the following new kinds of C frame are displayed:
- waiting on the GIL
- garbage-collection
- CFunctions (these weren't displayed before)
This should assist when debugging multithreaded crashes, to more easily get a sense of what every thread is doing.
Examples:
Showing a garbage-collection:
(gdb) py-bt
Garbage-collecting
<built-in method collect of module object at remote 0x7ffff18ea420>
File "<string>", line 4, in foo
File "<string>", line 6, in bar
File "<string>", line 7, in <module>
(gdb) py-bt-full
#1 Garbage-collecting
#2 <built-in method collect of module object at remote 0x7ffff18ea420>
#5 Frame 0x7ffff20d6d48, for file <string>, line 4, in foo ()
#8 Frame 0x7ffff20d6b70, for file <string>, line 6, in bar ()
#11 Frame 0x7ffff7fb1d80, for file <string>, line 7, in <module> ()
Showing an invocation of "time.sleep()":
(gdb) py-bt-full
#0 <built-in method sleep of module object at remote 0x7ffff1af8150>
#3 Frame 0x7ffff18aa060, for file <string>, line 3, in foo ()
#6 Frame 0x7ffff20d6b70, for file <string>, line 5, in bar ()
#9 Frame 0x7ffff7fb1d80, for file <string>, line 6, in <module> ()
Showing multiple threads, where all but one are waiting for the GIL:
Thread 5 (Thread 0x7fffeb5fe700 (LWP 10716)):
Traceback (most recent call first):
Waiting for the GIL
File "<string>", line 10, in run
File "/home/david/coding/python-hg/cpython-more-gdb/build-debug/../Lib/threading.py", line 737, in _bootstrap_inner
self.run()
File "/home/david/coding/python-hg/cpython-more-gdb/build-debug/../Lib/threading.py", line 710, in _bootstrap
self._bootstrap_inner()
Thread 4 (Thread 0x7fffebfff700 (LWP 10715)):
Traceback (most recent call first):
Waiting for the GIL
File "<string>", line 10, in run
File "/home/david/coding/python-hg/cpython-more-gdb/build-debug/../Lib/threading.py", line 737, in _bootstrap_inner
self.run()
File "/home/david/coding/python-hg/cpython-more-gdb/build-debug/../Lib/threading.py", line 710, in _bootstrap
self._bootstrap_inner()
Thread 3 (Thread 0x7ffff0dea700 (LWP 10714)):
Traceback (most recent call first):
Waiting for the GIL
File "<string>", line 10, in run
File "/home/david/coding/python-hg/cpython-more-gdb/build-debug/../Lib/threading.py", line 737, in _bootstrap_inner
self.run()
File "/home/david/coding/python-hg/cpython-more-gdb/build-debug/../Lib/threading.py", line 710, in _bootstrap
self._bootstrap_inner()
Thread 2 (Thread 0x7ffff17eb700 (LWP 10713)):
Traceback (most recent call first):
Waiting for the GIL
File "<string>", line 10, in run
File "/home/david/coding/python-hg/cpython-more-gdb/build-debug/../Lib/threading.py", line 737, in _bootstrap_inner
self.run()
File "/home/david/coding/python-hg/cpython-more-gdb/build-debug/../Lib/threading.py", line 710, in _bootstrap
self._bootstrap_inner()
Thread 1 (Thread 0x7ffff7fdb700 (LWP 10709)):
Traceback (most recent call first):
File "<string>", line 18, in <module>
----------
assignee: dmalcolm
components: Demos and Tools
keywords: needs review
messages: 140828
nosy: dmalcolm, haypo
priority: normal
severity: normal
status: open
title: Enhancements to gdb 7 debugging hooks
versions: Python 2.7, Python 3.2, Python 3.3
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12605>
_______________________________________
More information about the New-bugs-announce
mailing list