From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 2/3] [gdb/testsuite] Add gdb.tui/fatal.exp
Date: Fri, 16 Oct 2026 17:28:48 +0200 [thread overview]
Message-ID: <20261016152849.87694-3-tdevries@suse.de> (raw)
In-Reply-To: <20261016152849.87694-1-tdevries@suse.de>
Add test-case gdb.tui/fatal.exp, a test-case for the handle_fatal_signal part
of commit a4f8f290270 ("gdb/tui: disable tui mode when an assert triggers").
---
gdb/testsuite/gdb.tui/fatal.exp | 71 +++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 gdb/testsuite/gdb.tui/fatal.exp
diff --git a/gdb/testsuite/gdb.tui/fatal.exp b/gdb/testsuite/gdb.tui/fatal.exp
new file mode 100644
index 00000000000..3caf55ec4c3
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/fatal.exp
@@ -0,0 +1,71 @@
+# Copyright 2026 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check handling of abort in TUI.
+
+tuiterm_env
+require allow_tui_tests
+
+# This test-case produces a core file. Let's not do that remotely.
+require {!isremote host}
+
+# Check that we're able to use SIGABRT.
+require {remote_kill_spawn_id_p host SIGABRT}
+
+Term::clean_restart 24 80
+
+set have_backtrace_on_fatal_signal 0
+gdb_test_multiple "maint set backtrace-on-fatal-signal on" "" {
+ -re -wrap "support for this feature is not compiled into GDB" {
+ }
+ -re -wrap "^" {
+ set have_backtrace_on_fatal_signal 1
+ }
+}
+require {expr {$have_backtrace_on_fatal_signal}}
+
+# Get the GDB core into the output directory, so that it
+# doesn't count as unexpected core in gdb.sum.
+set dir [standard_output_file ""]
+gdb_test "cd $dir" "Working directory .*" \
+ "cd to test directory"
+
+require Term::enter_tui
+
+set gdb_pid [exp_pid -i $::gdb_spawn_id]
+
+kill_gdb SIGABRT
+
+set re_msg_line \
+ [string_to_regexp \
+ "This is a bug, please report it."]
+set re_msg \
+ [multi_line \
+ "" \
+ $re_msg_line]
+gdb_assert \
+ {[Term::wait_for_region_contents 0 0 80 24 $re_msg]} \
+ "saw message"
+
+set seen_eof 0
+gdb_expect {
+ eof {
+ set seen_eof 1
+ remove_core $gdb_pid
+ gdb_exit_cleanup
+ }
+}
+
+gdb_assert {$seen_eof} "aborted"
--
2.51.0
next prev parent reply other threads:[~2026-10-16 15:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 15:28 [pushed 0/3] [gdb/testsuite] Add some tui test-cases Tom de Vries
2026-10-16 15:28 ` [pushed 1/3] [gdb/testsuite] Handle non-existing testfile in find_core_file Tom de Vries
2026-10-16 15:28 ` Tom de Vries [this message]
2026-10-16 15:28 ` [pushed 3/3] [gdb/testsuite] Add gdb.tui/internal-error.exp Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261016152849.87694-3-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox