[0.2.x] added : IPython adaptation

git-svn-id: https://pykd.svn.codeplex.com/svn@85804 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2013-10-17 08:26:50 +00:00 committed by Mikhail I. Izmestev
parent ed00ec2b67
commit feb9e84a6e
4 changed files with 27 additions and 1 deletions

View File

@ -193,6 +193,10 @@ CALLBACK
py( PDEBUG_CLIENT4 client, PCSTR args ) py( PDEBUG_CLIENT4 client, PCSTR args )
{ {
ULONG mask = 0;
client->GetOutputMask( &mask );
client->SetOutputMask( mask & ~DEBUG_OUTPUT_PROMPT ); // óáðàòü ýõî ââîäà
WindbgGlobalSession::RestorePyState(); WindbgGlobalSession::RestorePyState();
PyThreadState *globalInterpreter = PyThreadState_Swap( NULL ); PyThreadState *globalInterpreter = PyThreadState_Swap( NULL );
@ -305,6 +309,8 @@ py( PDEBUG_CLIENT4 client, PCSTR args )
WindbgGlobalSession::SavePyState(); WindbgGlobalSession::SavePyState();
client->SetOutputMask( mask );
return S_OK; return S_OK;
} }

View File

@ -139,7 +139,8 @@ BOOST_PYTHON_MODULE( pykd )
python::class_<DbgErr>( "dout", "dout", python::no_init ) python::class_<DbgErr>( "dout", "dout", python::no_init )
.def( "write", &DbgErr::write ); .def( "write", &DbgErr::write );
python::class_<DbgIn>( "din", "din", python::no_init ) python::class_<DbgIn>( "din", "din", python::no_init )
.def( "readline", &DbgIn::readline ); .def( "readline", &DbgIn::readline )
.add_property( "encoding", &DbgIn::encoding );
// system properties // system properties
python::def( "ptrSize", &ptrSize, python::def( "ptrSize", &ptrSize,

View File

@ -44,6 +44,11 @@ public:
return dreadline(); return dreadline();
} }
std::string
encoding() {
return "ascii";
}
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

14
snippets/ipython.py Normal file
View File

@ -0,0 +1,14 @@
from IPython.config.loader import Config
from IPython.terminal.embed import InteractiveShellEmbed
from pykd import *
cfg = Config()
cfg.InteractiveShell.colors = 'NoColor'
cfg.PromptManager.in_template = 'In <\\#>: '
cfg.PromptManager.in2_template = ' .\\D.: '
cfg.PromptManager.out_template = 'Out<\\#>: '
ipshell = InteractiveShellEmbed(config=cfg)
ipshell()