[!] bug fixed: issue #7697 ( raw_input does not work )

git-svn-id: https://pykd.svn.codeplex.com/svn@57920 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2010-11-22 07:47:59 +00:00
parent 55040a78e3
commit 2599f9885f
2 changed files with 70 additions and 1 deletions

View File

@ -42,7 +42,19 @@ class WindbgGlobalSession
public:
WindbgGlobalSession() {
boost::python::import( "pykd" );
main = boost::python::import("__main__");
// ïåðåíàïðàâëåíèå ñòàíäàðòíûõ ïîòîêîâ ÂÂ
boost::python::object sys = boost::python::import( "sys");
dbgOut dout;
sys.attr("stdout") = boost::python::object( dout );
dbgIn din;
sys.attr("stdin") = boost::python::object( din );
}
boost::python::object
@ -217,11 +229,20 @@ py( PDEBUG_CLIENT4 client, PCSTR args)
SetupDebugEngine( client, &ext );
dbgExt = &ext;
boost::python::import( "pykd" );
boost::python::object main = boost::python::import("__main__");
boost::python::object global(main.attr("__dict__"));
// ïåðåíàïðàâëåíèå ñòàíäàðòíûõ ïîòîêîâ ÂÂ
boost::python::object sys = boost::python::import( "sys");
dbgOut dout;
sys.attr("stdout") = boost::python::object( dout );
boost::python::object result;
dbgIn din;
sys.attr("stdin") = boost::python::object( din );
// ðàçáîð ïàðàìåòðîâ
typedef boost::escaped_list_separator<char> char_separator_t;
@ -274,6 +295,8 @@ py( PDEBUG_CLIENT4 client, PCSTR args)
SetCurrentDirectoryA( filePath.c_str() );
try {
boost::python::object result;
result = boost::python::exec_file( fullFileName.c_str(), global, global );

46
pykd/dbginput.h Normal file
View File

@ -0,0 +1,46 @@
#pragma once
#include "dbgprint.h"
/////////////////////////////////////////////////////////////////////////////////
class dbgOut {
public:
void
write( const std::string& str ) {
DbgPrint::dprint( str );
}
private:
};
/////////////////////////////////////////////////////////////////////////////////
class dbgIn {
public:
std::string
readline() {
char str[100];
ULONG inputSize;
OutputReader outputReader( dbgExt->client );
dbgExt->control->Input( str, sizeof(str), &inputSize );
return std::string( str );
}
private:
};
/////////////////////////////////////////////////////////////////////////////////