]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove some unnecessary watchpoint_addr_within_range overrides
authorAndrew Burgess <aburgess@redhat.com>
Mon, 18 Aug 2025 10:49:21 +0000 (11:49 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Tue, 19 Aug 2025 14:57:14 +0000 (15:57 +0100)
While looking at the watchpoint code, I realised that AArch64, ARM,
and Loongarch all override watchpoint_addr_within_range with an
implementation that is the same as the default (but with the logic
written slightly differently).

Compare the deleted functions to default_watchpoint_addr_within_range
in target.c.

The only other targets that override watchpoint_addr_within_range are
ppc_linux_nat_target and remote_target, in both cases the
implementation is different to the default.

Lets remove these unnecessary overrides, and just use the default.

There should be no user visible changes after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/aarch64-nat.h
gdb/arm-linux-nat.c
gdb/loongarch-linux-nat.c

index 3120bca083e7d1863bce083228455b56f30c46d5..ec7c56452aed03cb85914009d05dfc824f0ebb1c 100644 (file)
@@ -92,10 +92,6 @@ struct aarch64_nat_target : public BaseTarget
   int remove_hw_breakpoint (struct gdbarch *gdbarch,
                            struct bp_target_info *bp_tgt) override
   { return aarch64_remove_hw_breakpoint (gdbarch, bp_tgt); }
-
-  bool watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start,
-                                    int length) override
-  { return start <= addr && start + length - 1 >= addr; }
 };
 
 #endif /* GDB_AARCH64_NAT_H */
index 813da8cdda206ca8c7cb6e6e589a64f6ac6cc8bf..dc5165e3a79eda17d169606e448b053ebd7ef51c 100644 (file)
@@ -90,8 +90,6 @@ public:
 
   bool stopped_data_address (CORE_ADDR *) override;
 
-  bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override;
-
   const struct target_desc *read_description () override;
 
   /* Override linux_nat_target low methods.  */
@@ -1206,14 +1204,6 @@ arm_linux_nat_target::stopped_by_watchpoint ()
   return stopped_data_address (&addr);
 }
 
-bool
-arm_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
-                                                   CORE_ADDR start,
-                                                   int length)
-{
-  return start <= addr && start + length - 1 >= addr;
-}
-
 /* Handle thread creation.  We need to copy the breakpoints and watchpoints
    in the parent thread to the child thread.  */
 void
index 2b59b3643423e6ababd478284894dd38f5d26201..1360acf3d97fb431fec576d935bd3c77aad8fb39 100644 (file)
@@ -72,8 +72,6 @@ public:
                         struct expression *cond) override;
   int remove_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
                         struct expression *cond) override;
-  bool watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start,
-                                    int length) override;
 
   /* Add our hardware breakpoint and watchpoint implementation.  */
   bool stopped_by_watchpoint () override;
@@ -581,15 +579,6 @@ loongarch_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
 
 }
 
-bool
-loongarch_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
-                                                         CORE_ADDR start,
-                                                         int length)
-{
-  return start <= addr && start + length - 1 >= addr;
-}
-
-
 /* Implement the "stopped_data_address" target_ops method.  */
 
 bool