Skip to content

[lldb] Fix that SIGWINCH crashes IOHandlerEditline when we are not us… #1411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lldb/source/Core/IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ void IOHandlerEditline::Deactivate() {

void IOHandlerEditline::TerminalSizeChanged() {
#if LLDB_ENABLE_LIBEDIT
m_editline_up->TerminalSizeChanged();
if (m_editline_up)
m_editline_up->TerminalSizeChanged();
#endif
}

Expand Down
21 changes: 21 additions & 0 deletions lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil

class TestCase(TestBase):

mydir = TestBase.compute_mydir(__file__)

@no_debug_info_test
def test_resize_no_editline(self):
""" Tests terminal resizing if the editline isn't used. """
dbg = lldb.SBDebugger.Create(False)
# Set the input handle to some stream so that we don't start the
# editline interface.
dbg.SetInputFileHandle(io.BytesIO(b""), True)
opts = lldb.SBCommandInterpreterRunOptions()
# Launch the command interpreter now.
dbg.RunCommandInterpreter(True, True, opts, 0, False, False)
# Try resizing the terminal which shouldn't crash.
dbg.SetTerminalWidth(47)