New submission from STINNER Victor:

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 ;-)

----------
files: gdb_wrapper_call.patch
keywords: patch
messages: 286233
nosy: haypo, inada.naoki
priority: normal
severity: normal
status: open
title: python-gdb: display wrapper_call()
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file46411/gdb_wrapper_call.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29367>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to