Skip to content

Commit f298ef4

Browse files
authored
Merge pull request #1411 from fredriss/fix-SIGWINCH-crash
[lldb] Fix that SIGWINCH crashes IOHandlerEditline when we are not us…
2 parents 2137d5b + 1974241 commit f298ef4

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

lldb/source/Core/IOHandler.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ void IOHandlerEditline::Deactivate() {
289289

290290
void IOHandlerEditline::TerminalSizeChanged() {
291291
#if LLDB_ENABLE_LIBEDIT
292-
m_editline_up->TerminalSizeChanged();
292+
if (m_editline_up)
293+
m_editline_up->TerminalSizeChanged();
293294
#endif
294295
}
295296

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import lldb
2+
from lldbsuite.test.decorators import *
3+
from lldbsuite.test.lldbtest import *
4+
from lldbsuite.test import lldbutil
5+
6+
class TestCase(TestBase):
7+
8+
mydir = TestBase.compute_mydir(__file__)
9+
10+
@no_debug_info_test
11+
def test_resize_no_editline(self):
12+
""" Tests terminal resizing if the editline isn't used. """
13+
dbg = lldb.SBDebugger.Create(False)
14+
# Set the input handle to some stream so that we don't start the
15+
# editline interface.
16+
dbg.SetInputFileHandle(io.BytesIO(b""), True)
17+
opts = lldb.SBCommandInterpreterRunOptions()
18+
# Launch the command interpreter now.
19+
dbg.RunCommandInterpreter(True, True, opts, 0, False, False)
20+
# Try resizing the terminal which shouldn't crash.
21+
dbg.SetTerminalWidth(47)

0 commit comments

Comments
 (0)