aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-05-08 17:02:15 +0200
committerTom de Vries <tdevries@suse.de>2024-05-08 17:02:15 +0200
commit0fd705062ee0bb570ac7a1201d6f3cc2ed96f95d (patch)
tree42823e09dcc69e12fcd20504049042aa81adc690 /gdb
parentc70ccf9248cfd460b567c89546e8e1484bcbdcca (diff)
downloadgdb-0fd705062ee0bb570ac7a1201d6f3cc2ed96f95d.zip
gdb-0fd705062ee0bb570ac7a1201d6f3cc2ed96f95d.tar.gz
gdb-0fd705062ee0bb570ac7a1201d6f3cc2ed96f95d.tar.bz2
[gdb/testsuite] Add gdb.tui/reread.exp
Add a regression test for commit d68f983f88c ("Fix heap-use-after-free because all_objfiles_removed triggers tui_display_main"). When building with address sanitizer, and reverting the commit it triggers the heap-use-after-free. Tested on aarch64-linux. PR symtab/31697 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31697
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.tui/reread.exp39
1 files changed, 39 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.tui/reread.exp b/gdb/testsuite/gdb.tui/reread.exp
new file mode 100644
index 0000000..9f16bee
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/reread.exp
@@ -0,0 +1,39 @@
+# Copyright 2024 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 that rereading the exec while in TUI doesn't cause trouble.
+# Used to trigger an AddressSanitizer heap-use-after-free, PR31697.
+
+tuiterm_env
+
+# Use main-one-line.c to get the line info at a predictable location without
+# resorting to a dwarf assembly test-case.
+standard_testfile main-one-line.c
+
+if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
+ return -1
+}
+
+Term::clean_restart 24 80 $testfile
+
+if {![Term::enter_tui]} {
+ unsupported "TUI not supported"
+ return
+}
+
+remote_exec build sleep 1
+gdb_touch_execfile $binfile
+
+Term::command "start"