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

Commented Issue: [pykd_ext_2.0] dbgCommand('q') leads to windbg hung [14066]

$
0
0
Run this script:

```
pykd.dbgCommand('q')
```

Expected: debug session is closed
In fact: windbg is hang
Comments: ** Comment from web user: ussrhero **

fixed in 2.0.0.9 version


Edited Issue: [pykd_ext_2.0] dbgCommand('q') leads to windbg hung [14066]

$
0
0
Run this script:

```
pykd.dbgCommand('q')
```

Expected: debug session is closed
In fact: windbg is hang

Created Unassigned: [0.3.x, 0.2.x] windbg hangs and crashes on threads and timers [14067]

$
0
0
when executing a simple python script like the following, windbg executes the first line of code in the threaded function, then hangs and crashes itself

```
import pykd
from threading import Thread

def my_func():
print "hi from thread 1\n"
print "hi from thread 2\n"

t = Thread(target=my_func)
t.daemon = True;
t.start()
print "after thread start"
```

Commented Unassigned: [0.3.x, 0.2.x] windbg hangs and crashes on threads and timers [14067]

$
0
0
when executing a simple python script like the following, windbg executes the first line of code in the threaded function, then hangs and crashes itself

```
import pykd
from threading import Thread

def my_func():
print "hi from thread 1\n"
print "hi from thread 2\n"

t = Thread(target=my_func)
t.daemon = True;
t.start()
print "after thread start"
```
Comments: ** Comment from web user: ussrhero **

I'm affraid is is impossible to make stable multithread code inside windbg.
It is a very long story to talk.
Dont's use __threading__ or __multiprocessing__ inside windbg.


Commented Unassigned: [0.3.x, 0.2.x] windbg hangs and crashes on threads and timers [14067]

$
0
0
when executing a simple python script like the following, windbg executes the first line of code in the threaded function, then hangs and crashes itself

```
import pykd
from threading import Thread

def my_func():
print "hi from thread 1\n"
print "hi from thread 2\n"

t = Thread(target=my_func)
t.daemon = True;
t.start()
print "after thread start"
```
Comments: ** Comment from web user: vicks16 **

@ussrhero - thanks for your reply!

I will take up your suggestion and stay away from multithreaded code on WinDbg.

That being said, I still wonder how others got it working in the past. Like this [script](https://github.com/joxeankoret/nightmare/blob/master/lib/interfaces/pykd_iface.py#L318-L324) for example.

My plan was to develop a pykd script which listens to requests over the network (on a different thread, while windbg was executing code) and did stuff like interrupt WinDbg etc. While its possible to do exactly this using WinDbg's server/client model, I wasn't planning to run another instance of WinDbg on the machine sending the requests.

Commented Unassigned: [0.3.x, 0.2.x] windbg hangs and crashes on threads and timers [14067]

$
0
0
when executing a simple python script like the following, windbg executes the first line of code in the threaded function, then hangs and crashes itself

```
import pykd
from threading import Thread

def my_func():
print "hi from thread 1\n"
print "hi from thread 2\n"

t = Thread(target=my_func)
t.daemon = True;
t.start()
print "after thread start"
```
Comments: ** Comment from web user: ussrhero **

You should exactly know how work multithreading in python, in windbg and pykd.

Your script sample has two problem:
1. It does not wait for additional thread stopping. It leads to fatal python error after the script stopping. So you need add join method call
2. You may not run any call wich can call dbgeng call due to avoid deadlocks with windbg. print leads to IDebugControl::ControlledOutput and it will be wait for command completion in the windbg thread wich is waiting for stop of the additional thread ( you have added join method remember? )

May be you don't need to run code inside in windbg? You can use pykd in standalone program. It is more easy in your case. Yoy will not have to think about deadlocks with windbg

Source code checked in, #91182

$
0
0
[0.3.2] added : getTypeFromSource ( create typeInfo class from C/C++ source code ) [0.3.2] added : getTypeInfoProviderFromSource ( create typeInfo provider from C/C++ source code )

Updated Release: PYKD 0.3.2.0 (фев 27, 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.

Whats new

This release contains the clang 3.9.0 backend and can get typeInfo from source code.
Try this example:
from pykd import *

source_code =  '''
struct Struct
{
    int    field1;
    float  field2;
    char   field3[10];
};
'''
Struct = getTypeFromSource(source_code, "Struct")

print Struct
It consructs a typeInfo class instance wich can be used for typed access to the target memory. The next sample is a bit complex. If source code has a lot of types declarations it has a sense to compile a code once time and then use a result:
from pykd import *

source_code = '#include <windows.h>\r\n'

options = '-I\"C:/Program Files (x86)/Windows Kits/8.1/Include/um\" -I\"C:/Program Files (x86)/Windows Kits/8.1/Include/shared\" -w'

typeInfoProvider = getTypeInfoProviderFromSource(source_code, options)

print( typeInfoProvider.getTypeByName("tagPOINT") )

print( typeInfoProvider.getTypeByName("tagWNDCLASSA") )

Released: PYKD 0.3.2.0 (Feb 27, 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.

Whats new

This release contains the clang 3.9.0 backend and can get typeInfo from source code.
Try this example:
from pykd import *

source_code =  '''
struct Struct
{
    int    field1;
    float  field2;
    char   field3[10];
};
'''
Struct = getTypeFromSource(source_code, "Struct")

print( Struct )
It consructs a typeInfo class instance wich can be used for typed access to the target memory. The next sample is a bit complex. If source code has a lot of types declarations it has a sense to compile a code once time and then use a result:
from pykd import *

source_code = '#include <windows.h>\r\n'

options = '-I\"C:/Program Files (x86)/Windows Kits/8.1/Include/um\" -I\"C:/Program Files (x86)/Windows Kits/8.1/Include/shared\" -w'

typeInfoProvider = getTypeInfoProviderFromSource(source_code, options)

print( typeInfoProvider.getTypeByName("tagPOINT") )

print( typeInfoProvider.getTypeByName("tagWNDCLASSA") )

Updated Release: PYKD 0.3.2.0 (фев 27, 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.

Whats new

This release contains the clang 3.9.0 backend and can get typeInfo from source code.
Try this example:
from pykd import *

source_code =  '''
struct Struct
{
    int    field1;
    float  field2;
    char   field3[10];
};
'''
Struct = getTypeFromSource(source_code, "Struct")

print( Struct )
It consructs a typeInfo class instance wich can be used for typed access to the target memory. The next sample is a bit complex. If source code has a lot of types declarations it has a sense to compile a code once time and then use a result:
from pykd import *

source_code = '#include <windows.h>\r\n'

options = '-I\"C:/Program Files (x86)/Windows Kits/8.1/Include/um\" -I\"C:/Program Files (x86)/Windows Kits/8.1/Include/shared\" -w'

typeInfoProvider = getTypeInfoProviderFromSource(source_code, options)

print( typeInfoProvider.getTypeByName("tagPOINT") )

print( typeInfoProvider.getTypeByName("tagWNDCLASSA") )

Created Issue: [0.3.x] getLocal() works inproperly [14069]

Edited Issue: [0.3.x] getLocal() works inproperly [14069]

Created Issue: [0.3.2] getTypeFromSource crashes windbg on [14070]

$
0
0
This code raises debug exception:
```
print getTypeFromSource("#include <ntddk.h>\n", "_KPROCESS", '-I\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.14393.0/km')
```

80000003 Exception in C:\proj\pykd_release\out\x64\Release_2.7\pykd.pyd.py debugger extension.
PC: 00007fff`9c710acf VA: 00000000`00000000 R/W: 0 Parameter: 00000000`00000000

Edited Issue: [0.3.2] getTypeFromSource crashes windbg on [14070]

$
0
0
This code raises debug exception:
```
print getTypeFromSource("#include <ntddk.h>\n", "_KPROCESS", '-I\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.14393.0/km')
```

80000003 Exception in C:\proj\pykd_release\out\x64\Release_2.7\pykd.pyd.py debugger extension.
PC: 00007fff`9c710acf VA: 00000000`00000000 R/W: 0 Parameter: 00000000`00000000

Source code checked in, #91185

$
0
0
[pykd_ext_2.0] fixed : hang up python console

Source code checked in, #91186

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

Created Unassigned: pykd 0.3.2.0 crashes python 3.6.0 on unload [14074]

$
0
0
Initialializing pykd (e.g. by starting and quitting and interactive session immediately) and then unloading it again will crash windbg.

The point of the crash is here: https://github.com/python/cpython/blob/3.6/Python/ceval_gil.h#L175

So something funky must be happening with the GIL.

Python version: Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32

Stack trace of the crash:
```
# ChildEBP RetAddr Args to Child
00 06fecf98 77e3bb6b 00720064 0070006f 0067005f ucrtbase!abort+0x4b
01 06fecfec 77e138e6 77f4e3f4 084fd298 77e0145e python36!Py_FatalError+0xfb [c:\build\cpython36\python\pylifecycle.c @ 1457]
02 06fecff8 77e0145e 00000000 086da238 00000002 python36!drop_gil+0x16 [c:\build\cpython36\python\ceval_gil.h @ 175]
03 (Inline) -------- -------- -------- -------- python36!PyEval_SaveThread+0x34 [c:\build\cpython36\python\ceval.c @ 355]
04 06fed014 77dfffc4 08763288 00000000 00020019 python36!winreg_OpenKey_impl+0x3e [c:\build\cpython36\pc\winreg.c @ 1317]
05 06fed038 77db35d5 086d0d50 08695488 00000002 python36!winreg_OpenKey+0x54 [c:\build\cpython36\pc\clinic\winreg.c.h @ 645]
06 06fed068 77db370e 77dfff70 08695488 00000002 python36!_PyCFunction_FastCallDict+0x1a5 [c:\build\cpython36\objects\methodobject.c @ 251]
07 06fed08c 77e19407 086da238 08695488 00000002 python36!_PyCFunction_FastCallKeywords+0x3e [c:\build\cpython36\objects\methodobject.c @ 295]
08 06fed0bc 77e14d10 00000000 08695340 086d64dc python36!call_function+0xf7 [c:\build\cpython36\python\ceval.c @ 4788]
09 06fed13c 77e1951a 08695340 00000000 00000002 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
0a (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x10 [c:\build\cpython36\python\ceval.c @ 718]
0b 06fed158 77e19591 00000002 086af480 086c5030 python36!_PyFunction_FastCall+0x5a [c:\build\cpython36\python\ceval.c @ 4872]
0c 06fed17c 77e19467 00000002 00000000 00000083 python36!fast_function+0x51 [c:\build\cpython36\python\ceval.c @ 4905]
0d 06fed1a4 77e14d10 00000000 086d6380 086d633c python36!call_function+0x157 [c:\build\cpython36\python\ceval.c @ 4809]
0e 06fed224 77e1951a 086d6380 00000000 00000002 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
0f (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x10 [c:\build\cpython36\python\ceval.c @ 718]
10 06fed240 77e19591 00000002 086af480 086c5078 python36!_PyFunction_FastCall+0x5a [c:\build\cpython36\python\ceval.c @ 4872]
11 06fed264 77e19467 00000002 00000000 00000083 python36!fast_function+0x51 [c:\build\cpython36\python\ceval.c @ 4905]
12 06fed28c 77e14d10 00000000 086b3808 086d61d8 python36!call_function+0x157 [c:\build\cpython36\python\ceval.c @ 4809]
13 06fed308 77e185a5 086d61d8 00000000 086c50c0 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
14 (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x13 [c:\build\cpython36\python\ceval.c @ 718]
15 06fed354 77e19614 00000000 0865d56c 00000004 python36!_PyEval_EvalCodeWithName+0x735 [c:\build\cpython36\python\ceval.c @ 4119]
16 06fed3a4 77e19467 00000004 00000002 00000083 python36!fast_function+0xd4 [c:\build\cpython36\python\ceval.c @ 4929]
17 06fed3cc 77e14d10 00000000 0869ef98 0865d400 python36!call_function+0x157 [c:\build\cpython36\python\ceval.c @ 4809]
18 06fed448 77e185a5 0865d400 00000000 086a9db0 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
19 (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x13 [c:\build\cpython36\python\ceval.c @ 718]
1a 06fed494 77e19614 00000000 08701670 00000002 python36!_PyEval_EvalCodeWithName+0x735 [c:\build\cpython36\python\ceval.c @ 4119]
1b 06fed4e4 77e19467 00000002 00000001 00000083 python36!fast_function+0xd4 [c:\build\cpython36\python\ceval.c @ 4929]
1c 06fed50c 77e14d10 00000000 08701510 08701324 python36!call_function+0x157 [c:\build\cpython36\python\ceval.c @ 4809]
1d 06fed58c 77e1951a 08701510 00000000 00000002 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
1e (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x10 [c:\build\cpython36\python\ceval.c @ 718]
1f 06fed5a8 77e19591 00000002 086a2420 086a9e40 python36!_PyFunction_FastCall+0x5a [c:\build\cpython36\python\ceval.c @ 4872]
20 06fed5cc 77e19467 00000002 00000000 00000083 python36!fast_function+0x51 [c:\build\cpython36\python\ceval.c @ 4905]
21 06fed5f4 77e14d10 00000000 087011d0 06fed718 python36!call_function+0x157 [c:\build\cpython36\python\ceval.c @ 4809]
22 06fed670 77e1951a 087011d0 00000000 086a9e88 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
23 (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x10 [c:\build\cpython36\python\ceval.c @ 718]
24 06fed68c 77e1969d 00000002 086a2420 086a9e88 python36!_PyFunction_FastCall+0x5a [c:\build\cpython36\python\ceval.c @ 4872]
25 06fed6c4 77d772d1 086a9e88 06fed710 00000002 python36!_PyFunction_FastCallDict+0x5d [c:\build\cpython36\python\ceval.c @ 4972]
26 06fed6e8 77d77d53 086a9e88 06fed710 00000002 python36!_PyObject_FastCallDict+0x61 [c:\build\cpython36\objects\abstract.c @ 2295]
27 06fed72c 77e32d86 086a23f0 77fbacc4 086dc020 python36!_PyObject_CallMethodIdObjArgs+0xa3 [c:\build\cpython36\objects\abstract.c @ 2780]
28 06fed76c 77e1018a 086dc020 00000000 00000000 python36!PyImport_ImportModuleLevelObject+0x236 [c:\build\cpython36\python\import.c @ 1592]
29 06fed79c 77db3596 0867c480 087118d0 00000000 python36!builtin___import__+0x6a [c:\build\cpython36\python\bltinmodule.c @ 231]
2a 06fed7c8 77db370e 77e10120 086a7c30 00000001 python36!_PyCFunction_FastCallDict+0x166 [c:\build\cpython36\objects\methodobject.c @ 231]
2b 06fed7ec 77e19407 08678b20 086a7c30 00000001 python36!_PyCFunction_FastCallKeywords+0x3e [c:\build\cpython36\objects\methodobject.c @ 295]
2c 06fed81c 77e14d10 00000000 08763498 086a7af0 python36!call_function+0xf7 [c:\build\cpython36\python\ceval.c @ 4788]
2d 06fed898 77e185a5 086a7af0 00000000 08763498 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
2e (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x13 [c:\build\cpython36\python\ceval.c @ 718]
2f 06fed8e4 77e52ac6 086db960 00000000 00000000 python36!_PyEval_EvalCodeWithName+0x735 [c:\build\cpython36\python\ceval.c @ 4119]
30 (Inline) -------- -------- -------- -------- python36!PyEval_EvalCodeEx+0x25 [c:\build\cpython36\python\ceval.c @ 4140]
31 (Inline) -------- -------- -------- -------- python36!PyEval_EvalCode+0x25 [c:\build\cpython36\python\ceval.c @ 695]
32 06fed928 77e528a7 086db960 086db960 00000000 python36!run_mod+0x46 [c:\build\cpython36\python\pythonrun.c @ 980]
33 06fed94c 77e53956 51e8bae4 00000101 086db960 python36!PyRun_StringFlags+0xa7 [c:\build\cpython36\python\pythonrun.c @ 904]
*** WARNING: Unable to verify checksum for C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\winext\pykd.dll
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\winext\pykd.dll -
34 06fed968 51e5c007 51e8bae4 00000101 086db960 python36!PyRun_String+0x16 [c:\build\cpython36\python\pythonrun.c @ 1510]
WARNING: Stack unwind information not available. Following frames may be wrong.
35 06fed9a0 51e5ae2e 51e62410 08407cd8 00000000 pykd+0xc007
36 06fed9c0 775d65be 00000000 08407cd8 00000000 pykd+0xae2e
37 06fed9d8 775d6fa6 00000000 00000001 08407cd8 dbgeng!ExtensionInfo::Unload+0x77
38 06fed9f4 775d558f 00000001 169b75fe 04733b10 dbgeng!ExtensionInfo::Delete+0x1f
39 06fede50 7760e8d3 00000000 00000000 00000000 dbgeng!ParseBangCmd+0x3a1
3a 06fedecc 7760f712 169b7482 04733b10 00000001 dbgeng!ProcessCommands+0x816
3b 06fedf2c 7755e0cf 00000000 169b483a 00000000 dbgeng!ProcessCommandsAndCatch+0xad
3c 06fee394 7755e2a8 0000000a 00000000 169b4876 dbgeng!Execute+0x247
3d 06fee3d8 00134bd7 04733b18 00000001 06fee7b8 dbgeng!DebugClient::ExecuteWide+0x68
3e 06fee794 00135068 ffffffff 00000008 ffffff00 windbg!ProcessCommand+0x12f
3f 06fef7b0 001372d1 65386ba8 00136d60 00136d60 windbg!ProcessEngineCommands+0xd0
40 06fef7ec 75938744 00000000 75938720 96b05a2a windbg!EngineLoop+0x571
41 06fef800 76f22de6 00000000 54905a86 00000000 KERNEL32!BaseThreadInitThunk+0x24
42 06fef848 76f22db6 ffffffff 76f44749 00000000 ntdll!__RtlUserThreadStart+0x2f
43 06fef858 00000000 00136d60 00000000 00000000 ntdll!_RtlUserThreadStart+0x1b

```

Commented Unassigned: pykd 0.3.2.0 crashes python 3.6.0 on unload [14074]

$
0
0
Initialializing pykd (e.g. by starting and quitting and interactive session immediately) and then unloading it again will crash windbg.

The point of the crash is here: https://github.com/python/cpython/blob/3.6/Python/ceval_gil.h#L175

So something funky must be happening with the GIL.

Python version: Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32

Stack trace of the crash:
```
# ChildEBP RetAddr Args to Child
00 06fecf98 77e3bb6b 00720064 0070006f 0067005f ucrtbase!abort+0x4b
01 06fecfec 77e138e6 77f4e3f4 084fd298 77e0145e python36!Py_FatalError+0xfb [c:\build\cpython36\python\pylifecycle.c @ 1457]
02 06fecff8 77e0145e 00000000 086da238 00000002 python36!drop_gil+0x16 [c:\build\cpython36\python\ceval_gil.h @ 175]
03 (Inline) -------- -------- -------- -------- python36!PyEval_SaveThread+0x34 [c:\build\cpython36\python\ceval.c @ 355]
04 06fed014 77dfffc4 08763288 00000000 00020019 python36!winreg_OpenKey_impl+0x3e [c:\build\cpython36\pc\winreg.c @ 1317]
05 06fed038 77db35d5 086d0d50 08695488 00000002 python36!winreg_OpenKey+0x54 [c:\build\cpython36\pc\clinic\winreg.c.h @ 645]
06 06fed068 77db370e 77dfff70 08695488 00000002 python36!_PyCFunction_FastCallDict+0x1a5 [c:\build\cpython36\objects\methodobject.c @ 251]
07 06fed08c 77e19407 086da238 08695488 00000002 python36!_PyCFunction_FastCallKeywords+0x3e [c:\build\cpython36\objects\methodobject.c @ 295]
08 06fed0bc 77e14d10 00000000 08695340 086d64dc python36!call_function+0xf7 [c:\build\cpython36\python\ceval.c @ 4788]
09 06fed13c 77e1951a 08695340 00000000 00000002 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
0a (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x10 [c:\build\cpython36\python\ceval.c @ 718]
0b 06fed158 77e19591 00000002 086af480 086c5030 python36!_PyFunction_FastCall+0x5a [c:\build\cpython36\python\ceval.c @ 4872]
0c 06fed17c 77e19467 00000002 00000000 00000083 python36!fast_function+0x51 [c:\build\cpython36\python\ceval.c @ 4905]
0d 06fed1a4 77e14d10 00000000 086d6380 086d633c python36!call_function+0x157 [c:\build\cpython36\python\ceval.c @ 4809]
0e 06fed224 77e1951a 086d6380 00000000 00000002 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
0f (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x10 [c:\build\cpython36\python\ceval.c @ 718]
10 06fed240 77e19591 00000002 086af480 086c5078 python36!_PyFunction_FastCall+0x5a [c:\build\cpython36\python\ceval.c @ 4872]
11 06fed264 77e19467 00000002 00000000 00000083 python36!fast_function+0x51 [c:\build\cpython36\python\ceval.c @ 4905]
12 06fed28c 77e14d10 00000000 086b3808 086d61d8 python36!call_function+0x157 [c:\build\cpython36\python\ceval.c @ 4809]
13 06fed308 77e185a5 086d61d8 00000000 086c50c0 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
14 (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x13 [c:\build\cpython36\python\ceval.c @ 718]
15 06fed354 77e19614 00000000 0865d56c 00000004 python36!_PyEval_EvalCodeWithName+0x735 [c:\build\cpython36\python\ceval.c @ 4119]
16 06fed3a4 77e19467 00000004 00000002 00000083 python36!fast_function+0xd4 [c:\build\cpython36\python\ceval.c @ 4929]
17 06fed3cc 77e14d10 00000000 0869ef98 0865d400 python36!call_function+0x157 [c:\build\cpython36\python\ceval.c @ 4809]
18 06fed448 77e185a5 0865d400 00000000 086a9db0 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
19 (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x13 [c:\build\cpython36\python\ceval.c @ 718]
1a 06fed494 77e19614 00000000 08701670 00000002 python36!_PyEval_EvalCodeWithName+0x735 [c:\build\cpython36\python\ceval.c @ 4119]
1b 06fed4e4 77e19467 00000002 00000001 00000083 python36!fast_function+0xd4 [c:\build\cpython36\python\ceval.c @ 4929]
1c 06fed50c 77e14d10 00000000 08701510 08701324 python36!call_function+0x157 [c:\build\cpython36\python\ceval.c @ 4809]
1d 06fed58c 77e1951a 08701510 00000000 00000002 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
1e (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x10 [c:\build\cpython36\python\ceval.c @ 718]
1f 06fed5a8 77e19591 00000002 086a2420 086a9e40 python36!_PyFunction_FastCall+0x5a [c:\build\cpython36\python\ceval.c @ 4872]
20 06fed5cc 77e19467 00000002 00000000 00000083 python36!fast_function+0x51 [c:\build\cpython36\python\ceval.c @ 4905]
21 06fed5f4 77e14d10 00000000 087011d0 06fed718 python36!call_function+0x157 [c:\build\cpython36\python\ceval.c @ 4809]
22 06fed670 77e1951a 087011d0 00000000 086a9e88 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
23 (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x10 [c:\build\cpython36\python\ceval.c @ 718]
24 06fed68c 77e1969d 00000002 086a2420 086a9e88 python36!_PyFunction_FastCall+0x5a [c:\build\cpython36\python\ceval.c @ 4872]
25 06fed6c4 77d772d1 086a9e88 06fed710 00000002 python36!_PyFunction_FastCallDict+0x5d [c:\build\cpython36\python\ceval.c @ 4972]
26 06fed6e8 77d77d53 086a9e88 06fed710 00000002 python36!_PyObject_FastCallDict+0x61 [c:\build\cpython36\objects\abstract.c @ 2295]
27 06fed72c 77e32d86 086a23f0 77fbacc4 086dc020 python36!_PyObject_CallMethodIdObjArgs+0xa3 [c:\build\cpython36\objects\abstract.c @ 2780]
28 06fed76c 77e1018a 086dc020 00000000 00000000 python36!PyImport_ImportModuleLevelObject+0x236 [c:\build\cpython36\python\import.c @ 1592]
29 06fed79c 77db3596 0867c480 087118d0 00000000 python36!builtin___import__+0x6a [c:\build\cpython36\python\bltinmodule.c @ 231]
2a 06fed7c8 77db370e 77e10120 086a7c30 00000001 python36!_PyCFunction_FastCallDict+0x166 [c:\build\cpython36\objects\methodobject.c @ 231]
2b 06fed7ec 77e19407 08678b20 086a7c30 00000001 python36!_PyCFunction_FastCallKeywords+0x3e [c:\build\cpython36\objects\methodobject.c @ 295]
2c 06fed81c 77e14d10 00000000 08763498 086a7af0 python36!call_function+0xf7 [c:\build\cpython36\python\ceval.c @ 4788]
2d 06fed898 77e185a5 086a7af0 00000000 08763498 python36!_PyEval_EvalFrameDefault+0xae0 [c:\build\cpython36\python\ceval.c @ 3277]
2e (Inline) -------- -------- -------- -------- python36!PyEval_EvalFrameEx+0x13 [c:\build\cpython36\python\ceval.c @ 718]
2f 06fed8e4 77e52ac6 086db960 00000000 00000000 python36!_PyEval_EvalCodeWithName+0x735 [c:\build\cpython36\python\ceval.c @ 4119]
30 (Inline) -------- -------- -------- -------- python36!PyEval_EvalCodeEx+0x25 [c:\build\cpython36\python\ceval.c @ 4140]
31 (Inline) -------- -------- -------- -------- python36!PyEval_EvalCode+0x25 [c:\build\cpython36\python\ceval.c @ 695]
32 06fed928 77e528a7 086db960 086db960 00000000 python36!run_mod+0x46 [c:\build\cpython36\python\pythonrun.c @ 980]
33 06fed94c 77e53956 51e8bae4 00000101 086db960 python36!PyRun_StringFlags+0xa7 [c:\build\cpython36\python\pythonrun.c @ 904]
*** WARNING: Unable to verify checksum for C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\winext\pykd.dll
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\winext\pykd.dll -
34 06fed968 51e5c007 51e8bae4 00000101 086db960 python36!PyRun_String+0x16 [c:\build\cpython36\python\pythonrun.c @ 1510]
WARNING: Stack unwind information not available. Following frames may be wrong.
35 06fed9a0 51e5ae2e 51e62410 08407cd8 00000000 pykd+0xc007
36 06fed9c0 775d65be 00000000 08407cd8 00000000 pykd+0xae2e
37 06fed9d8 775d6fa6 00000000 00000001 08407cd8 dbgeng!ExtensionInfo::Unload+0x77
38 06fed9f4 775d558f 00000001 169b75fe 04733b10 dbgeng!ExtensionInfo::Delete+0x1f
39 06fede50 7760e8d3 00000000 00000000 00000000 dbgeng!ParseBangCmd+0x3a1
3a 06fedecc 7760f712 169b7482 04733b10 00000001 dbgeng!ProcessCommands+0x816
3b 06fedf2c 7755e0cf 00000000 169b483a 00000000 dbgeng!ProcessCommandsAndCatch+0xad
3c 06fee394 7755e2a8 0000000a 00000000 169b4876 dbgeng!Execute+0x247
3d 06fee3d8 00134bd7 04733b18 00000001 06fee7b8 dbgeng!DebugClient::ExecuteWide+0x68
3e 06fee794 00135068 ffffffff 00000008 ffffff00 windbg!ProcessCommand+0x12f
3f 06fef7b0 001372d1 65386ba8 00136d60 00136d60 windbg!ProcessEngineCommands+0xd0
40 06fef7ec 75938744 00000000 75938720 96b05a2a windbg!EngineLoop+0x571
41 06fef800 76f22de6 00000000 54905a86 00000000 KERNEL32!BaseThreadInitThunk+0x24
42 06fef848 76f22db6 ffffffff 76f44749 00000000 ntdll!__RtlUserThreadStart+0x2f
43 06fef858 00000000 00136d60 00000000 00000000 ntdll!_RtlUserThreadStart+0x1b

```
Comments: ** Comment from web user: ussrhero **

Do you use pykd_bootstrapper (http://pykd.codeplex.com/releases/view/624814) to run python ?
Is the bug reproduced with the last pykd_bootstrapper version ?

Viewing all 1625 articles
Browse latest View live


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