WinDbg scripts for debugging CPython. Live and crash dump.
Supported CPython releases: 3.7~3.11, x86/AMD64
(3.11 has minor issues currently, ARM/ARM64 might work, but untested)
pystk.js
: Extract human-readable python stacktrace.
(Or if you don't have Node.js
, download the artifacts from CI)
- Install
Node.js
- Install npm packages with
npm ci
npm run build
- Find outputs in
build
directory
Install latest WinDbg Preview from Microsoft Store: https://www.microsoft.com/store/productId/9PGJGD53TN86
Start a live debugging session, or load a crash-dump with full memory information.
Load the script
.scriptload "C:\...\pystk.js"
Then try any of these:
!pystk
dx -r2 @$pystk()
dx -r2 @$curprocess.Threads
(observe PythonState
in Stack object.)
And filter / simplify result with LINQ
dx -r2 @$curprocess.Threads.Select(thd=>thd.PythonState).Where(ps=>ps.IsPythonThread)