diff options
author | Tom Tromey <tom@tromey.com> | 2020-06-16 17:48:38 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-06-16 17:48:38 -0600 |
commit | d2d1ea20aef6ed97232280b5e15a52b8d7dc7b7d (patch) | |
tree | 30e0ff51dbd59c6b7b7fefcf73c8b3c46e2fc8ec /gdb/testsuite/gdb.python | |
parent | 708a2ffff5cc2d280968a6b28268d8276d391bb4 (diff) | |
download | gdb-d2d1ea20aef6ed97232280b5e15a52b8d7dc7b7d.zip gdb-d2d1ea20aef6ed97232280b5e15a52b8d7dc7b7d.tar.gz gdb-d2d1ea20aef6ed97232280b5e15a52b8d7dc7b7d.tar.bz2 |
Fix crash when TUI window creation fails
If a TUI window is written in Python, and if the window construction
function fails, then gdb will crash. This patch fixes the crash.
gdb/ChangeLog
2020-06-16 Tom Tromey <tom@tromey.com>
* python/py-tui.c (tui_py_window::~tui_py_window): Handle case
where m_window==nullptr.
gdb/testsuite/ChangeLog
2020-06-16 Tom Tromey <tom@tromey.com>
* gdb.python/tui-window.py (failwin): New function. Register it
as a TUI window type.
* gdb.python/tui-window.exp: Create new "fail" layout. Test it.
Diffstat (limited to 'gdb/testsuite/gdb.python')
-rw-r--r-- | gdb/testsuite/gdb.python/tui-window.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/tui-window.py | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/tui-window.exp b/gdb/testsuite/gdb.python/tui-window.exp index 503823a..f0fdd96 100644 --- a/gdb/testsuite/gdb.python/tui-window.exp +++ b/gdb/testsuite/gdb.python/tui-window.exp @@ -36,6 +36,7 @@ gdb_test_no_output "source ${remote_python_file}" \ "source ${testfile}.py" gdb_test_no_output "tui new-layout test test 1 status 0 cmd 1" +gdb_test_no_output "tui new-layout fail fail 1 status 0 cmd 1" if {![Term::enter_tui]} { unsupported "TUI not supported" @@ -49,3 +50,5 @@ Term::check_contents "Window display" "Test: 0" Term::resize 51 51 # Remember that a resize request actually does two resizes... Term::check_contents "Window was updated" "Test: 2" + +Term::command "layout fail" diff --git a/gdb/testsuite/gdb.python/tui-window.py b/gdb/testsuite/gdb.python/tui-window.py index 4deb585..f362b87 100644 --- a/gdb/testsuite/gdb.python/tui-window.py +++ b/gdb/testsuite/gdb.python/tui-window.py @@ -35,3 +35,9 @@ class TestWindow: self.count = self.count + 1 gdb.register_window_type("test", TestWindow) + +# A TUI window "constructor" that always fails. +def failwin(win): + raise RuntimeError("Whoops") + +gdb.register_window_type("fail", failwin) |