aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/target.c6
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.tui/corefile-run.exp61
4 files changed, 74 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0dfc96a..80ec8f3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2019-11-18 Sergio Durigan Junior <sergiodj@redhat.com>
+ Pedro Alves <palves@redhat.com>
+
+ https://bugzilla.redhat.com/show_bug.cgi?id=1765117
+ * target.c (target_stack::push): Call 'unpush' if there's a
+ target on top of the stack.
+
2019-11-18 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* python/py-block.c (blpy_dealloc): Call tp_free.
diff --git a/gdb/target.c b/gdb/target.c
index 7c9befc..5a3764e 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -562,11 +562,7 @@ target_stack::push (target_ops *t)
strata stratum = t->stratum ();
if (m_stack[stratum] != NULL)
- {
- target_ops *prev = m_stack[stratum];
- m_stack[stratum] = NULL;
- target_close (prev);
- }
+ unpush (m_stack[stratum]);
/* Now add the new one. */
m_stack[stratum] = t;
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3a4d229..de8712a 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-18 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ https://bugzilla.redhat.com/show_bug.cgi?id=1765117
+ * gdb.tui/corefile-run.exp: New file.
+
2019-11-14 Tom Tromey <tromey@adacore.com>
* gdb.base/gdbvars.exp (test_convenience_variables): Add
diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp
new file mode 100644
index 0000000..05fcc24
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/corefile-run.exp
@@ -0,0 +1,61 @@
+# Copyright 2019 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/>.
+
+# Test whether we can load a corefile, enable TUI and then invoke
+# "run" without having a segfault.
+#
+# Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1765117
+
+load_lib "tuiterm.exp"
+
+standard_testfile tui-layout.c
+
+set core "${testfile}.core"
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
+ return -1
+}
+
+# Only run on native boards.
+if { [use_gdb_stub] || [target_info gdb_protocol] == "extended-remote" } {
+ untested "not supported"
+ return
+}
+
+if { ![runto_main] } {
+ untested "could not run to main"
+ return -1
+}
+
+if { ![gdb_gcore_cmd "$core" "save a corefile"] } {
+ untested "could not generate a corefile"
+ return -1
+}
+
+Term::clean_restart 24 80 $testfile
+if {![Term::enter_tui]} {
+ unsupported "TUI not supported"
+}
+
+set text [Term::get_all_lines]
+gdb_assert {![string match "No Source Available" $text]} \
+ "initial source listing"
+
+Term::command "core-file $core"
+Term::check_contents "load corefile" "21 *return 0"
+
+Term::command "run"
+Term::check_contents "run until the end" \
+ "\\\[Inferior $decimal \\\(process $decimal\\\) exited normally\\]"