public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Add gdb.tui/reread.exp
@ 2024-05-08 15:01 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2024-05-08 15:01 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0fd705062ee0bb570ac7a1201d6f3cc2ed96f95d

commit 0fd705062ee0bb570ac7a1201d6f3cc2ed96f95d
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed May 8 17:02:15 2024 +0200

    [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

Diff:
---
 gdb/testsuite/gdb.tui/reread.exp | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gdb/testsuite/gdb.tui/reread.exp b/gdb/testsuite/gdb.tui/reread.exp
new file mode 100644
index 00000000000..9f16bee9f67
--- /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"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-08 15:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-08 15:01 [binutils-gdb] [gdb/testsuite] Add gdb.tui/reread.exp Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).