[aarch64] Fix missed unaligned hardware watchpoints (RH BZ 1347993).

This commit is contained in:
Jan Kratochvil 2018-05-05 18:54:28 +02:00
parent fd48d313b8
commit 397c8a5922
3 changed files with 1284 additions and 89 deletions

File diff suppressed because it is too large Load Diff

View File

@ -117,11 +117,11 @@ Content-Disposition: attachment; filename=bitpos-wp.patch
gdb/target.h | 4 ++--
10 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 08e6f4d4fd..f08bf039e4 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -767,7 +767,7 @@ aarch64_linux_stopped_by_watchpoint (struct target_ops *ops)
Index: gdb-8.1/gdb/aarch64-linux-nat.c
===================================================================
--- gdb-8.1.orig/gdb/aarch64-linux-nat.c 2018-05-05 17:58:31.061496741 +0200
+++ gdb-8.1/gdb/aarch64-linux-nat.c 2018-05-05 17:58:32.449509313 +0200
@@ -789,7 +789,7 @@
static int
aarch64_linux_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
@ -130,11 +130,11 @@ index 08e6f4d4fd..f08bf039e4 100644
{
return start <= addr && start + length - 1 >= addr;
}
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 3b7aa40db8..48dfe22ce1 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -1177,7 +1177,7 @@ arm_linux_stopped_by_watchpoint (struct target_ops *ops)
Index: gdb-8.1/gdb/arm-linux-nat.c
===================================================================
--- gdb-8.1.orig/gdb/arm-linux-nat.c 2018-05-05 17:58:31.062496750 +0200
+++ gdb-8.1/gdb/arm-linux-nat.c 2018-05-05 17:58:32.449509313 +0200
@@ -1177,7 +1177,7 @@
static int
arm_linux_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
@ -143,11 +143,11 @@ index 3b7aa40db8..48dfe22ce1 100644
{
return start <= addr && start + length - 1 >= addr;
}
diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
index ce26f28fad..e9ebc5fba8 100644
--- a/gdb/nat/aarch64-linux-hw-point.c
+++ b/gdb/nat/aarch64-linux-hw-point.c
@@ -111,7 +111,7 @@ aarch64_point_encode_ctrl_reg (enum target_hw_bp_type type, int len)
Index: gdb-8.1/gdb/nat/aarch64-linux-hw-point.c
===================================================================
--- gdb-8.1.orig/gdb/nat/aarch64-linux-hw-point.c 2018-05-05 17:58:31.062496750 +0200
+++ gdb-8.1/gdb/nat/aarch64-linux-hw-point.c 2018-05-05 17:59:16.616909382 +0200
@@ -137,7 +137,7 @@
Return 0 for any non-compliant ADDR and/or LEN; return 1 otherwise. */
static int
@ -156,20 +156,19 @@ index ce26f28fad..e9ebc5fba8 100644
{
unsigned int alignment = 0;
@@ -180,9 +180,10 @@ aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, int len)
limitations can be largely relaxed with some further work. */
@@ -212,9 +212,9 @@
an address within the latter. */
static void
-aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p,
+aarch64_align_watchpoint (CORE_ADDR addr, LONGEST len,
+ CORE_ADDR *aligned_addr_p,
int *aligned_len_p, CORE_ADDR *next_addr_p,
- int *next_len_p)
+ LONGEST *next_len_p)
+aarch64_align_watchpoint (CORE_ADDR addr, LONGEST len, CORE_ADDR *aligned_addr_p,
int *aligned_offset_p, int *aligned_len_p,
- CORE_ADDR *next_addr_p, int *next_len_p,
+ CORE_ADDR *next_addr_p, LONGEST *next_len_p,
CORE_ADDR *next_addr_orig_p)
{
int aligned_len;
unsigned int offset;
@@ -501,7 +502,7 @@ aarch64_handle_aligned_watchpoint (enum target_hw_bp_type type,
@@ -611,7 +611,7 @@
static int
aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type,
@ -177,20 +176,23 @@ index ce26f28fad..e9ebc5fba8 100644
+ CORE_ADDR addr, LONGEST len, int is_insert,
struct aarch64_debug_reg_state *state)
{
while (len > 0)
@@ -524,9 +525,9 @@ aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type,
CORE_ADDR addr_orig = addr;
@@ -641,12 +641,12 @@
" "
"aligned_addr: %s, aligned_len: %d\n"
"addr_orig: %s\n"
" "
- "next_addr: %s, next_len: %d\n",
+ "next_addr: %s, next_len: %s\n",
- "next_addr: %s, next_len: %d\n"
+ "next_addr: %s, next_len: %s\n"
" "
"addr_orig_next: %s\n",
is_insert, core_addr_to_string_nz (aligned_addr),
- aligned_len, core_addr_to_string_nz (addr), len);
+ aligned_len, core_addr_to_string_nz (addr), plongest (len));
aligned_len, core_addr_to_string_nz (addr_orig),
- core_addr_to_string_nz (addr), len,
+ core_addr_to_string_nz (addr), plongest (len),
core_addr_to_string_nz (addr_orig_next));
if (ret != 0)
return ret;
@@ -537,7 +538,7 @@ aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type,
addr_orig = addr_orig_next;
@@ -660,7 +660,7 @@
int
aarch64_handle_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr,
@ -199,7 +201,7 @@ index ce26f28fad..e9ebc5fba8 100644
struct aarch64_debug_reg_state *state)
{
if (aarch64_point_is_aligned (1 /* is_watchpoint */ , addr, len))
@@ -588,14 +589,14 @@ aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state,
@@ -722,14 +722,14 @@
void
aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state,
const char *func, CORE_ADDR addr,
@ -217,11 +219,11 @@ index ce26f28fad..e9ebc5fba8 100644
type == hw_write ? "hw-write-watchpoint"
: (type == hw_read ? "hw-read-watchpoint"
: (type == hw_access ? "hw-access-watchpoint"
diff --git a/gdb/nat/aarch64-linux-hw-point.h b/gdb/nat/aarch64-linux-hw-point.h
index 7c42b96d1b..e1d4fc8dbc 100644
--- a/gdb/nat/aarch64-linux-hw-point.h
+++ b/gdb/nat/aarch64-linux-hw-point.h
@@ -172,7 +172,7 @@ int aarch64_handle_breakpoint (enum target_hw_bp_type type, CORE_ADDR addr,
Index: gdb-8.1/gdb/nat/aarch64-linux-hw-point.h
===================================================================
--- gdb-8.1.orig/gdb/nat/aarch64-linux-hw-point.h 2018-05-05 17:58:31.062496750 +0200
+++ gdb-8.1/gdb/nat/aarch64-linux-hw-point.h 2018-05-05 17:58:32.450509322 +0200
@@ -176,7 +176,7 @@
int len, int is_insert,
struct aarch64_debug_reg_state *state);
int aarch64_handle_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr,
@ -229,8 +231,8 @@ index 7c42b96d1b..e1d4fc8dbc 100644
+ LONGEST len, int is_insert,
struct aarch64_debug_reg_state *state);
void aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state,
@@ -180,7 +180,7 @@ void aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state,
void aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state,
@@ -184,7 +184,7 @@
void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state,
const char *func, CORE_ADDR addr,
@ -239,11 +241,11 @@ index 7c42b96d1b..e1d4fc8dbc 100644
void aarch64_linux_get_debug_reg_capacity (int tid);
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 4a82434c0d..49a27d8daa 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1798,11 +1798,11 @@ can_use_watchpoint_cond_accel (void)
Index: gdb-8.1/gdb/ppc-linux-nat.c
===================================================================
--- gdb-8.1.orig/gdb/ppc-linux-nat.c 2018-05-05 17:58:31.063496759 +0200
+++ gdb-8.1/gdb/ppc-linux-nat.c 2018-05-05 17:58:32.450509322 +0200
@@ -1798,11 +1798,11 @@
CONDITION_VALUE will hold the value which should be put in the
DVC register. */
static void
@ -258,7 +260,7 @@ index 4a82434c0d..49a27d8daa 100644
CORE_ADDR addr_end_data, addr_end_dvc;
/* The DVC register compares bytes within fixed-length windows which
@@ -1889,7 +1889,7 @@ num_memory_accesses (struct value *v)
@@ -1889,7 +1889,7 @@
of the constant. */
static int
check_condition (CORE_ADDR watch_addr, struct expression *cond,
@ -267,7 +269,7 @@ index 4a82434c0d..49a27d8daa 100644
{
int pc = 1, num_accesses_left, num_accesses_right;
struct value *left_val, *right_val, *left_chain, *right_chain;
@@ -1957,7 +1957,7 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond,
@@ -1957,7 +1957,7 @@
true. */
static int
ppc_linux_can_accel_watchpoint_condition (struct target_ops *self,
@ -276,7 +278,7 @@ index 4a82434c0d..49a27d8daa 100644
struct expression *cond)
{
CORE_ADDR data_value;
@@ -1974,7 +1974,7 @@ ppc_linux_can_accel_watchpoint_condition (struct target_ops *self,
@@ -1974,7 +1974,7 @@
static void
create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr,
@ -285,7 +287,7 @@ index 4a82434c0d..49a27d8daa 100644
struct expression *cond, int insert)
{
if (len == 1
@@ -2240,7 +2240,7 @@ ppc_linux_stopped_by_watchpoint (struct target_ops *ops)
@@ -2240,7 +2240,7 @@
static int
ppc_linux_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
@ -294,11 +296,11 @@ index 4a82434c0d..49a27d8daa 100644
{
int mask;
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 887f1201fe..edd1be632a 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1563,7 +1563,7 @@ procfs_address_to_host_pointer (CORE_ADDR addr)
Index: gdb-8.1/gdb/procfs.c
===================================================================
--- gdb-8.1.orig/gdb/procfs.c 2018-05-05 17:58:31.064496768 +0200
+++ gdb-8.1/gdb/procfs.c 2018-05-05 17:58:32.451509331 +0200
@@ -1563,7 +1563,7 @@
}
static int
@ -307,7 +309,7 @@ index 887f1201fe..edd1be632a 100644
{
struct {
procfs_ctl_t cmd;
@@ -3250,7 +3250,7 @@ procfs_pid_to_str (struct target_ops *ops, ptid_t ptid)
@@ -3250,7 +3250,7 @@
/* Insert a watchpoint. */
static int
@ -316,11 +318,11 @@ index 887f1201fe..edd1be632a 100644
int after)
{
int pflags = 0;
diff --git a/gdb/remote.c b/gdb/remote.c
index 94d5594175..86777f1e5e 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -9897,7 +9897,7 @@ remote_insert_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
Index: gdb-8.1/gdb/remote.c
===================================================================
--- gdb-8.1.orig/gdb/remote.c 2018-05-05 17:58:31.066496786 +0200
+++ gdb-8.1/gdb/remote.c 2018-05-05 17:58:32.452509340 +0200
@@ -9897,7 +9897,7 @@
p = strchr (rs->buf, '\0');
addr = remote_address_masked (addr);
p += hexnumstr (p, (ULONGEST) addr);
@ -329,7 +331,7 @@ index 94d5594175..86777f1e5e 100644
putpkt (rs->buf);
getpkt (&rs->buf, &rs->buf_size, 0);
@@ -9917,7 +9917,7 @@ remote_insert_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
@@ -9917,7 +9917,7 @@
static int
remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr,
@ -338,7 +340,7 @@ index 94d5594175..86777f1e5e 100644
{
CORE_ADDR diff = remote_address_masked (addr - start);
@@ -9946,7 +9946,7 @@ remote_remove_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
@@ -9946,7 +9946,7 @@
p = strchr (rs->buf, '\0');
addr = remote_address_masked (addr);
p += hexnumstr (p, (ULONGEST) addr);
@ -347,11 +349,11 @@ index 94d5594175..86777f1e5e 100644
putpkt (rs->buf);
getpkt (&rs->buf, &rs->buf_size, 0);
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 2b449cbf01..f725215fff 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -733,14 +733,14 @@ debug_stopped_data_address (struct target_ops *self, CORE_ADDR *arg1)
Index: gdb-8.1/gdb/target-delegates.c
===================================================================
--- gdb-8.1.orig/gdb/target-delegates.c 2018-05-05 17:58:25.321444747 +0200
+++ gdb-8.1/gdb/target-delegates.c 2018-05-05 17:58:32.453509349 +0200
@@ -733,14 +733,14 @@
}
static int
@ -368,7 +370,7 @@ index 2b449cbf01..f725215fff 100644
{
int result;
fprintf_unfiltered (gdb_stdlog, "-> %s->to_watchpoint_addr_within_range (...)\n", debug_target.to_shortname);
@@ -752,7 +752,7 @@ debug_watchpoint_addr_within_range (struct target_ops *self, CORE_ADDR arg1, COR
@@ -752,7 +752,7 @@
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg2);
fputs_unfiltered (", ", gdb_stdlog);
@ -377,7 +379,7 @@ index 2b449cbf01..f725215fff 100644
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
@@ -785,20 +785,20 @@ debug_region_ok_for_hw_watchpoint (struct target_ops *self, CORE_ADDR arg1, LONG
@@ -785,20 +785,20 @@
}
static int
@ -401,7 +403,7 @@ index 2b449cbf01..f725215fff 100644
{
int result;
fprintf_unfiltered (gdb_stdlog, "-> %s->to_can_accel_watchpoint_condition (...)\n", debug_target.to_shortname);
@@ -808,7 +808,7 @@ debug_can_accel_watchpoint_condition (struct target_ops *self, CORE_ADDR arg1, i
@@ -808,7 +808,7 @@
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
fputs_unfiltered (", ", gdb_stdlog);
@ -410,11 +412,11 @@ index 2b449cbf01..f725215fff 100644
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg3);
fputs_unfiltered (", ", gdb_stdlog);
diff --git a/gdb/target.c b/gdb/target.c
index a1ac6d0697..eb0538cb82 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -53,7 +53,7 @@ static void generic_tls_error (void) ATTRIBUTE_NORETURN;
Index: gdb-8.1/gdb/target.c
===================================================================
--- gdb-8.1.orig/gdb/target.c 2018-05-05 17:58:31.068496804 +0200
+++ gdb-8.1/gdb/target.c 2018-05-05 17:58:32.453509349 +0200
@@ -53,7 +53,7 @@
static void default_terminal_info (struct target_ops *, const char *, int);
static int default_watchpoint_addr_within_range (struct target_ops *,
@ -423,7 +425,7 @@ index a1ac6d0697..eb0538cb82 100644
static int default_region_ok_for_hw_watchpoint (struct target_ops *,
CORE_ADDR, LONGEST);
@@ -3120,7 +3120,7 @@ default_region_ok_for_hw_watchpoint (struct target_ops *self,
@@ -3120,7 +3120,7 @@
static int
default_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
@ -432,11 +434,11 @@ index a1ac6d0697..eb0538cb82 100644
{
return addr >= start && addr < start + length;
}
diff --git a/gdb/target.h b/gdb/target.h
index 7a70c3f6da..35eee91a83 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -535,7 +535,7 @@ struct target_ops
Index: gdb-8.1/gdb/target.h
===================================================================
--- gdb-8.1.orig/gdb/target.h 2018-05-05 17:58:31.068496804 +0200
+++ gdb-8.1/gdb/target.h 2018-05-05 17:58:32.454509358 +0200
@@ -535,7 +535,7 @@
int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *)
TARGET_DEFAULT_RETURN (0);
int (*to_watchpoint_addr_within_range) (struct target_ops *,
@ -445,7 +447,7 @@ index 7a70c3f6da..35eee91a83 100644
TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range);
/* Documentation of this routine is provided with the corresponding
@@ -545,7 +545,7 @@ struct target_ops
@@ -545,7 +545,7 @@
TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint);
int (*to_can_accel_watchpoint_condition) (struct target_ops *,
@ -454,6 +456,3 @@ index 7a70c3f6da..35eee91a83 100644
struct expression *)
TARGET_DEFAULT_RETURN (0);
int (*to_masked_watch_num_registers) (struct target_ops *,
--
2.14.3

View File

@ -26,7 +26,7 @@ Version: 8.1
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 14%{?dist}
Release: 15%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
Group: Development/Debuggers
@ -188,6 +188,9 @@ Patch1044: gdb-pahole-python2.patch
##=fedoratest
Patch1119: gdb-testsuite-readline63-sigint-revert.patch
# [aarch64] Fix missed unaligned hardware watchpoints (RH BZ 1347993).
Patch1278: gdb-rhbz1347993-aarch64-hw-watchpoint.patch
# Include the auto-generated file containing the "Patch:" directives.
# See README.local-patches for more details.
Source8: _gdb.spec.Patch.include
@ -413,6 +416,8 @@ tar xzf %{SOURCE7}
)
%endif
%patch1278 -p1
# Files have `# <number> <file>' statements breaking VPATH / find-debuginfo.sh .
(cd gdb;rm -fv $(perl -pe 's/\\\n/ /' <Makefile.in|sed -n 's/^YYFILES = //p'))
@ -1026,6 +1031,9 @@ then
fi
%changelog
* Sat May 5 2018 Jan Kratochvil <jan.kratochvil@redhat.com> - 8.1-15.fc28
- [aarch64] Fix missed unaligned hardware watchpoints (RH BZ 1347993).
* Mon Apr 2 2018 Jan Kratochvil <jan.kratochvil@redhat.com> - 8.1-14.fc28
- Revert 'Fix PDF build on Rawhide/F-29', rm -rf texinfo/ (from RH BZ 1562580).