WinDbg Extensions for Python
============================ WinDbg Extensions for Python ============================ .. image:: https://github.com/SeanCline/PyExt/actions/workflows/ci.yml/badge.svg?branch=master :alt: Build Status :target: https://github.com/SeanCline/PyExt/actions/workflows/ci.yml This debugger extension provides visualizations for Python objects and stacktraces when debugging the CPython interpreter. It helps with live debugging and post-mortem analysis of dump files.
The goal of this project is to provide a similar debugging experience in WinDbg/CDB/NTSD as already exists in GDB <https://wiki.python.org/moin/DebuggingWithGdb>_.
Currently, the extension is tested against 32bit and 64bit builds of Python versions 2.7, and 3.3 through 3.14.
Installation ============ - Build from source or download binaries from the Releases page - Copy pyext.dll of the appropriate bitness into <WINDBG_ROOT>\<BITNESS>\winext - Ensure you have Microsoft Visual C++ 2017 Redistributable installed
Extension Commands ==================
!pystack
Displays the Python callstack for the current thread.
Example usage: ^^^^^^^^^^^^^^ .. code-block::
0:000> !pystack Thread 0: File "C:\Python36\lib\threading.py", line 1072, in waitfortstatelock File "C:\Python36\lib\threading.py", line 1056, in join File "scripts\win32debug.py", line 148, in launchand_wait File "scripts\win32debug.py", line 175, in dump_process File ".\fibonaccitest.py", line 18, in recursivefib File ".\fibonaccitest.py", line 18, in recursivefib File ".\fibonaccitest.py", line 18, in recursivefib File ".\fibonacci_test.py", line 28, in
Use !pystack -all or ~*e!pystack to display the Python stack for all threads.
!pyobj
Displays the reference count, type, and value of a Python object, using similar formatting to Python's builtin
repr() function.
Example usage: ^^^^^^^^^^^^^^ .. code-block::
0:000> !pyobj autoInterpreterState->tstatehead->frame->fcode PyCodeObject at address: 000001fcb6a87f60 RefCount: 2 Type: code Repr: <code object, file "scripts\win32debug.py", line 120>
.. code-block::
0:000> !pyobj autoInterpreterState->tstatehead->frame->fglobals PyDictObject at address: 000001fcb6ba6bd0 RefCount: 15 Type: dict Repr: { 'name': 'win32debug', 'doc': 'Wrappers around various Win32 APIs debugging.', # ... }