Blame SOURCES/gdb-rhbz795424-bitpos-22of25.patch

6240d7
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
6240d7
From: Fedora GDB patches <invalid@email.com>
6240d7
Date: Fri, 27 Oct 2017 21:07:50 +0200
6240d7
Subject: gdb-rhbz795424-bitpos-22of25.patch
6240d7
6240d7
;; Fix `GDB cannot access struct member whose offset is larger than 256MB'
6240d7
;; (RH BZ 795424).
6240d7
;;=push
6240d7
6240d7
http://sourceware.org/ml/gdb-patches/2012-09/msg00629.html
6240d7
6240d7
--MP_/6HRlH6vpyqtSy4CYyMrX6b2
6240d7
Content-Type: text/plain; charset=US-ASCII
6240d7
Content-Transfer-Encoding: 7bit
6240d7
Content-Disposition: inline
6240d7
6240d7
Hi,
6240d7
6240d7
This is part three of the bitpos expansion change.  Some architectures
6240d7
allow arbitrary length watchpoints and combined with the fact that type
6240d7
lengths could be large enough, we need LONGEST for watchpoint lengths.
6240d7
It is architecture dependent however, whether the LONGEST is needed or
6240d7
not.  This patch updates the signatures of watchpoint insertion and
6240d7
removal functions of all architectures (to comply with the function
6240d7
signatures in the callback struct), but expands types only in
6240d7
architectures that need it.  Tested on Fedora 16 x86_64.
6240d7
6240d7
Regards,
6240d7
Siddhesh
6240d7
--MP_/6HRlH6vpyqtSy4CYyMrX6b2
6240d7
Content-Type: text/plain
6240d7
Content-Transfer-Encoding: quoted-printable
6240d7
Content-Disposition: attachment; filename=ChangeLog-wp
6240d7
6240d7
gdb/ChangeLog:
6240d7
6240d7
	* arm-linux-nat.c (arm_linux_insert_watchpoint): Expand
6240d7
	parameter LEN to LONGEST.
6240d7
	(arm_linux_remove_watchpoint): Likewise.
6240d7
	(arm_linux_watchpoint_addr_within_range): Expand parameter
6240d7
	LENGTH to LONGEST.
6240d7
	* i386-nat.c (i386_insert_watchpoint): Expand parameter LEN to
6240d7
	LONGEST.
6240d7
	(i386_remove_watchpoint): Likewise.
6240d7
	* ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise.
6240d7
	(ia64_linux_remove_watchpoint): Likewise.
6240d7
	* inf-ttrace.c (inf_ttrace_insert_watchpoint): Likewise.
6240d7
	Expand NUM_PAGES, PAGE to LONGEST.
6240d7
	(inf_ttrace_remove_watchpoint): Likewise.
6240d7
	* mips-linux-nat.c (mips_linux_insert_watchpoint): Expand
6240d7
	parameter LEN to LONGEST.
6240d7
	(mips_linux_remove_watchpoint): Likewise.
6240d7
	* nto-procfs.c (procfs_remove_hw_watchpoint): Likewise.
6240d7
	(procfs_insert_hw_watchpoint): Likewise.
6240d7
	* ppc-linux-nat.c (calculate_dvc): Likewise.  Expand I,
6240d7
	NUM_BYTE_ENABLE to LONGEST.
6240d7
	(check_condition): Expand parameter LEN to point to LONGEST.
6240d7
	(ppc_linux_can_accel_watchpoint_condition): Expand parameter
6240d7
	LEN to LONGEST.
6240d7
	(create_watchpoint_request): Likewise.
6240d7
	(ppc_linux_insert_watchpoint): Likewise.
6240d7
	(ppc_linux_remove_watchpoint): Likewise.
6240d7
	(ppc_linux_watchpoint_addr_within_range): Expand parameter
6240d7
	LENGTH to LONGEST.
6240d7
	* procfs.c (proc_set_watchpoint): Expand parameter LEN to
6240d7
	LONGEST.
6240d7
	(procfs_set_watchpoint): Likewise.
6240d7
	(procfs_insert_watchpoint): Likewise.
6240d7
	(procfs_remove_watchpoint): Likewise.
6240d7
	* remote-m32r-sdi.c (m32r_insert_watchpoint): Likewise.  Use
6240d7
	plongest to format print LEN.
6240d7
	(m32r_remove_watchpoint): Likewise.
6240d7
	* remote-mips.c (mips_insert_watchpoint): Expand parameter LEN
6240d7
	to LONGEST.
6240d7
	(mips_remove_watchpoint): Likewise.
6240d7
	* remote.c (remote_insert_watchpoint): Likewise.
6240d7
	Use phex_nz to format print LEN.
6240d7
	(remote_remove_watchpoint): Likewise.
6240d7
	(remote_watchpoint_addr_within_range): Expand parameter LENGTH
6240d7
	to LONGEST.
6240d7
	* s390-linux-nat.c (s390_insert_watchpoint): Expand parameter LEN to
6240d7
	LONGEST.
6240d7
	(s390_remove_watchpoint): Likewise.
6240d7
	* target.c (update_current_target): Expand parameter LEN for
6240d7
	callbacks to TO_INSERT_WATCHPOINT, TO_REMOVE_WATCHPOINT,
6240d7
	TO_CAN_ACCEL_WATCHPOINT_CONDITION, to LONGEST.
6240d7
	(default_watchpoint_addr_within_range): Expand parameter
6240d7
	LENGTH to LONGEST.
6240d7
	(debug_to_can_accel_watchpoint_condition): Expand parameter LEN
6240d7
	to LONGEST.  Use plongest to format print LEN.
6240d7
	(debug_to_watchpoint_addr_within_range): Expand parameter LENGTH
6240d7
	to LONGEST.  Use plongest to format print LENGTH.
6240d7
	(debug_to_insert_watchpoint): Expand parameter LEN to LONGEST.
6240d7
	Use plongest to format print LEN.
6240d7
	(debug_to_remove_watchpoint): Likewise.
6240d7
	* target.h (struct target_ops): Expand parameter LEN of
6240d7
	TO_REMOVE_WATCHPOINT, TO_INSERT_WATCHPOINT,
6240d7
	TO_WATCHPOINT_ADDR_WITHIN_RANGE and
6240d7
	TO_CAN_ACCEL_WATCHPOINT_CONDITION to LONGEST.
6240d7
6240d7
--MP_/6HRlH6vpyqtSy4CYyMrX6b2
6240d7
Content-Type: text/x-patch
6240d7
Content-Transfer-Encoding: 7bit
6240d7
Content-Disposition: attachment; filename=bitpos-wp.patch
6240d7
6240d7
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
6240d7
--- a/gdb/aarch64-linux-nat.c
6240d7
+++ b/gdb/aarch64-linux-nat.c
6240d7
@@ -63,14 +63,14 @@ public:
6240d7
   int can_use_hw_breakpoint (enum bptype, int, int) override;
6240d7
   int insert_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
6240d7
   int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
6240d7
-  int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
6240d7
+  int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override;
6240d7
   int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
6240d7
 			 struct expression *) override;
6240d7
   int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
6240d7
 			 struct expression *) override;
6240d7
   bool stopped_by_watchpoint () override;
6240d7
   bool stopped_data_address (CORE_ADDR *) override;
6240d7
-  bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override;
6240d7
+  bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override;
6240d7
 
6240d7
   int can_do_single_step () override;
6240d7
 
6240d7
@@ -887,7 +887,8 @@ aarch64_linux_nat_target::stopped_by_watchpoint ()
6240d7
 
6240d7
 bool
6240d7
 aarch64_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
6240d7
-							CORE_ADDR start, int length)
6240d7
+							CORE_ADDR start,
6240d7
+							LONGEST length)
6240d7
 {
6240d7
   return start <= addr && start + length - 1 >= addr;
6240d7
 }
6240d7
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
6240d7
--- a/gdb/arm-linux-nat.c
6240d7
+++ b/gdb/arm-linux-nat.c
6240d7
@@ -80,7 +80,7 @@ public:
6240d7
 
6240d7
   int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
6240d7
 
6240d7
-  int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
6240d7
+  int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override;
6240d7
 
6240d7
   int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
6240d7
 			 struct expression *) override;
6240d7
@@ -91,7 +91,7 @@ public:
6240d7
 
6240d7
   bool stopped_data_address (CORE_ADDR *) override;
6240d7
 
6240d7
-  bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override;
6240d7
+  bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override;
6240d7
 
6240d7
   const struct target_desc *read_description () override;
6240d7
 
6240d7
@@ -1203,7 +1203,7 @@ arm_linux_nat_target::stopped_by_watchpoint ()
6240d7
 bool
6240d7
 arm_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
6240d7
 						    CORE_ADDR start,
6240d7
-						    int length)
6240d7
+						    LONGEST length)
6240d7
 {
6240d7
   return start <= addr && start + length - 1 >= addr;
6240d7
 }
6240d7
diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
6240d7
--- a/gdb/nat/aarch64-linux-hw-point.c
6240d7
+++ b/gdb/nat/aarch64-linux-hw-point.c
6240d7
@@ -137,7 +137,7 @@ aarch64_point_encode_ctrl_reg (enum target_hw_bp_type type, int offset, int len)
6240d7
    Return 0 for any non-compliant ADDR and/or LEN; return 1 otherwise.  */
6240d7
 
6240d7
 static int
6240d7
-aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, int len)
6240d7
+aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, LONGEST len)
6240d7
 {
6240d7
   unsigned int alignment = 0;
6240d7
 
6240d7
@@ -212,9 +212,10 @@ aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, int len)
6240d7
    an address within the latter. */
6240d7
 
6240d7
 static void
6240d7
-aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p,
6240d7
+aarch64_align_watchpoint (CORE_ADDR addr, LONGEST len,
6240d7
+			  CORE_ADDR *aligned_addr_p,
6240d7
 			  int *aligned_offset_p, int *aligned_len_p,
6240d7
-			  CORE_ADDR *next_addr_p, int *next_len_p,
6240d7
+			  CORE_ADDR *next_addr_p, LONGEST *next_len_p,
6240d7
 			  CORE_ADDR *next_addr_orig_p)
6240d7
 {
6240d7
   int aligned_len;
6240d7
@@ -611,7 +612,7 @@ aarch64_handle_aligned_watchpoint (enum target_hw_bp_type type,
6240d7
 
6240d7
 static int
6240d7
 aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type,
6240d7
-				     CORE_ADDR addr, int len, int is_insert,
6240d7
+				     CORE_ADDR addr, LONGEST len, int is_insert,
6240d7
 				     struct aarch64_debug_reg_state *state)
6240d7
 {
6240d7
   CORE_ADDR addr_orig = addr;
6240d7
@@ -641,12 +642,12 @@ aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type,
6240d7
 		      "                                "
6240d7
 		      "addr_orig: %s\n"
6240d7
 		      "                                "
6240d7
-		      "next_addr: %s,    next_len: %d\n"
6240d7
+		      "next_addr: %s,    next_len: %s\n"
6240d7
 		      "                           "
6240d7
 		      "addr_orig_next: %s\n",
6240d7
 		      is_insert, core_addr_to_string_nz (aligned_addr),
6240d7
 		      aligned_len, core_addr_to_string_nz (addr_orig),
6240d7
-		      core_addr_to_string_nz (addr), len,
6240d7
+		      core_addr_to_string_nz (addr), plongest (len),
6240d7
 		      core_addr_to_string_nz (addr_orig_next));
6240d7
 
6240d7
       addr_orig = addr_orig_next;
6240d7
@@ -660,7 +661,7 @@ aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type,
6240d7
 
6240d7
 int
6240d7
 aarch64_handle_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr,
6240d7
-			   int len, int is_insert,
6240d7
+			   LONGEST len, int is_insert,
6240d7
 			   struct aarch64_debug_reg_state *state)
6240d7
 {
6240d7
   if (aarch64_point_is_aligned (1 /* is_watchpoint */ , addr, len))
6240d7
@@ -742,14 +743,14 @@ aarch64_linux_any_set_debug_regs_state (aarch64_debug_reg_state *state,
6240d7
 void
6240d7
 aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state,
6240d7
 			      const char *func, CORE_ADDR addr,
6240d7
-			      int len, enum target_hw_bp_type type)
6240d7
+			      LONGEST len, enum target_hw_bp_type type)
6240d7
 {
6240d7
   int i;
6240d7
 
6240d7
   debug_printf ("%s", func);
6240d7
   if (addr || len)
6240d7
-    debug_printf (" (addr=0x%08lx, len=%d, type=%s)",
6240d7
-		  (unsigned long) addr, len,
6240d7
+    debug_printf (" (addr=0x%08lx, len=%s, type=%s)",
6240d7
+		  (unsigned long) addr, plongest (len),
6240d7
 		  type == hw_write ? "hw-write-watchpoint"
6240d7
 		  : (type == hw_read ? "hw-read-watchpoint"
6240d7
 		     : (type == hw_access ? "hw-access-watchpoint"
6240d7
@@ -832,7 +833,7 @@ aarch64_linux_get_debug_reg_capacity (int tid)
6240d7
    ADDR and whose length is LEN in bytes.  */
6240d7
 
6240d7
 int
6240d7
-aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, int len)
6240d7
+aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, LONGEST len)
6240d7
 {
6240d7
   CORE_ADDR aligned_addr;
6240d7
 
6240d7
diff --git a/gdb/nat/aarch64-linux-hw-point.h b/gdb/nat/aarch64-linux-hw-point.h
6240d7
--- a/gdb/nat/aarch64-linux-hw-point.h
6240d7
+++ b/gdb/nat/aarch64-linux-hw-point.h
6240d7
@@ -176,7 +176,7 @@ int aarch64_handle_breakpoint (enum target_hw_bp_type type, CORE_ADDR addr,
6240d7
 			       int len, int is_insert,
6240d7
 			       struct aarch64_debug_reg_state *state);
6240d7
 int aarch64_handle_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr,
6240d7
-			       int len, int is_insert,
6240d7
+			       LONGEST len, int is_insert,
6240d7
 			       struct aarch64_debug_reg_state *state);
6240d7
 
6240d7
 void aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state,
6240d7
@@ -189,12 +189,12 @@ bool aarch64_linux_any_set_debug_regs_state (aarch64_debug_reg_state *state,
6240d7
 
6240d7
 void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state,
6240d7
 				   const char *func, CORE_ADDR addr,
6240d7
-				   int len, enum target_hw_bp_type type);
6240d7
+				   LONGEST len, enum target_hw_bp_type type);
6240d7
 
6240d7
 void aarch64_linux_get_debug_reg_capacity (int tid);
6240d7
 
6240d7
 struct aarch64_debug_reg_state *aarch64_get_debug_reg_state (pid_t pid);
6240d7
 
6240d7
-int aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, int len);
6240d7
+int aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, LONGEST len);
6240d7
 
6240d7
 #endif /* NAT_AARCH64_LINUX_HW_POINT_H */
6240d7
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
6240d7
--- a/gdb/ppc-linux-nat.c
6240d7
+++ b/gdb/ppc-linux-nat.c
6240d7
@@ -284,7 +284,7 @@ struct ppc_linux_nat_target final : public linux_nat_target
6240d7
   int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *)
6240d7
     override;
6240d7
 
6240d7
-  int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
6240d7
+  int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override;
6240d7
 
6240d7
   int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
6240d7
 			 struct expression *) override;
6240d7
@@ -302,9 +302,9 @@ struct ppc_linux_nat_target final : public linux_nat_target
6240d7
 
6240d7
   bool stopped_data_address (CORE_ADDR *) override;
6240d7
 
6240d7
-  bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override;
6240d7
+  bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override;
6240d7
 
6240d7
-  bool can_accel_watchpoint_condition (CORE_ADDR, int, int, struct expression *)
6240d7
+  bool can_accel_watchpoint_condition (CORE_ADDR, LONGEST, int, struct expression *)
6240d7
     override;
6240d7
 
6240d7
   int masked_watch_num_registers (CORE_ADDR, CORE_ADDR) override;
6240d7
@@ -2065,11 +2065,11 @@ can_use_watchpoint_cond_accel (void)
6240d7
    CONDITION_VALUE will hold the value which should be put in the
6240d7
    DVC register.  */
6240d7
 static void
6240d7
-calculate_dvc (CORE_ADDR addr, int len, CORE_ADDR data_value,
6240d7
+calculate_dvc (CORE_ADDR addr, LONGEST len, CORE_ADDR data_value,
6240d7
 	       uint32_t *condition_mode, uint64_t *condition_value)
6240d7
 {
6240d7
-  int i, num_byte_enable, align_offset, num_bytes_off_dvc,
6240d7
-      rightmost_enabled_byte;
6240d7
+  LONGEST i, num_byte_enable;
6240d7
+  int align_offset, num_bytes_off_dvc, rightmost_enabled_byte;
6240d7
   CORE_ADDR addr_end_data, addr_end_dvc;
6240d7
 
6240d7
   /* The DVC register compares bytes within fixed-length windows which
6240d7
@@ -2157,7 +2157,7 @@ num_memory_accesses (const std::vector<value_ref_ptr> &chain)
6240d7
    of the constant.  */
6240d7
 static int
6240d7
 check_condition (CORE_ADDR watch_addr, struct expression *cond,
6240d7
-		 CORE_ADDR *data_value, int *len)
6240d7
+		 CORE_ADDR *data_value, LONGEST *len)
6240d7
 {
6240d7
   int pc = 1, num_accesses_left, num_accesses_right;
6240d7
   struct value *left_val, *right_val;
6240d7
@@ -2208,7 +2208,8 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond,
6240d7
    the condition expression, thus only triggering the watchpoint when it is
6240d7
    true.  */
6240d7
 bool
6240d7
-ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, int len,
6240d7
+ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr,
6240d7
+						      LONGEST len,
6240d7
 						      int rw,
6240d7
 						      struct expression *cond)
6240d7
 {
6240d7
@@ -2226,7 +2227,7 @@ ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, int len,
6240d7
 
6240d7
 static void
6240d7
 create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr,
6240d7
-			   int len, enum target_hw_bp_type type,
6240d7
+			   LONGEST len, enum target_hw_bp_type type,
6240d7
 			   struct expression *cond, int insert)
6240d7
 {
6240d7
   if (len == 1
6240d7
@@ -2492,7 +2493,7 @@ ppc_linux_nat_target::stopped_by_watchpoint ()
6240d7
 bool
6240d7
 ppc_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
6240d7
 						    CORE_ADDR start,
6240d7
-						    int length)
6240d7
+						    LONGEST length)
6240d7
 {
6240d7
   int mask;
6240d7
 
6240d7
diff --git a/gdb/procfs.c b/gdb/procfs.c
6240d7
--- a/gdb/procfs.c
6240d7
+++ b/gdb/procfs.c
6240d7
@@ -1546,7 +1546,7 @@ procfs_address_to_host_pointer (CORE_ADDR addr)
6240d7
 }
6240d7
 
6240d7
 static int
6240d7
-proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags)
6240d7
+proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, LONGEST len, int wflags)
6240d7
 {
6240d7
   struct {
6240d7
     procfs_ctl_t cmd;
6240d7
@@ -3238,7 +3238,7 @@ procfs_target::pid_to_exec_file (int pid)
6240d7
 /* Insert a watchpoint.  */
6240d7
 
6240d7
 static int
6240d7
-procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag,
6240d7
+procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, LONGEST len, int rwflag,
6240d7
 		       int after)
6240d7
 {
6240d7
   int       pflags = 0;
6240d7
diff --git a/gdb/remote.c b/gdb/remote.c
6240d7
--- a/gdb/remote.c
6240d7
+++ b/gdb/remote.c
6240d7
@@ -450,7 +450,7 @@ public:
6240d7
 
6240d7
   bool stopped_data_address (CORE_ADDR *) override;
6240d7
 
6240d7
-  bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override;
6240d7
+  bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override;
6240d7
 
6240d7
   int can_use_hw_breakpoint (enum bptype, int, int) override;
6240d7
 
6240d7
@@ -10335,7 +10335,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len,
6240d7
   p = strchr (rs->buf.data (), '\0');
6240d7
   addr = remote_address_masked (addr);
6240d7
   p += hexnumstr (p, (ULONGEST) addr);
6240d7
-  xsnprintf (p, endbuf - p, ",%x", len);
6240d7
+  xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len)));
6240d7
 
6240d7
   putpkt (rs->buf);
6240d7
   getpkt (&rs->buf, 0);
6240d7
@@ -10355,7 +10355,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len,
6240d7
 
6240d7
 bool
6240d7
 remote_target::watchpoint_addr_within_range (CORE_ADDR addr,
6240d7
-					     CORE_ADDR start, int length)
6240d7
+					     CORE_ADDR start, LONGEST length)
6240d7
 {
6240d7
   CORE_ADDR diff = remote_address_masked (addr - start);
6240d7
 
6240d7
@@ -10384,7 +10384,7 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len,
6240d7
   p = strchr (rs->buf.data (), '\0');
6240d7
   addr = remote_address_masked (addr);
6240d7
   p += hexnumstr (p, (ULONGEST) addr);
6240d7
-  xsnprintf (p, endbuf - p, ",%x", len);
6240d7
+  xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len)));
6240d7
   putpkt (rs->buf);
6240d7
   getpkt (&rs->buf, 0);
6240d7
 
6240d7
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
6240d7
--- a/gdb/s390-linux-nat.c
6240d7
+++ b/gdb/s390-linux-nat.c
6240d7
@@ -121,7 +121,7 @@ public:
6240d7
     override;
6240d7
   int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *)
6240d7
     override;
6240d7
-  int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
6240d7
+  int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override;
6240d7
   bool stopped_by_watchpoint () override;
6240d7
   int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
6240d7
 			 struct expression *) override;
6240d7
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
6240d7
--- a/gdb/target-delegates.c
6240d7
+++ b/gdb/target-delegates.c
6240d7
@@ -37,9 +37,9 @@ struct dummy_target : public target_ops
6240d7
   bool stopped_by_watchpoint () override;
6240d7
   bool have_steppable_watchpoint () override;
6240d7
   bool stopped_data_address (CORE_ADDR *arg0) override;
6240d7
-  bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override;
6240d7
+  bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) override;
6240d7
   int region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) override;
6240d7
-  bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override;
6240d7
+  bool can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3) override;
6240d7
   int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override;
6240d7
   int can_do_single_step () override;
6240d7
   bool supports_terminal_ours () override;
6240d7
@@ -204,9 +204,9 @@ struct debug_target : public target_ops
6240d7
   bool stopped_by_watchpoint () override;
6240d7
   bool have_steppable_watchpoint () override;
6240d7
   bool stopped_data_address (CORE_ADDR *arg0) override;
6240d7
-  bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override;
6240d7
+  bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) override;
6240d7
   int region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) override;
6240d7
-  bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override;
6240d7
+  bool can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3) override;
6240d7
   int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override;
6240d7
   int can_do_single_step () override;
6240d7
   bool supports_terminal_ours () override;
6240d7
@@ -1041,19 +1041,19 @@ debug_target::stopped_data_address (CORE_ADDR *arg0)
6240d7
 }
6240d7
 
6240d7
 bool
6240d7
-target_ops::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
6240d7
+target_ops::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2)
6240d7
 {
6240d7
   return this->beneath ()->watchpoint_addr_within_range (arg0, arg1, arg2);
6240d7
 }
6240d7
 
6240d7
 bool
6240d7
-dummy_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
6240d7
+dummy_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2)
6240d7
 {
6240d7
   return default_watchpoint_addr_within_range (this, arg0, arg1, arg2);
6240d7
 }
6240d7
 
6240d7
 bool
6240d7
-debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
6240d7
+debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2)
6240d7
 {
6240d7
   bool result;
6240d7
   fprintf_unfiltered (gdb_stdlog, "-> %s->watchpoint_addr_within_range (...)\n", this->beneath ()->shortname ());
6240d7
@@ -1063,7 +1063,7 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int
6240d7
   fputs_unfiltered (", ", gdb_stdlog);
6240d7
   target_debug_print_CORE_ADDR (arg1);
6240d7
   fputs_unfiltered (", ", gdb_stdlog);
6240d7
-  target_debug_print_int (arg2);
6240d7
+  target_debug_print_LONGEST (arg2);
6240d7
   fputs_unfiltered (") = ", gdb_stdlog);
6240d7
   target_debug_print_bool (result);
6240d7
   fputs_unfiltered ("\n", gdb_stdlog);
6240d7
@@ -1099,19 +1099,19 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1)
6240d7
 }
6240d7
 
6240d7
 bool
6240d7
-target_ops::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
6240d7
+target_ops::can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3)
6240d7
 {
6240d7
   return this->beneath ()->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3);
6240d7
 }
6240d7
 
6240d7
 bool
6240d7
-dummy_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
6240d7
+dummy_target::can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3)
6240d7
 {
6240d7
   return false;
6240d7
 }
6240d7
 
6240d7
 bool
6240d7
-debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
6240d7
+debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3)
6240d7
 {
6240d7
   bool result;
6240d7
   fprintf_unfiltered (gdb_stdlog, "-> %s->can_accel_watchpoint_condition (...)\n", this->beneath ()->shortname ());
6240d7
@@ -1119,7 +1119,7 @@ debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2
6240d7
   fprintf_unfiltered (gdb_stdlog, "<- %s->can_accel_watchpoint_condition (", this->beneath ()->shortname ());
6240d7
   target_debug_print_CORE_ADDR (arg0);
6240d7
   fputs_unfiltered (", ", gdb_stdlog);
6240d7
-  target_debug_print_int (arg1);
6240d7
+  target_debug_print_LONGEST (arg1);
6240d7
   fputs_unfiltered (", ", gdb_stdlog);
6240d7
   target_debug_print_int (arg2);
6240d7
   fputs_unfiltered (", ", gdb_stdlog);
6240d7
diff --git a/gdb/target.c b/gdb/target.c
6240d7
--- a/gdb/target.c
6240d7
+++ b/gdb/target.c
6240d7
@@ -55,7 +55,7 @@ static void generic_tls_error (void) ATTRIBUTE_NORETURN;
6240d7
 static void default_terminal_info (struct target_ops *, const char *, int);
6240d7
 
6240d7
 static int default_watchpoint_addr_within_range (struct target_ops *,
6240d7
-						 CORE_ADDR, CORE_ADDR, int);
6240d7
+						 CORE_ADDR, CORE_ADDR, LONGEST);
6240d7
 
6240d7
 static int default_region_ok_for_hw_watchpoint (struct target_ops *,
6240d7
 						CORE_ADDR, LONGEST);
6240d7
@@ -3111,7 +3111,7 @@ default_region_ok_for_hw_watchpoint (struct target_ops *self,
6240d7
 static int
6240d7
 default_watchpoint_addr_within_range (struct target_ops *target,
6240d7
 				      CORE_ADDR addr,
6240d7
-				      CORE_ADDR start, int length)
6240d7
+				      CORE_ADDR start, LONGEST length)
6240d7
 {
6240d7
   return addr >= start && addr < start + length;
6240d7
 }
6240d7
diff --git a/gdb/target.h b/gdb/target.h
6240d7
--- a/gdb/target.h
6240d7
+++ b/gdb/target.h
6240d7
@@ -561,7 +561,7 @@ struct target_ops
6240d7
       TARGET_DEFAULT_RETURN (false);
6240d7
     virtual bool stopped_data_address (CORE_ADDR *)
6240d7
       TARGET_DEFAULT_RETURN (false);
6240d7
-    virtual bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int)
6240d7
+    virtual bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST)
6240d7
       TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range);
6240d7
 
6240d7
     /* Documentation of this routine is provided with the corresponding
6240d7
@@ -569,7 +569,7 @@ struct target_ops
6240d7
     virtual int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST)
6240d7
       TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint);
6240d7
 
6240d7
-    virtual bool can_accel_watchpoint_condition (CORE_ADDR, int, int,
6240d7
+    virtual bool can_accel_watchpoint_condition (CORE_ADDR, LONGEST, int,
6240d7
 						 struct expression *)
6240d7
       TARGET_DEFAULT_RETURN (false);
6240d7
     virtual int masked_watch_num_registers (CORE_ADDR, CORE_ADDR)