classification
Title: python-gdb: display wrapper_call()
Type: enhancement Stage: resolved
Components: Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: haypo, inada.naoki, python-dev
Priority: normal Keywords: patch

Created on 2017-01-25 09:29 by haypo, last changed 2017-05-12 22:21 by haypo. This issue is now closed.

Files
File name Uploaded Description Edit
gdb_wrapper_call.patch haypo, 2017-01-25 09:29 review
Pull Requests
URL Status Linked Edit
PR 552 closed dstufft, 2017-03-31 16:36
Messages (8)
msg286233 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-01-25 09:29
python-gdb.py handles various Python calls, but not descriptors. Attached patch adds code to display calls to wrapperobject objects.

The patch adds the first "<method-wrapper ...>" line of the traceback:
---
(gdb) py-bt
Traceback (most recent call first):
  <method-wrapper '__init__' of CodecInfo object at 0x7ffff7e9d7a8>
  File "/home/haypo/prog/python/git_cpython/Lib/encodings/utf_8.py", line 41, in getregentry
    streamwriter=StreamWriter,
  File "/home/haypo/prog/python/git_cpython/Lib/encodings/__init__.py", line 122, in search_function
    entry = getregentry()
---

I wrote this patch while working on the issue #29358. Object instanciation is full of wrappers. A better debugger helps to me understand my bugs ;-)

Example to get such tracecback:
---
haypo@selma$ gdb -args ./python -m test -v test_sys
(gdb) b wrapper_call
(gdb) run
(gdb) py-bt
Traceback (most recent call first):
  <method-wrapper '__init__' of _EnumDict object at 0x7ffff023d388>
  File "/home/haypo/prog/python/default/Lib/enum.py", line 66, in __init__
    super().__init__()
  File "/home/haypo/prog/python/default/Lib/enum.py", line 117, in __prepare__
    enum_dict = _EnumDict()
  <built-in method __build_class__ of module object at remote 0x7ffff7f46c58>
  File "/home/haypo/prog/python/default/Lib/enum.py", line 509, in <module>
    class Enum(metaclass=EnumMeta):
  <built-in method exec of module object at remote 0x7ffff7f46c58>
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  (...)
---

I guess that the next step is to write a test ;-)
msg286638 - (view) Author: Roundup Robot (python-dev) Date: 2017-02-01 15:30
New changeset 54fa95b19fae by Victor Stinner in branch 'default':
python-gdb.py supports method-wrapper
https://hg.python.org/cpython/rev/54fa95b19fae
msg286640 - (view) Author: Roundup Robot (python-dev) Date:
New changeset 30867b703933d6ba30bc5f609a1a2337925ead33 by Victor Stinner in branch 'master':
python-gdb.py supports method-wrapper
https://github.com/python/cpython/commit/30867b703933d6ba30bc5f609a1a2337925ead33
msg286641 - (view) Author: Roundup Robot (python-dev) Date: 2017-02-01 16:00
New changeset ffd2e5f9256a by Victor Stinner in branch 'default':
Make test_gdb.test_wrapper_call() make reliable
https://hg.python.org/cpython/rev/ffd2e5f9256a
msg286655 - (view) Author: Roundup Robot (python-dev) Date:
New changeset 88835e6022a81d8107a296c9f6e5f16c7d39e27a by Victor Stinner in branch 'master':
Make test_gdb.test_wrapper_call() make reliable
https://github.com/python/cpython/commit/88835e6022a81d8107a296c9f6e5f16c7d39e27a
msg286665 - (view) Author: Roundup Robot (python-dev) Date: 2017-02-01 17:26
New changeset efaf32ac89ec by Victor Stinner in branch 'default':
Fix test_gdb.test_wrapper_call() on Python 2
https://hg.python.org/cpython/rev/efaf32ac89ec
msg286671 - (view) Author: Roundup Robot (python-dev) Date:
New changeset da331c7d12c4648b9734ebb07e9f722c8478d269 by Victor Stinner in branch 'master':
Fix test_gdb.test_wrapper_call() on Python 2
https://github.com/python/cpython/commit/da331c7d12c4648b9734ebb07e9f722c8478d269
msg293584 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-12 22:21
New changeset d05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88 by Victor Stinner in branch '3.6':
[3.6] bpo-30345: Update test_gdb.py and python-gdb.py from master (#1549)
https://github.com/python/cpython/commit/d05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88
History
Date User Action Args
2017-05-12 22:21:53hayposetmessages: + msg293584
2017-03-31 16:36:08dstufftsetpull_requests: + pull_request844
2017-02-01 18:00:19python-devsetmessages: + msg286671
2017-02-01 17:26:52python-devsetmessages: + msg286665
2017-02-01 17:00:21python-devsetmessages: + msg286655
2017-02-01 16:00:56python-devsetmessages: + msg286641
2017-02-01 16:00:50python-devsetstage: resolved
2017-02-01 16:00:50python-devsetresolution: fixed
2017-02-01 16:00:50python-devsetstatus: open -> closed
2017-02-01 16:00:50python-devsetmessages: + msg286640
2017-02-01 15:30:10python-devsetnosy: + python-dev
messages: + msg286638
2017-01-25 09:29:36haypocreate