From b86f25f88e08e096854848c771a6ffe924963afe Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Mon, 3 Oct 2011 10:53:08 +0000 Subject: [PATCH] [0.1.x] brunched : dbgio.cpp git-svn-id: https://pykd.svn.codeplex.com/svn@70178 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/dbgio.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 pykd/dbgio.cpp diff --git a/pykd/dbgio.cpp b/pykd/dbgio.cpp new file mode 100644 index 0000000..bf9944a --- /dev/null +++ b/pykd/dbgio.cpp @@ -0,0 +1,59 @@ +#include "stdafx.h" + +#include +#include + +#include "dbgio.h" +#include "dbgext.h" + +using namespace std; + +///////////////////////////////////////////////////////////////////////////////// + +void dbgPrint::dprint( const boost::python::object& obj, bool dml ) +{ + std::wstring str = boost::python::extract( obj ); + + if ( isWindbgExt() ) + { + + for ( size_t i = 0; i < str.size() / 100 + 1; ++i ) + { + dbgExt->control4->ControlledOutputWide( + dml ? DEBUG_OUTCTL_AMBIENT_DML : DEBUG_OUTCTL_AMBIENT_TEXT, DEBUG_OUTPUT_NORMAL, + L"%ws", + str.substr( i*100, min( str.size() - i*100, 100 ) ).c_str() + ); + } + } + else + { + std::wcout << str; + } +} + +///////////////////////////////////////////////////////////////////////////////// + +void dbgPrint::dprintln( const boost::python::object& obj, bool dml ) +{ + std::wstring str = boost::python::extract( obj ); + str += L"\r\n"; + + if ( isWindbgExt() ) + { + for ( size_t i = 0; i < str.size() / 100 + 1; ++i ) + { + dbgExt->control4->ControlledOutputWide( + dml ? DEBUG_OUTCTL_AMBIENT_DML : DEBUG_OUTCTL_AMBIENT_TEXT, DEBUG_OUTPUT_NORMAL, + L"%ws", + str.substr( i*100, min( str.size() - i*100, 100 ) ).c_str() + ); + } + } + else + { + std::wcout << str; + } +} + +/////////////////////////////////////////////////////////////////////////////////