windbg安裝pykd記錄


https://githomelab.ru/pykd/pykd

1、安裝python   (坑,分x86和x64,對應windbg版本)

2、安裝pykd:'pip install pykd'

3、安裝Windbg插件

下載地址:https://githomelab.ru/pykd/pykd-ext/-/wikis/Downloads

安裝步驟:https://githomelab.ru/pykd/pykd-ext

 

排坑記錄:

1、執行!py命令后提示:failed to find python interpreter

解決方案:安裝對於版本的python

2、執行!py命令后windbg閃退

排錯過程:

windbg加載C:\Users\xxx\AppData\Local\CrashDumps目錄下的dump文件

!analyze -v

應該是環境的問題,搜索中發現:https://stackoverflow.com/questions/43688302/windbg-cant-find-python-interpreter-for-pykd/45856752#45856752

I had this issue when having multiple python installations on the same machine. Managed to solve it by manually creating required registry key, as I did not want to reinstall any python versions, nor change the global path/pythonpath variables.

Note that you will need x64 python for windbgx64 and x86 python for windbgx86

Let's say you want to use python 3.7x86 installed at c:\python37_x86, and python 3.6x64installed at c:\python36_x64

  1. Create keys leading to HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Python\PythonCore\3.7-32\InstallPath there, and set the (Default) to c:\python37_x86\ (the trailing backslash is important!)

  2. Similarly, create keys leading to HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.6\InstallPath there, and set the (Default) to c:\python36_x64\

  3. Unfortunately the PYTHONPATH environment variable is still being used, and must match the referenced python version(otherwise you will encounter Fatal Python error: unable to load the file system codec . NOTE: this may only be important if one of the versions is 2.x and the other 3.x. Try making it work without this step

To circumvent the last issue I created .bat files to modify the environment and launch windbg with the correct environment.

For example for launching 32 bit windbg:

set PYTHONPATH=C:\python37_x86\Lib;[...Rest of the PYTHONPATH for this python version...] start windbgx -debugArch x86 -c ".load c:\dev\tools\pykd\x86\pykd.dll"

解決方案:使用bat腳本啟動對應windbg

根據個人環境修改

x86:

e:
cd E:\Windows Kits\10\Debuggers\x86
set PYTHONPATH=D:\sdk\python37_86\Lib;
start windbg

 

x64

e:
cd E:\Windows Kits\10\Debuggers\x64
set PYTHONPATH=D:\sdk\Anaconda3\Lib;
start windbg

 

over!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM