From 4dc6f73c5ac6278f76b0104bf5b1ab561384b20b Mon Sep 17 00:00:00 2001
From: "SND\\kernelnet_cp"
 <SND\kernelnet_cp@9b283d60-5439-405e-af05-b73fd8c4d996>
Date: Wed, 28 Sep 2011 13:14:01 +0000
Subject: [PATCH] [pykd] fixed: issue 9560 ( dbgCommand truncates long output
 string )

git-svn-id: https://pykd.svn.codeplex.com/svn@70097 9b283d60-5439-405e-af05-b73fd8c4d996
---
 pykd/dbgio.cpp | 38 ++++++++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/pykd/dbgio.cpp b/pykd/dbgio.cpp
index a3e3a51..bf9944a 100644
--- a/pykd/dbgio.cpp
+++ b/pykd/dbgio.cpp
@@ -14,9 +14,22 @@ void dbgPrint::dprint( const boost::python::object& obj, bool dml )
 {
     std::wstring   str = boost::python::extract<std::wstring>( obj );
 
-    HRESULT  hres = dbgExt->control4->ControlledOutputWide(  dml ? DEBUG_OUTCTL_AMBIENT_DML : DEBUG_OUTCTL_AMBIENT_TEXT, DEBUG_OUTPUT_NORMAL, L"%ws", str.c_str() );
-   
-    std::wcout << str;
+    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;
+    }
 }
 
 /////////////////////////////////////////////////////////////////////////////////
@@ -24,10 +37,23 @@ void dbgPrint::dprint( const boost::python::object& obj, bool dml )
 void dbgPrint::dprintln( const boost::python::object& obj, bool dml  )
 {
     std::wstring   str = boost::python::extract<std::wstring>( obj );
+    str += L"\r\n";
 
-    dbgExt->control4->ControlledOutputWide(  dml ? DEBUG_OUTCTL_AMBIENT_DML : DEBUG_OUTCTL_AMBIENT_TEXT, DEBUG_OUTPUT_NORMAL, L"%ws\r\n", str.c_str() );
-    
-    std::wcout << str;    
+    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;
+    }
 }
 
 /////////////////////////////////////////////////////////////////////////////////