xiaobai updated this revision to Diff 97553.
xiaobai added a comment.
Updating per @labath's suggestions
https://reviews.llvm.org/D32421
Files:
packages/Python/lldbsuite/test/functionalities/print/TestPrintEmptyExpressionList.py
source/Host/common/Editline.cpp
Index: source/Host/common/Editline.cpp
===================================================================
--- source/Host/common/Editline.cpp
+++ source/Host/common/Editline.cpp
@@ -367,7 +367,7 @@
if (to == CursorLocation::EditingCursor) {
toColumn =
editline_cursor_position - (editline_cursor_row * m_terminal_width) +
1;
- } else if (to == CursorLocation::BlockEnd) {
+ } else if (to == CursorLocation::BlockEnd && !m_input_lines.empty()) {
toColumn =
((m_input_lines[m_input_lines.size() - 1].length() + GetPromptWidth())
%
80) +
Index:
packages/Python/lldbsuite/test/functionalities/print/TestPrintEmptyExpressionList.py
===================================================================
--- /dev/null
+++
packages/Python/lldbsuite/test/functionalities/print/TestPrintEmptyExpressionList.py
@@ -0,0 +1,35 @@
+"""Test printing an empty list of expressions"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class PrintEmptyExpressionListCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def test_print_empty_list_expressions(self):
+ """Test printing an empty list of expressions"""
+ import pexpect
+ prompt = "(lldb) "
+
+ # This is so the child is torn down after the test.
+ self.child = pexpect.spawn(
+ "%s %s" %
+ (lldbtest_config.lldbExec, self.lldbOption))
+ child = self.child
+
+ # Turn on logging to see what the child sends back.
+ if self.TraceOn():
+ child.logfile_read = sys.stdout
+
+ # We expect a prompt, then send "print" to start a list of expressions,
+ # then an empty line. We expect a prompt back.
+ child.expect_exact(prompt)
+ child.sendline("print")
+ child.sendline("\n")
+ child.expect_exact(prompt)
Index: source/Host/common/Editline.cpp
===================================================================
--- source/Host/common/Editline.cpp
+++ source/Host/common/Editline.cpp
@@ -367,7 +367,7 @@
if (to == CursorLocation::EditingCursor) {
toColumn =
editline_cursor_position - (editline_cursor_row * m_terminal_width) + 1;
- } else if (to == CursorLocation::BlockEnd) {
+ } else if (to == CursorLocation::BlockEnd && !m_input_lines.empty()) {
toColumn =
((m_input_lines[m_input_lines.size() - 1].length() + GetPromptWidth()) %
80) +
Index: packages/Python/lldbsuite/test/functionalities/print/TestPrintEmptyExpressionList.py
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/print/TestPrintEmptyExpressionList.py
@@ -0,0 +1,35 @@
+"""Test printing an empty list of expressions"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class PrintEmptyExpressionListCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def test_print_empty_list_expressions(self):
+ """Test printing an empty list of expressions"""
+ import pexpect
+ prompt = "(lldb) "
+
+ # This is so the child is torn down after the test.
+ self.child = pexpect.spawn(
+ "%s %s" %
+ (lldbtest_config.lldbExec, self.lldbOption))
+ child = self.child
+
+ # Turn on logging to see what the child sends back.
+ if self.TraceOn():
+ child.logfile_read = sys.stdout
+
+ # We expect a prompt, then send "print" to start a list of expressions,
+ # then an empty line. We expect a prompt back.
+ child.expect_exact(prompt)
+ child.sendline("print")
+ child.sendline("\n")
+ child.expect_exact(prompt)
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits