Index: lldb/packages/Python/lldbsuite/test/lldbpexpect.py =================================================================== --- lldb/packages/Python/lldbsuite/test/lldbpexpect.py +++ lldb/packages/Python/lldbsuite/test/lldbpexpect.py @@ -27,7 +27,8 @@ def expect_prompt(self): self.child.expect_exact(self.PROMPT) - def launch(self, executable=None, extra_args=None, timeout=30, dimensions=None): + def launch(self, executable=None, extra_args=None, timeout=30, dimensions=None, + term_env_var="vt100"): logfile = getattr(sys.stdout, 'buffer', sys.stdout) if self.TraceOn() else None @@ -40,7 +41,7 @@ args.extend(extra_args) env = dict(os.environ) - env["TERM"]="vt100" + env["TERM"]=term_env_var self.child = pexpect.spawn( lldbtest_config.lldbExec, args=args, logfile=logfile, Index: lldb/source/Core/IOHandler.cpp =================================================================== --- lldb/source/Core/IOHandler.cpp +++ lldb/source/Core/IOHandler.cpp @@ -251,6 +251,9 @@ use_editline = GetInputFILE() && GetOutputFILE() && GetErrorFILE() && m_input_sp && m_input_sp->GetIsRealTerminal(); + // Don't use editline for dumb terms. + if (llvm::StringRef(getenv("TERM")) == "dumb") + use_editline = false; if (use_editline) { m_editline_up.reset(new Editline(editline_name, GetInputFILE(), @@ -291,7 +294,8 @@ void IOHandlerEditline::TerminalSizeChanged() { #if LLDB_ENABLE_LIBEDIT - m_editline_up->TerminalSizeChanged(); + if (m_editline_up) + m_editline_up->TerminalSizeChanged(); #endif } Index: lldb/test/API/iohandler/sigwinch/TestIOHandlerSigwinch.py =================================================================== --- /dev/null +++ lldb/test/API/iohandler/sigwinch/TestIOHandlerSigwinch.py @@ -0,0 +1,25 @@ +""" +Test SIGWINCH handling. +""" + +import os + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test.lldbpexpect import PExpectTest + +class TestCase(PExpectTest): + + mydir = TestBase.compute_mydir(__file__) + + # PExpect uses many timeouts internally and doesn't play well + # under ASAN on a loaded machine.. + @skipIfAsan + def test_sigwinch_dumb_term(self): + self.launch(term_env_var="dumb") + os.kill(self.child.pid, signal.SIGWINCH) + # Check that LLDB didn't crash. + self.expect("help", substrs=["Current command abbreviations"]) + + self.quit()