|
|
4c2ad1 |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
4c2ad1 |
From: Fedora GDB patches <invalid@email.com>
|
|
|
4c2ad1 |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
4c2ad1 |
Subject: gdb-bz541866-rwatch-before-run.patch
|
|
|
4c2ad1 |
|
|
|
4c2ad1 |
;; Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
|
|
|
4c2ad1 |
;; Fix i386 rwatch+awatch before run (BZ 688788, on top of BZ 541866).
|
|
|
4c2ad1 |
;;=push+jan: It should be fixed properly instead.
|
|
|
4c2ad1 |
|
|
|
4c2ad1 |
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
|
|
4c2ad1 |
--- a/gdb/breakpoint.c
|
|
|
4c2ad1 |
+++ b/gdb/breakpoint.c
|
|
|
4c2ad1 |
@@ -8807,7 +8807,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
|
|
|
4c2ad1 |
int enabled, int internal, unsigned flags,
|
|
|
4c2ad1 |
int display_canonical)
|
|
|
4c2ad1 |
{
|
|
|
4c2ad1 |
- int i;
|
|
|
4c2ad1 |
+ int i ATTRIBUTE_UNUSED;
|
|
|
4c2ad1 |
|
|
|
4c2ad1 |
if (type == bp_hardware_breakpoint)
|
|
|
4c2ad1 |
{
|
|
|
4c2ad1 |
@@ -14356,7 +14356,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
|
|
|
4c2ad1 |
|
|
|
4c2ad1 |
if (bpt->type == bp_hardware_breakpoint)
|
|
|
4c2ad1 |
{
|
|
|
4c2ad1 |
- int i;
|
|
|
4c2ad1 |
+ int i ATTRIBUTE_UNUSED;
|
|
|
4c2ad1 |
i = hw_breakpoint_used_count ();
|
|
|
4c2ad1 |
target_resources_ok =
|
|
|
4c2ad1 |
target_can_use_hardware_watchpoint (bp_hardware_breakpoint,
|
|
|
4c2ad1 |
diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h
|
|
|
4c2ad1 |
new file mode 100644
|
|
|
4c2ad1 |
--- /dev/null
|
|
|
4c2ad1 |
+++ b/gdb/config/i386/nm-linux.h
|
|
|
4c2ad1 |
@@ -0,0 +1,28 @@
|
|
|
4c2ad1 |
+/* Native support for GNU/Linux i386.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+ Copyright 2010 Free Software Foundation, Inc.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+ This file is part of GDB.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
4c2ad1 |
+ it under the terms of the GNU General Public License as published by
|
|
|
4c2ad1 |
+ the Free Software Foundation; either version 3 of the License, or
|
|
|
4c2ad1 |
+ (at your option) any later version.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+ This program is distributed in the hope that it will be useful,
|
|
|
4c2ad1 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c2ad1 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
4c2ad1 |
+ GNU General Public License for more details.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+ You should have received a copy of the GNU General Public License
|
|
|
4c2ad1 |
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+#ifndef NM_LINUX_H
|
|
|
4c2ad1 |
+#define NM_LINUX_H
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+#include "config/nm-linux.h"
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+/* Red Hat backward compatibility with gdb-6.8. */
|
|
|
4c2ad1 |
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+#endif /* NM_LINUX64_H */
|
|
|
4c2ad1 |
diff --git a/gdb/config/i386/nm-linux64.h b/gdb/config/i386/nm-linux64.h
|
|
|
4c2ad1 |
new file mode 100644
|
|
|
4c2ad1 |
--- /dev/null
|
|
|
4c2ad1 |
+++ b/gdb/config/i386/nm-linux64.h
|
|
|
4c2ad1 |
@@ -0,0 +1,28 @@
|
|
|
4c2ad1 |
+/* Native support for GNU/Linux amd64.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+ Copyright 2010 Free Software Foundation, Inc.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+ This file is part of GDB.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
4c2ad1 |
+ it under the terms of the GNU General Public License as published by
|
|
|
4c2ad1 |
+ the Free Software Foundation; either version 3 of the License, or
|
|
|
4c2ad1 |
+ (at your option) any later version.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+ This program is distributed in the hope that it will be useful,
|
|
|
4c2ad1 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c2ad1 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
4c2ad1 |
+ GNU General Public License for more details.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+ You should have received a copy of the GNU General Public License
|
|
|
4c2ad1 |
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+#ifndef NM_LINUX64_H
|
|
|
4c2ad1 |
+#define NM_LINUX64_H
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+#include "config/nm-linux.h"
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+/* Red Hat backward compatibility with gdb-6.8. */
|
|
|
4c2ad1 |
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+#endif /* NM_LINUX64_H */
|
|
|
4c2ad1 |
diff --git a/gdb/configure.nat b/gdb/configure.nat
|
|
|
4c2ad1 |
--- a/gdb/configure.nat
|
|
|
4c2ad1 |
+++ b/gdb/configure.nat
|
|
|
4c2ad1 |
@@ -238,6 +238,7 @@ case ${gdb_host} in
|
|
|
4c2ad1 |
;;
|
|
|
4c2ad1 |
i386)
|
|
|
4c2ad1 |
# Host: Intel 386 running GNU/Linux.
|
|
|
4c2ad1 |
+ NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux.h"
|
|
|
4c2ad1 |
NATDEPFILES="${NATDEPFILES} x86-nat.o x86-dregs.o \
|
|
|
4c2ad1 |
i386-linux-nat.o x86-linux-nat.o linux-btrace.o \
|
|
|
4c2ad1 |
x86-linux.o x86-linux-dregs.o"
|
|
|
4c2ad1 |
@@ -290,6 +291,7 @@ case ${gdb_host} in
|
|
|
4c2ad1 |
case ${gdb_host_cpu} in
|
|
|
4c2ad1 |
i386)
|
|
|
4c2ad1 |
# Host: GNU/Linux x86-64
|
|
|
4c2ad1 |
+ NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux64.h"
|
|
|
4c2ad1 |
NATDEPFILES="${NATDEPFILES} x86-nat.o x86-dregs.o \
|
|
|
4c2ad1 |
amd64-nat.o amd64-linux-nat.o x86-linux-nat.o linux-btrace.o \
|
|
|
4c2ad1 |
x86-linux.o x86-linux-dregs.o amd64-linux-siginfo.o"
|
|
|
4c2ad1 |
diff --git a/gdb/target.h b/gdb/target.h
|
|
|
4c2ad1 |
--- a/gdb/target.h
|
|
|
4c2ad1 |
+++ b/gdb/target.h
|
|
|
4c2ad1 |
@@ -1953,9 +1953,11 @@ extern struct thread_info *target_thread_handle_to_thread_info
|
|
|
4c2ad1 |
one. OTHERTYPE is the number of watchpoints of other types than
|
|
|
4c2ad1 |
this one used so far. */
|
|
|
4c2ad1 |
|
|
|
4c2ad1 |
+#ifndef target_can_use_hardware_watchpoint
|
|
|
4c2ad1 |
#define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
|
|
|
4c2ad1 |
(current_top_target ()->can_use_hw_breakpoint) ( \
|
|
|
4c2ad1 |
TYPE, CNT, OTHERTYPE)
|
|
|
4c2ad1 |
+#endif
|
|
|
4c2ad1 |
|
|
|
4c2ad1 |
/* Returns the number of debug registers needed to watch the given
|
|
|
4c2ad1 |
memory region, or zero if not supported. */
|
|
|
4c2ad1 |
diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
|
|
|
4c2ad1 |
new file mode 100644
|
|
|
4c2ad1 |
--- /dev/null
|
|
|
4c2ad1 |
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
|
|
|
4c2ad1 |
@@ -0,0 +1,40 @@
|
|
|
4c2ad1 |
+# Copyright 2009, 2010 Free Software Foundation, Inc.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
4c2ad1 |
+# it under the terms of the GNU General Public License as published by
|
|
|
4c2ad1 |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
4c2ad1 |
+# (at your option) any later version.
|
|
|
4c2ad1 |
+#
|
|
|
4c2ad1 |
+# This program is distributed in the hope that it will be useful,
|
|
|
4c2ad1 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c2ad1 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
4c2ad1 |
+# GNU General Public License for more details.
|
|
|
4c2ad1 |
+#
|
|
|
4c2ad1 |
+# You should have received a copy of the GNU General Public License
|
|
|
4c2ad1 |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
|
|
|
4c2ad1 |
+if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
|
|
|
4c2ad1 |
+ && ![istarget "ia64-*-*"])
|
|
|
4c2ad1 |
+ || [target_info exists gdb,no_hardware_watchpoints]} then {
|
|
|
4c2ad1 |
+ verbose "Skipping watchpoint-hw-before-run test."
|
|
|
4c2ad1 |
+ return
|
|
|
4c2ad1 |
+}
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+set test watchpoint-hw-before-run
|
|
|
4c2ad1 |
+set srcfile watchpoint-hw-hit-once.c
|
|
|
4c2ad1 |
+if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
|
|
|
4c2ad1 |
+ return -1
|
|
|
4c2ad1 |
+}
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+# `runto_main' or `runto main' would delete the watchpoint created above.
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+if { [gdb_start_cmd] < 0 } {
|
|
|
4c2ad1 |
+ untested start
|
|
|
4c2ad1 |
+ return -1
|
|
|
4c2ad1 |
+}
|
|
|
4c2ad1 |
+gdb_test "" "main .* at .*" "start"
|
|
|
4c2ad1 |
+
|
|
|
4c2ad1 |
+gdb_test "continue" "Continuing.\r\n\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"
|