From afef49267adaf5fdce55a834b20fc4947c4f9868 Mon Sep 17 00:00:00 2001 From: Ilia K Date: Fri, 24 Apr 2015 11:33:36 +0000 Subject: [PATCH] Fix CMICmnLLDBDebuggerHandleEvents::GetProcessStdout/GetProcessStderr to use stream-record (MI) llvm-svn: 235711 --- lldb/test/tools/lldb-mi/TestMiGdbSetShow.py | 6 +++--- lldb/test/tools/lldb-mi/interpreter/TestMiCliSupport.py | 10 +++++----- lldb/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py | 10 +++++----- lldb/test/tools/lldb-mi/syntax/TestMiSyntax.py | 2 +- lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp | 10 ++++++---- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lldb/test/tools/lldb-mi/TestMiGdbSetShow.py b/lldb/test/tools/lldb-mi/TestMiGdbSetShow.py index f2e7e78..c683300 100644 --- a/lldb/test/tools/lldb-mi/TestMiGdbSetShow.py +++ b/lldb/test/tools/lldb-mi/TestMiGdbSetShow.py @@ -57,7 +57,7 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): # Test that program is executed in async mode self.runCmd("-exec-run") self.expect("\*running") - self.expect("~\"argc=1") + self.expect("@\"argc=1") @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") @@ -80,9 +80,9 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): # Test that program is executed in async mode self.runCmd("-exec-run") unexpected = [ "\*running" ] # "\*running" is async notification - it = self.expect(unexpected + [ "~\"argc=1\\\\r\\\\n" ]) + it = self.expect(unexpected + [ "@\"argc=1\\\\r\\\\n" ]) if it < len(unexpected): - # generate error if it's not "~\"argc=1\\\\r\\\\n" + # generate error if it's not "@\"argc=1\\\\r\\\\n" self.expect("$UNEXPECTED FOUND: %s\.^" % unexpected[it], timeout = 0) @lldbmi_test diff --git a/lldb/test/tools/lldb-mi/interpreter/TestMiCliSupport.py b/lldb/test/tools/lldb-mi/interpreter/TestMiCliSupport.py index 896b4ff..9a1a155 100644 --- a/lldb/test/tools/lldb-mi/interpreter/TestMiCliSupport.py +++ b/lldb/test/tools/lldb-mi/interpreter/TestMiCliSupport.py @@ -74,7 +74,7 @@ class MiCliSupportTestCase(lldbmi_testcase.MiTestCaseBase): self.expect("\^running") # Test that arguments were passed properly - self.expect("~\"argc=5\\\\r\\\\n\"") + self.expect("@\"argc=5\\\\r\\\\n\"") @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") @@ -99,7 +99,7 @@ class MiCliSupportTestCase(lldbmi_testcase.MiTestCaseBase): self.expect("\^running") # Test that arguments were passed properly - self.expect("~\"argc=5\\\\r\\\\n\"") + self.expect("@\"argc=5\\\\r\\\\n\"") @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") @@ -151,7 +151,7 @@ class MiCliSupportTestCase(lldbmi_testcase.MiTestCaseBase): # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\" self.runCmd("thread step-in") self.expect("\^done") - it = self.expect([ "~\"argc=1\\\\r\\\\n\"", + it = self.expect([ "@\"argc=1\\\\r\\\\n\"", "\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\"" ]) if it == 0: self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"") @@ -179,7 +179,7 @@ class MiCliSupportTestCase(lldbmi_testcase.MiTestCaseBase): # Test that "thread step-over" steps over self.runCmd("thread step-over") self.expect("\^done") - self.expect("~\"argc=1\\\\r\\\\n\"") + self.expect("@\"argc=1\\\\r\\\\n\"") self.expect("\*stopped,reason=\"end-stepping-range\"") @lldbmi_test @@ -205,7 +205,7 @@ class MiCliSupportTestCase(lldbmi_testcase.MiTestCaseBase): # Test that "thread continue" continues execution self.runCmd("thread continue") self.expect("\^done") - self.expect("~\"argc=1\\\\r\\\\n") + self.expect("@\"argc=1\\\\r\\\\n") self.expect("\*stopped,reason=\"exited-normally\"") if __name__ == '__main__': diff --git a/lldb/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py b/lldb/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py index 9157a17..6ec2ea2 100644 --- a/lldb/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py +++ b/lldb/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py @@ -72,7 +72,7 @@ class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase): self.expect("\^running") # Test that arguments were passed properly - self.expect("~\"argc=2\\\\r\\\\n\"") + self.expect("@\"argc=2\\\\r\\\\n\"") @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") @@ -96,7 +96,7 @@ class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase): self.expect("\^running") # Test that arguments were passed properly - self.expect("~\"argc=2\\\\r\\\\n\"") + self.expect("@\"argc=2\\\\r\\\\n\"") @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") @@ -146,7 +146,7 @@ class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase): # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\" self.runCmd("-interpreter-exec console \"thread step-in\"") self.expect("\^done") - it = self.expect([ "~\"argc=1\\\\r\\\\n\"", + it = self.expect([ "@\"argc=1\\\\r\\\\n\"", "\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\"" ]) if it == 0: self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"") @@ -173,7 +173,7 @@ class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase): # Test that "thread step-over" steps over self.runCmd("-interpreter-exec console \"thread step-over\"") self.expect("\^done") - self.expect("~\"argc=1\\\\r\\\\n\"") + self.expect("@\"argc=1\\\\r\\\\n\"") self.expect("\*stopped,reason=\"end-stepping-range\"") @lldbmi_test @@ -198,7 +198,7 @@ class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase): # Test that "thread continue" continues execution self.runCmd("-interpreter-exec console \"thread continue\"") self.expect("\^done") - self.expect("~\"argc=1\\\\r\\\\n") + self.expect("@\"argc=1\\\\r\\\\n") self.expect("\*stopped,reason=\"exited-normally\"") if __name__ == '__main__': diff --git a/lldb/test/tools/lldb-mi/syntax/TestMiSyntax.py b/lldb/test/tools/lldb-mi/syntax/TestMiSyntax.py index d1e5cf5..1bcd79f 100644 --- a/lldb/test/tools/lldb-mi/syntax/TestMiSyntax.py +++ b/lldb/test/tools/lldb-mi/syntax/TestMiSyntax.py @@ -75,7 +75,7 @@ class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase): self.expect("\^running") # Test that a process output is wrapped correctly - self.expect("\~\"'\\\\r\\\\n` - it's \\\\\\\\n\\\\x12\\\\\"\\\\\\\\\\\\\"") + self.expect("\@\"'\\\\r\\\\n` - it's \\\\\\\\n\\\\x12\\\\\"\\\\\\\\\\\\\"") if __name__ == '__main__': unittest2.main() diff --git a/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp b/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp index c99aa5d..cc30e0a 100644 --- a/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp +++ b/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp @@ -1534,8 +1534,9 @@ CMICmnLLDBDebuggerHandleEvents::GetProcessStdout(void) return MIstatus::success; const bool bEscapeQuotes(true); - const CMIUtilString t(CMIUtilString::Format("~\"%s\"", text.Escape(bEscapeQuotes).c_str())); - return TextToStdout(t); + CMICmnMIValueConst miValueConst(text.Escape(bEscapeQuotes)); + CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_TargetStreamOutput, miValueConst); + return MiOutOfBandRecordToStdout(miOutOfBandRecord); } //++ ------------------------------------------------------------------------------------ @@ -1567,8 +1568,9 @@ CMICmnLLDBDebuggerHandleEvents::GetProcessStderr(void) return MIstatus::success; const bool bEscapeQuotes(true); - const CMIUtilString t(CMIUtilString::Format("~\"%s\"", text.Escape(bEscapeQuotes).c_str())); - return TextToStdout(t); + CMICmnMIValueConst miValueConst(text.Escape(bEscapeQuotes)); + CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_TargetStreamOutput, miValueConst); + return MiOutOfBandRecordToStdout(miOutOfBandRecord); } //++ ------------------------------------------------------------------------------------ -- 2.7.4