mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 12:53:23 +08:00
[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:
parent
ed00ec2b67
commit
feb9e84a6e
@ -193,6 +193,10 @@ CALLBACK
|
||||
py( PDEBUG_CLIENT4 client, PCSTR args )
|
||||
{
|
||||
|
||||
ULONG mask = 0;
|
||||
client->GetOutputMask( &mask );
|
||||
client->SetOutputMask( mask & ~DEBUG_OUTPUT_PROMPT ); // óáðàòü ýõî ââîäà
|
||||
|
||||
WindbgGlobalSession::RestorePyState();
|
||||
|
||||
PyThreadState *globalInterpreter = PyThreadState_Swap( NULL );
|
||||
@ -305,6 +309,8 @@ py( PDEBUG_CLIENT4 client, PCSTR args )
|
||||
|
||||
WindbgGlobalSession::SavePyState();
|
||||
|
||||
client->SetOutputMask( mask );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,8 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
python::class_<DbgErr>( "dout", "dout", python::no_init )
|
||||
.def( "write", &DbgErr::write );
|
||||
python::class_<DbgIn>( "din", "din", python::no_init )
|
||||
.def( "readline", &DbgIn::readline );
|
||||
.def( "readline", &DbgIn::readline )
|
||||
.add_property( "encoding", &DbgIn::encoding );
|
||||
|
||||
// system properties
|
||||
python::def( "ptrSize", &ptrSize,
|
||||
|
@ -44,6 +44,11 @@ public:
|
||||
return dreadline();
|
||||
}
|
||||
|
||||
std::string
|
||||
encoding() {
|
||||
return "ascii";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
14
snippets/ipython.py
Normal file
14
snippets/ipython.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user