aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-06-03 12:46:46 +0100
committerPedro Alves <palves@redhat.com>2014-06-03 12:46:46 +0100
commit835c559fd59d4ebb3b04d046c1f9f36183db0fe6 (patch)
treeb22b8651cf7e6f0f089a014620ca9e8f87d0f88f /gdb
parent06eb158633faa8746dd39f19ce784448bb7ece00 (diff)
downloadgdb-835c559fd59d4ebb3b04d046c1f9f36183db0fe6.zip
gdb-835c559fd59d4ebb3b04d046c1f9f36183db0fe6.tar.gz
gdb-835c559fd59d4ebb3b04d046c1f9f36183db0fe6.tar.bz2
PR breakpoints/17000: user breakpoint not inserted if software-single-step at same location - test
GDB gets confused when removing a software single-step breakpoint that is at the same address as another breakpoint. Add another kfailed test. gdb/testsuite/ 2014-06-03 Pedro Alves <palves@redhat.com> PR breakpoints/17000 * gdb.base/sss-bp-on-user-bp-2.c: New file. * gdb.base/sss-bp-on-user-bp-2.exp: New file.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.c29
-rw-r--r--gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp109
3 files changed, 144 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9ded6eb..644f5ac 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-03 Pedro Alves <palves@redhat.com>
+
+ PR breakpoints/17000
+ * gdb.base/sss-bp-on-user-bp-2.c: New file.
+ * gdb.base/sss-bp-on-user-bp-2.exp: New file.
+
2014-06-02 Doug Evans <xdje42@gmail.com>
* gdb.guile/scm-parameter.exp: New file.
diff --git a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.c b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.c
new file mode 100644
index 0000000..c3c26fe
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.c
@@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2014 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/>. */
+
+static void
+test (void)
+{
+ label: asm (" nop"); label2: asm (" nop"); /* must be a single line */
+}
+
+int
+main (void)
+{
+ test ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
new file mode 100644
index 0000000..a129bb7
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
@@ -0,0 +1,109 @@
+# Copyright (C) 2014 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 that GDB doesn't get confused in the following scenario
+# (PR breakpoints/17000). Say, we have this program:
+#
+# => 0xff000001 INSN1
+# 0xff000002 INSN2
+#
+# The PC currently points at INSN1.
+#
+# 1 - User sets a breakpoint at 0xff000002 (INSN2).
+#
+# 2 - User steps. On software single-step archs, this sets a software
+# single-step breakpoint at 0xff000002 (INSN2) too.
+#
+# 3 - User deletes breakpoint (INSN2) before the single-step finishes.
+#
+# 4 - The single-step finishes, and GDB removes the single-step
+# breakpoint.
+
+standard_testfile
+
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
+ return -1
+}
+
+if ![runto_main] {
+ fail "Can't run to main"
+ return 0
+}
+
+set line_re "\[^\r\n\]*"
+
+gdb_test "b test:label" "Breakpoint .*"
+gdb_continue_to_breakpoint "run past setup"
+delete_breakpoints
+
+# So we can precisely control breakpoint insertion order.
+gdb_test_no_output "set breakpoint always-inserted on"
+
+# Capture disassembly output. PREFIX is used as test prefix. The
+# current instruction indicator (=>) is stripped away.
+proc disassemble { prefix } {
+ with_test_prefix "$prefix" {
+ set output [capture_command_output "disassemble test" ""]
+ return [string map {"=>" " "} $output]
+ }
+}
+
+# Issue a stepi and immediately delete the user breakpoint that is set
+# at the same address as the software single-step breakpoint. Do this
+# in a user defined command, so that the stepi's trap doesn't have a
+# chance to be handled before further input is processed. We then
+# compare before/after disassembly. GDB should be able to handle
+# deleting the user breakpoint before deleting the single-step
+# breakpoint. E.g., we shouldn't see breakpoint instructions in the
+# disassembly.
+
+set disasm_before [disassemble "before"]
+
+gdb_test "b test:label2" ".*" "set breakpoint where si will land"
+
+set test "define stepi_del_break"
+gdb_test_multiple $test $test {
+ -re "Type commands for definition of \"stepi_del_break\".\r\nEnd with a line saying just \"end\".\r\n>$" {
+ gdb_test "si&\ndel \$bpnum\nend" "" $test
+ }
+}
+
+set command "stepi_del_break"
+set test $command
+setup_kfail "breakpoints/17000" "*-*-*"
+gdb_test_multiple $command $test {
+ -re "^$command\r\n$gdb_prompt " {
+ # Note no end anchor, because "si&" finishes and prints the
+ # current frame/line after the prompt is printed.
+ pass $test
+ }
+}
+
+# Now consume the output of the finished "si&".
+set test "si& finished"
+gdb_test_multiple "" $test {
+ -re "must be a single line \\\*/\r\n" {
+ pass $test
+ }
+}
+
+set disasm_after [disassemble "after"]
+
+set test "before/after disassembly matches"
+if ![string compare $disasm_before $disasm_after] {
+ pass $test
+} else {
+ fail $test
+}