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

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