Quantcast
Channel: Python extension for WinDbg
Viewing all 1625 articles
Browse latest View live

Edited Issue: [0.3.x] stepout functions leads to windbg freeze [14031]

$
0
0
Reproduction:
```
setIP(invalidAddress)
stepout()
```

Expected: exception must be raise and function must return

Commented Issue: [0.3.x] stepout functions leads to windbg freeze [14031]

$
0
0
Reproduction:
```
setIP(invalidAddress)
stepout()
```

Expected: exception must be raise and function must return
Comments: ** Comment from web user: ussrhero **

fixed 0.3.1.10

Edited Feature: [0.3.x] print for function must be more full [14032]

$
0
0
```
>>> print typedVar("malloc")
Void*(__cdecl)(Int4B)
```
It is expected to see address of the function at least

Edited Issue: [0.3.x] stackAlloc does not work in WOW64 mode [14033]

$
0
0
1. Start x64 windbg
2. Attach to x86 process (wow64 )
3. try to call stackAlloc

Expected: address on x86 stack
In fact: invalid address

Released: PYKD 0.3.1.10 (Jan 26, 2017)

$
0
0

Supported Python Version

  • Python 2.7 x86/x64
  • Python 3.5 x86/x64
  • Python 3.6 x86/x64

Installation as a WinDBG extension with pykd bootstrapper

If you are going to run pykd in the windbg it is easiest way. Follow this link pykd bootstrapper 2.0 to install pykd bootstrapper and get started.
Python 3.0 support
Pykd bootstrapper 2.0 fully supports python 3.x. You can use 2.x and 3.x python both inside the same windbg session. You can install pykd from PyPi for python 3.5 and 3.6. For another 3.x pythons you need to build pykd manually.

Installation as a Python package with pip:

You can install pykd as a common python package with pip:
pip install pykd

Or upgrade existing version:
pip install pykd --upgrade

Pip documentation: https://pip.pypa.io
Pykd page on the PyPI: https://pypi.python.org/pypi/pykd
If pip can not install pykd from PyPI
Sometimes pip can not install packages from PyPi, for example due proxy with NTLM authorization. In this situation you can download a python wheel ( file with wlh extension ) and install it with pip locally:
pip install pykd-0.3.1.1-cp27-none-win32.whl

Manual Installation guide:

0. choose x86 or x64 and download it
1. unpack archive to any catalog
2. run windbg and load pykd:
.load path-to-pykd
3. to use pykd within python program add a path to pykd to the PYTHONPATH or via registry ( \SOFTWARE\Python\PythonCore\version\PythonPath )

Attention!!! Do not attempt to copy pykd.pyd of the 0.3.x version over 0.2.x . It will not work properly!

Where is an automatic installer?

We still have a problem with the installer (see https://pykd.codeplex.com/workitem/13172 ) and can not upload fixed version now.

Bug fixed:

  • issue #14031 ( stepout functions leads to windbg freeze )
  • issue #14032 ( print for function must be more full )
  • issue #14033 ( stackAlloc does not work in WOW64 mode )
  • issue #14034 ( call IDebugRegisters2::GetIndexByNameWide("EBX", ...) return 0x80004002 (dbgeng 10.0.14321.1024) )
  • issue #14043 ( Wrong register-located variable value (stack frame) )

Updated Release: PYKD 0.3.1.10 (янв 26, 2017)

$
0
0

Supported Python Version

  • Python 2.7 x86/x64
  • Python 3.5 x86/x64
  • Python 3.6 x86/x64

Installation as a WinDBG extension with pykd bootstrapper

If you are going to run pykd in the windbg it is easiest way. Follow this link pykd bootstrapper 2.0 to install pykd bootstrapper and get started.
Python 3.0 support
Pykd bootstrapper 2.0 fully supports python 3.x. You can use 2.x and 3.x python both inside the same windbg session. You can install pykd from PyPi for python 3.5 and 3.6. For another 3.x pythons you need to build pykd manually.

Installation as a Python package with pip:

You can install pykd as a common python package with pip:
pip install pykd

Or upgrade existing version:
pip install pykd --upgrade

Pip documentation: https://pip.pypa.io
Pykd page on the PyPI: https://pypi.python.org/pypi/pykd
If pip can not install pykd from PyPI
Sometimes pip can not install packages from PyPi, for example due proxy with NTLM authorization. In this situation you can download a python wheel ( file with wlh extension ) and install it with pip locally:
pip install pykd-0.3.1.1-cp27-none-win32.whl

Manual Installation guide:

0. choose x86 or x64 and download it
1. unpack archive to any catalog
2. run windbg and load pykd:
.load path-to-pykd
3. to use pykd within python program add a path to pykd to the PYTHONPATH or via registry ( \SOFTWARE\Python\PythonCore\version\PythonPath )

Attention!!! Do not attempt to copy pykd.pyd of the 0.3.x version over 0.2.x . It will not work properly!

Where is an automatic installer?

We still have a problem with the installer (see https://pykd.codeplex.com/workitem/13172 ) and can not upload fixed version now.

Bug fixed:

  • issue #14031 ( stepout functions leads to windbg freeze )
  • issue #14032 ( print for function must be more full )
  • issue #14033 ( stackAlloc does not work in WOW64 mode )
  • issue #14034 ( call IDebugRegisters2::GetIndexByNameWide("EBX", ...) return 0x80004002 (dbgeng 10.0.14321.1024) )
  • issue #14043 ( Wrong register-located variable value (stack frame) )

Edited Unassigned: Python 3 support [13183]

$
0
0
It would be nice to have python 3 support for such a great windbg extension.

Closed Unassigned: Installer: why only accept WinDbg winext path? [12656]

$
0
0
I tried to install PyKd. During installation it asks for WinDbg's winext folder.
How does the installer know whether or not a folder is WinDbg's winext folder?

Using the .extpath command, I can set any folder as WinDbg's extension folder. No such extension folder is accepted by the installer, except C:\Program Files (x86)\Windows SDK 8\Debuggers\x64\winext\ (or the x86 version).

I'd appreciate if the installer could be changed in a way that I can select my preferred extension folder.

(I'm doing debugging, so I should know what I'm doing, also during installation, right?)

Closed Issue: [0.2.x] call "import PySide" hangs up [12600]

Closed Unassigned: BaseException: File: .\dia\symexport.cpp Line: 103 TODO [12170]

$
0
0
>>> a=typedVar("QtCore4!QString",reg("eax"))
Traceback (most recent call last):
File "<console>", line 1, in <module>
BaseException: File: .\dia\symexport.cpp Line: 103 TODO
>>> p=reg("eax")
>>> a=typedVar("QtCore4!QString",p)
Traceback (most recent call last):
File "<console>", line 1, in <module>
BaseException: File: .\dia\symexport.cpp Line: 103 TODO

Closed Issue: [pykd-0.2.x] dbgCommand('g') hangs up [11652]

$
0
0
any command changing execution status leads to a hang with dbgCommand call

Closed Feature: [pykd-0.2.x] TypeInfo::getAlign [11648]

Closed Unassigned: Improve document of `disasm.jumprel` [12837]

$
0
0
If you need to disassemble a memory range, you should call `disasm.instruction` and `disasm.jumprel(0)` repeatedly.

The documentation doesn't mentioned the detail so I used to use `disasm.jumprel(disasm.current())` instead of `disasm.jumprel(0)`.

Closed Unassigned: Extension named pykd.pyd [12657]

$
0
0
I know that PYD files are Python DLLs. In WinDbg I have to use `.load pykd.pyd` to load the extension.

I would appreciate if the extension would be renamed to DLL so that I can load it like every other extension using `.load pykd`.

Created Feature: [0.3.x] Inline Function Debugging [14057]

$
0
0
Test:
```
class CTest
{
public:
~CTest()
{
__debugbreak();
}
};
int wmain(__in int argc, __in PWSTR argv[])
{
std::list<CTest> TestList;
TestList.emplace_back();
return 0;
}
```

Debugging:
```
0:000> .inline 1
Include inline function queries is "enabled".
0:000> r
rax=000000000041ce60 rbx=000000000041ce60 rcx=000000000041cf10
rdx=0000000000000003 rsi=0000000000000000 rdi=00000000001dfaf8
rip=000000013fcb1743 rsp=00000000001dfa90 rbp=0000000000000000
r8=000000000041cf10 r9=0000000000000000 r10=0000000000000200
r11=000000000041cf10 r12=0000000000000000 r13=0000000000000000
r14=0000000000000000 r15=0000000000000000
iopl=0 nv up ei pl nz na pe nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202
test!std::list<CTest,std::allocator<CTest> >::clear+0x93:
00000001`3fcb1743 cc int 3
0:000> k
# Child-SP RetAddr Call Site
00 (Inline Function) --------`-------- test!CTest::{dtor} [~\test.cpp @ 100]
01 (Inline Function) --------`-------- test!std::allocator<std::_List_node<CTest,void *> >::destroy [c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 @ 744]
02 (Inline Function) --------`-------- test!std::allocator_traits<std::allocator<std::_List_node<CTest,void *> > >::destroy [c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 @ 864]
03 (Inline Function) --------`-------- test!std::_Wrap_alloc<std::allocator<std::_List_node<CTest,void *> > >::destroy [c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 @ 1003]
04 (Inline Function) --------`-------- test!std::_List_buy<CTest,std::allocator<CTest> >::_Freenode [c:\program files (x86)\microsoft visual studio 14.0\vc\include\list @ 853]
05 00000000`001dfa90 00000001`3fcb17f5 test!std::list<CTest,std::allocator<CTest> >::clear+0x93 [c:\program files (x86)\microsoft visual studio 14.0\vc\include\list @ 1513]
06 (Inline Function) --------`-------- test!std::list<CTest,std::allocator<CTest> >::_Tidy+0xa [c:\program files (x86)\microsoft visual studio 14.0\vc\include\list @ 1884]
07 (Inline Function) --------`-------- test!std::list<CTest,std::allocator<CTest> >::{dtor}+0xa [c:\program files (x86)\microsoft visual studio 14.0\vc\include\list @ 1098]
08 00000000`001dfad0 00000001`3fcb3394 test!wmain+0x75 [~\test.cpp @ 110]
09 00000000`001dfb20 00000001`3fcb32b7 test!invoke_main+0x34 [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 80]
0a 00000000`001dfb60 00000001`3fcb317e test!__scrt_common_main_seh+0x127 [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 253]
0b 00000000`001dfbc0 00000001`3fcb33a9 test!__scrt_common_main+0xe [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 296]
0c 00000000`001dfbf0 00000000`778059cd test!wmainCRTStartup+0x9 [f:\dd\vctools\crt\vcstartup\src\startup\exe_wmain.cpp @ 17]
0d 00000000`001dfc20 00000000`7793a561 kernel32!BaseThreadInitThunk+0xd
0e 00000000`001dfc50 00000000`00000000 ntdll!RtlUserThreadStart+0x1d
```

```
0:000> !py
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> dbgCommand(".inline 1")
u'Include inline function queries is "enabled".\n'
>>> for f in getStack():
... print( findSymbol(f.ip) )
...
test!std::list<CTest,std::allocator<CTest> >::clear+93
test!wmain+75
test!invoke_main+34
test!__scrt_common_main_seh+23
test!__scrt_common_main+e
test!wmainCRTStartup+9
kernel32!BaseThreadInitThunk+d
ntdll!RtlUserThreadStart+1d
```

```
0:000> .inline 0
Include inline function queries is "disabled".
0:000> r
rax=000000000041ce60 rbx=000000000041ce60 rcx=000000000041cf10
rdx=0000000000000003 rsi=0000000000000000 rdi=00000000001dfaf8
rip=000000013fcb1743 rsp=00000000001dfa90 rbp=0000000000000000
r8=000000000041cf10 r9=0000000000000000 r10=0000000000000200
r11=000000000041cf10 r12=0000000000000000 r13=0000000000000000
r14=0000000000000000 r15=0000000000000000
iopl=0 nv up ei pl nz na pe nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202
test!std::list<CTest,std::allocator<CTest> >::clear+0x93:
00000001`3fcb1743 cc int 3
0:000> k
# Child-SP RetAddr Call Site
00 00000000`001dfa90 00000001`3fcb17f5 test!std::list<CTest,std::allocator<CTest> >::clear+0x93 [c:\program files (x86)\microsoft visual studio 14.0\vc\include\list @ 1513]
01 00000000`001dfad0 00000001`3fcb3394 test!wmain+0x75 [d:\projects\!trash\test.cpp @ 110]
02 00000000`001dfb20 00000001`3fcb32b7 test!invoke_main+0x34 [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 80]
03 00000000`001dfb60 00000001`3fcb317e test!__scrt_common_main_seh+0x127 [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 253]
04 00000000`001dfbc0 00000001`3fcb33a9 test!__scrt_common_main+0xe [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 296]
05 00000000`001dfbf0 00000000`778059cd test!wmainCRTStartup+0x9 [f:\dd\vctools\crt\vcstartup\src\startup\exe_wmain.cpp @ 17]
06 00000000`001dfc20 00000000`7793a561 kernel32!BaseThreadInitThunk+0xd
07 00000000`001dfc50 00000000`00000000 ntdll!RtlUserThreadStart+0x1d
```

MSDN:
* [.inline (Toggle Inline Function Debugging)](https://msdn.microsoft.com/library/windows/hardware/hh974778(v=vs.85).aspx)
* [Debugging Optimized Code and Inline Functions](https://msdn.microsoft.com/library/windows/hardware/hh406275(v=vs.85).aspx)

Commented Feature: [0.3.x] Inline Function Debugging [14057]

$
0
0
Test:
```
class CTest
{
public:
~CTest()
{
__debugbreak();
}
};
int wmain(__in int argc, __in PWSTR argv[])
{
std::list<CTest> TestList;
TestList.emplace_back();
return 0;
}
```

Debugging:
```
0:000> .inline 1
Include inline function queries is "enabled".
0:000> r
rax=000000000041ce60 rbx=000000000041ce60 rcx=000000000041cf10
rdx=0000000000000003 rsi=0000000000000000 rdi=00000000001dfaf8
rip=000000013fcb1743 rsp=00000000001dfa90 rbp=0000000000000000
r8=000000000041cf10 r9=0000000000000000 r10=0000000000000200
r11=000000000041cf10 r12=0000000000000000 r13=0000000000000000
r14=0000000000000000 r15=0000000000000000
iopl=0 nv up ei pl nz na pe nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202
test!std::list<CTest,std::allocator<CTest> >::clear+0x93:
00000001`3fcb1743 cc int 3
0:000> k
# Child-SP RetAddr Call Site
00 (Inline Function) --------`-------- test!CTest::{dtor} [~\test.cpp @ 100]
01 (Inline Function) --------`-------- test!std::allocator<std::_List_node<CTest,void *> >::destroy [c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 @ 744]
02 (Inline Function) --------`-------- test!std::allocator_traits<std::allocator<std::_List_node<CTest,void *> > >::destroy [c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 @ 864]
03 (Inline Function) --------`-------- test!std::_Wrap_alloc<std::allocator<std::_List_node<CTest,void *> > >::destroy [c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 @ 1003]
04 (Inline Function) --------`-------- test!std::_List_buy<CTest,std::allocator<CTest> >::_Freenode [c:\program files (x86)\microsoft visual studio 14.0\vc\include\list @ 853]
05 00000000`001dfa90 00000001`3fcb17f5 test!std::list<CTest,std::allocator<CTest> >::clear+0x93 [c:\program files (x86)\microsoft visual studio 14.0\vc\include\list @ 1513]
06 (Inline Function) --------`-------- test!std::list<CTest,std::allocator<CTest> >::_Tidy+0xa [c:\program files (x86)\microsoft visual studio 14.0\vc\include\list @ 1884]
07 (Inline Function) --------`-------- test!std::list<CTest,std::allocator<CTest> >::{dtor}+0xa [c:\program files (x86)\microsoft visual studio 14.0\vc\include\list @ 1098]
08 00000000`001dfad0 00000001`3fcb3394 test!wmain+0x75 [~\test.cpp @ 110]
09 00000000`001dfb20 00000001`3fcb32b7 test!invoke_main+0x34 [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 80]
0a 00000000`001dfb60 00000001`3fcb317e test!__scrt_common_main_seh+0x127 [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 253]
0b 00000000`001dfbc0 00000001`3fcb33a9 test!__scrt_common_main+0xe [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 296]
0c 00000000`001dfbf0 00000000`778059cd test!wmainCRTStartup+0x9 [f:\dd\vctools\crt\vcstartup\src\startup\exe_wmain.cpp @ 17]
0d 00000000`001dfc20 00000000`7793a561 kernel32!BaseThreadInitThunk+0xd
0e 00000000`001dfc50 00000000`00000000 ntdll!RtlUserThreadStart+0x1d
```

```
0:000> !py
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> dbgCommand(".inline 1")
u'Include inline function queries is "enabled".\n'
>>> for f in getStack():
... print( findSymbol(f.ip) )
...
test!std::list<CTest,std::allocator<CTest> >::clear+93
test!wmain+75
test!invoke_main+34
test!__scrt_common_main_seh+23
test!__scrt_common_main+e
test!wmainCRTStartup+9
kernel32!BaseThreadInitThunk+d
ntdll!RtlUserThreadStart+1d
```

```
0:000> .inline 0
Include inline function queries is "disabled".
0:000> r
rax=000000000041ce60 rbx=000000000041ce60 rcx=000000000041cf10
rdx=0000000000000003 rsi=0000000000000000 rdi=00000000001dfaf8
rip=000000013fcb1743 rsp=00000000001dfa90 rbp=0000000000000000
r8=000000000041cf10 r9=0000000000000000 r10=0000000000000200
r11=000000000041cf10 r12=0000000000000000 r13=0000000000000000
r14=0000000000000000 r15=0000000000000000
iopl=0 nv up ei pl nz na pe nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202
test!std::list<CTest,std::allocator<CTest> >::clear+0x93:
00000001`3fcb1743 cc int 3
0:000> k
# Child-SP RetAddr Call Site
00 00000000`001dfa90 00000001`3fcb17f5 test!std::list<CTest,std::allocator<CTest> >::clear+0x93 [c:\program files (x86)\microsoft visual studio 14.0\vc\include\list @ 1513]
01 00000000`001dfad0 00000001`3fcb3394 test!wmain+0x75 [d:\projects\!trash\test.cpp @ 110]
02 00000000`001dfb20 00000001`3fcb32b7 test!invoke_main+0x34 [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 80]
03 00000000`001dfb60 00000001`3fcb317e test!__scrt_common_main_seh+0x127 [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 253]
04 00000000`001dfbc0 00000001`3fcb33a9 test!__scrt_common_main+0xe [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 296]
05 00000000`001dfbf0 00000000`778059cd test!wmainCRTStartup+0x9 [f:\dd\vctools\crt\vcstartup\src\startup\exe_wmain.cpp @ 17]
06 00000000`001dfc20 00000000`7793a561 kernel32!BaseThreadInitThunk+0xd
07 00000000`001dfc50 00000000`00000000 ntdll!RtlUserThreadStart+0x1d
```

MSDN:
* [.inline (Toggle Inline Function Debugging)](https://msdn.microsoft.com/library/windows/hardware/hh974778(v=vs.85).aspx)
* [Debugging Optimized Code and Inline Functions](https://msdn.microsoft.com/library/windows/hardware/hh406275(v=vs.85).aspx)
Comments: ** Comment from web user: ussrhero **

Это не так чтобы просто было сделать.
Получить стек с 'inline' фреймами - не сложно,
вот тут обсуждается: http://stackoverflow.com/questions/38893832/inline-stack-frames-with-idebugcontrol5-getcontextstacktraceex

Проблема в том, что мы получаем инфу о функции, ее параметрах через DIA. Там есть специальные методы для работы с inline функциями, но надо разбираться.

Created Issue: [pykd_bootstrapper] '!py C:' crashes windbg [14058]

Edited Issue: [pykd_bootstrapper] '!py C:' crashes windbg [14058]

Released: PYKD BOOTSTRAPPER 2.0 (Jun 23, 2016)

$
0
0
PYKD BOOTSTRAPPER is a windbg extension. It is a simple dll file (pykd.dll). It DOES NOT contain pykd functionality. I is designed to locate and initialize python core inside windbg. Then you can use any python packages and of course pykd.

Using pykd bootstrapper - is recommended way to use pykd with windbg.

To install pykd.dll you should:

1. Locate your windbg installation place ( for example: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64 )
2. Unpack pykd.dll to the 'ext' directory.

To load pykd.dll:

Run command:
.load pykd

Show help for pykd bootstrapper:

0:000> !pykd.help

usage:

!help
	print this text

!info
	list installed python interpreters

!py [version] [options] [file]
	run python script or REPL

	Version:
	-2           : use Python2
	-2.x         : use Python2.x
	-3           : use Python3
	-3.x         : use Python3.x

	Options:
	-g --global  : run code in the common namespace
	-l --local   : run code in the isolated namespace

	command samples:
	"!py"                          : run REPL
	"!py --local"                  : run REPL in the isolated namespace
	"!py -g script.py 10 "string"" : run script file with argument in the common namespace

!pip [version] [args]
	run pip package manager

	Version:
	-2           : use Python2
	-2.x         : use Python2.x
	-3           : use Python3
	-3.x         : use Python3.x

	pip command samples:
	"pip list"                   : show all installed packages
	"pip install pykd"           : install pykd
	"pip install --upgrade pykd" : upgrade pykd to the latest version
	"pip show pykd"              : show info about pykd package

List all available python core

0:000> !pykd.info

Installed python

Version:        Status:     Image:
------------------------------------------------------------------------------
* 2.7 x86-64    Unloaded    C:\Windows\SYSTEM32\python27.dll
  3.5 x86-64    Unloaded    C:\Users\user\AppData\Local\Programs\Python\Python35\python35.dll

To run scripts or REPL use command:

!pykd.py
  • To run REPL with the default python: !py
  • To run REPL with the specified python: !py -3
  • To run script with the default python: !py script.py arg1 arg2
  • To run script with the specified python: !py script.py arg1 arg2
  • To run REPL in local scope ( all objects will be destruct after quit() ): !py --local
  • To run script in global scope ( all objects stay to live ): !py --global script.py

You can use "shebang line" to note python version. Insert first line to a script file:
 #! python2

Or

 #! python3.5

To managed python packages use command:

!pykd.pip

Show package list
0:000> !pip -3.5 list
pip (7.1.2)
pykd (0.3.1.1)
setuptools (18.2)
wheel (0.29.0)

Show package info:
0:000> !pip -3.5 show pykd
---
Metadata-Version: 2.0
Name: pykd
Version: 0.3.1.1
Summary: python windbg extension
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Location: c:\users\user\appdata\local\programs\python\python35\lib\site-packages
Requires: 

Install or upgrade package:
0:000> !pip -3.5 install --upgrade pykd
Collecting pykd
  Downloading pykd-0.3.1.3-cp35-none-win_amd64.whl (3.3MB)
Installing collected packages: pykd
  Found existing installation: pykd 0.3.1.1
    Uninstalling pykd-0.3.1.1:
      Successfully uninstalled pykd-0.3.1.1
Successfully installed pykd-0.3.1.3

Updated Release: PYKD BOOTSTRAPPER 2.0 (июн 23, 2016)

$
0
0
PYKD BOOTSTRAPPER is a windbg extension. It is a simple dll file (pykd.dll). It DOES NOT contain pykd functionality. I is designed to locate and initialize python core inside windbg. Then you can use any python packages and of course pykd.

Using pykd bootstrapper - is recommended way to use pykd with windbg.

To install pykd.dll you should:

1. Locate your windbg installation place ( for example: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64 )
2. Unpack pykd.dll to the 'ext' directory.

To load pykd.dll:

Run command:
.load pykd

Show help for pykd bootstrapper:

0:000> !pykd.help

usage:

!help
	print this text

!info
	list installed python interpreters

!py [version] [options] [file]
	run python script or REPL

	Version:
	-2           : use Python2
	-2.x         : use Python2.x
	-3           : use Python3
	-3.x         : use Python3.x

	Options:
	-g --global  : run code in the common namespace
	-l --local   : run code in the isolated namespace

	command samples:
	"!py"                          : run REPL
	"!py --local"                  : run REPL in the isolated namespace
	"!py -g script.py 10 "string"" : run script file with argument in the common namespace

!pip [version] [args]
	run pip package manager

	Version:
	-2           : use Python2
	-2.x         : use Python2.x
	-3           : use Python3
	-3.x         : use Python3.x

	pip command samples:
	"pip list"                   : show all installed packages
	"pip install pykd"           : install pykd
	"pip install --upgrade pykd" : upgrade pykd to the latest version
	"pip show pykd"              : show info about pykd package

List all available python core

0:000> !pykd.info

Installed python

Version:        Status:     Image:
------------------------------------------------------------------------------
* 2.7 x86-64    Unloaded    C:\Windows\SYSTEM32\python27.dll
  3.5 x86-64    Unloaded    C:\Users\user\AppData\Local\Programs\Python\Python35\python35.dll

To run scripts or REPL use command:

!pykd.py
  • To run REPL with the default python: !py
  • To run REPL with the specified python: !py -3
  • To run script with the default python: !py script.py arg1 arg2
  • To run script with the specified python: !py script.py arg1 arg2
  • To run REPL in local scope ( all objects will be destruct after quit() ): !py --local
  • To run script in global scope ( all objects stay to live ): !py --global script.py

You can use "shebang line" to note python version. Insert first line to a script file:
 #! python2

Or

 #! python3.5

To managed python packages use command:

!pykd.pip

Show package list
0:000> !pip -3.5 list
pip (7.1.2)
pykd (0.3.1.1)
setuptools (18.2)
wheel (0.29.0)

Show package info:
0:000> !pip -3.5 show pykd
---
Metadata-Version: 2.0
Name: pykd
Version: 0.3.1.1
Summary: python windbg extension
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Location: c:\users\user\appdata\local\programs\python\python35\lib\site-packages
Requires: 

Install or upgrade package:
0:000> !pip -3.5 install --upgrade pykd
Collecting pykd
  Downloading pykd-0.3.1.3-cp35-none-win_amd64.whl (3.3MB)
Installing collected packages: pykd
  Found existing installation: pykd 0.3.1.1
    Uninstalling pykd-0.3.1.1:
      Successfully uninstalled pykd-0.3.1.1
Successfully installed pykd-0.3.1.3
Viewing all 1625 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>