[patch/rfc] Eliminate TARGET_HAS_HARDWARE_WATCHPOINTS

Andrew Cagney
2004-09-05T13:59:23Z

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

Hello,

Here there are several things to notice:

- core GDB no longer refers to TARGET_HAS_HARDWARE_WATCHPOINTS
At one stage target.h had definitions dependant on this macro, but no
more. This patch removes the no-longer-needed defintion from
configurations, such as GNU/Linux.

- procfs.c and i386v-nat.c do refer to TARGET_HAS_HARDWARE_WATCHPOINTS
These files should be replying on an autoconf test. This patch replaces
those cases with DEPRECATED_{PROCFS,I386V}_USE_HARDWARE_WATCHPOINTS macros.

That leaves no definition so this patch also removes the corresponding
documentation.

Comments?
Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 11215 bytes --]

Index: doc/ChangeLog

* gdbint.texinfo (Algorithms): Delete reference to
TARGET_HAS_HARDWARE_WATCHPOINTS.
(Target Architecture Definition): Ditto.

Index: ChangeLog

* procfs.c: Replace TARGET_HAS_HARDWARE_WATCHPOINTS with
DEPRECATED_PROCFS_USE_HARDWARE_WATCHPOINTS.
* i386v-nat.c: Replace TARGET_HAS_HARDWARE_WATCHPOINTS with
DEPRECATED_I386V_USE_HARDWARE_WATCHPOINTS.
* config/sparc/nm-sol2.h (TARGET_HAS_HARDWARE_WATCHPOINTS):
Replace with DEPRECATED_PROCFS_USE_HARDWARE_WATCHPOINTS.
* config/mips/nm-irix5.h (TARGET_HAS_HARDWARE_WATCHPOINTS):
Replace with PROCFS_USE_HARDWARE_WATCHPOINTS.
* config/i386/nm-i386sol2.h (TARGET_HAS_HARDWARE_WATCHPOINTS):
Replace with DEPRECATED_PROCFS_USE_HARDWARE_WATCHPOINTS.
* config/i386/nm-i386sco5.h (TARGET_HAS_HARDWARE_WATCHPOINTS):
Replace with DEPRECATED_I386V_USE_HARDWARE_WATCHPOINTS.
* config/i386/nm-i386.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.
* config/s390/nm-linux.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.
* config/pa/nm-hppah.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.
* config/ia64/nm-linux.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.
* config/frv/tm-frv.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.
* mips-tdep.c (mips_dump_tdep): Do not print same.

Index: i386v-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386v-nat.c,v
retrieving revision 1.14
diff -p -u -r1.14 i386v-nat.c
--- i386v-nat.c 19 Jan 2003 04:06:45 -0000 1.14
+++ i386v-nat.c 5 Sep 2004 13:03:21 -0000
@@ -46,7 +46,7 @@
#include <sys/ioctl.h>
#include <fcntl.h>

-#ifdef TARGET_HAS_HARDWARE_WATCHPOINTS
+#ifdef DEPRECATED_I386V_USE_HARDWARE_WATCHPOINTS
#include <sys/debugreg.h>
#endif

@@ -108,7 +108,7 @@ kernel_u_size (void)
return (sizeof (struct user));
}
\f
-#ifdef TARGET_HAS_HARDWARE_WATCHPOINTS
+#ifdef DEPRECATED_I386V_USE_HARDWARE_WATCHPOINTS

#if !defined (offsetof)
#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
@@ -274,4 +274,4 @@ i386_stopped_by_watchpoint (int pid)
return 0;
}

-#endif /* TARGET_HAS_HARDWARE_WATCHPOINTS */
+#endif /* DEPRECATED_I386V_USE_HARDWARE_WATCHPOINTS */
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.320
diff -p -u -r1.320 mips-tdep.c
--- mips-tdep.c 4 Sep 2004 00:16:56 -0000 1.320
+++ mips-tdep.c 5 Sep 2004 13:03:25 -0000
@@ -6606,9 +6606,6 @@ mips_dump_tdep (struct gdbarch *current_
"mips_dump_tdep: TARGET_CAN_USE_HARDWARE_WATCHPOINT # %s\n",
XSTRING (TARGET_CAN_USE_HARDWARE_WATCHPOINT
(TYPE, CNT, OTHERTYPE)));
- fprintf_unfiltered (file,
- "mips_dump_tdep: TARGET_HAS_HARDWARE_WATCHPOINTS # %s\n",
- XSTRING (TARGET_HAS_HARDWARE_WATCHPOINTS));
#ifdef TRACE_CLEAR
fprintf_unfiltered (file,
"mips_dump_tdep: TRACE_CLEAR # %s\n",
Index: procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.58
diff -p -u -r1.58 procfs.c
--- procfs.c 27 Aug 2004 13:37:42 -0000 1.58
+++ procfs.c 5 Sep 2004 13:03:27 -0000
@@ -2875,7 +2875,7 @@ procfs_address_to_host_pointer (CORE_ADD
int
proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags)
{
-#if !defined (TARGET_HAS_HARDWARE_WATCHPOINTS)
+#if !defined (DEPRECATED_PROCFS_USE_HARDWARE_WATCHPOINTS)
return 0;
#else
/* Horrible hack! Detect Solaris 2.5, because this doesn't work on 2.5 */
@@ -5279,7 +5279,7 @@ procfs_set_watchpoint (ptid_t ptid, CORE
static int
procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
{
-#ifndef TARGET_HAS_HARDWARE_WATCHPOINTS
+#ifndef DEPRECATED_PROCFS_USE_HARDWARE_WATCHPOINTS
return 0;
#else
/* Due to the way that proc_set_watchpoint() is implemented, host
Index: config/frv/tm-frv.h
===================================================================
RCS file: /cvs/src/src/gdb/config/frv/tm-frv.h,v
retrieving revision 1.5
diff -p -u -r1.5 tm-frv.h
--- config/frv/tm-frv.h 1 Aug 2004 14:37:01 -0000 1.5
+++ config/frv/tm-frv.h 5 Sep 2004 13:03:27 -0000
@@ -20,8 +20,6 @@

/* This target uses an architecture vector for most architecture methods. */

-#define TARGET_HAS_HARDWARE_WATCHPOINTS
-
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
frv_check_watch_resources (type, cnt, ot)
extern int frv_check_watch_resources (int type, int cnt, int ot);
Index: config/i386/nm-i386.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-i386.h,v
retrieving revision 1.5
diff -p -u -r1.5 nm-i386.h
--- config/i386/nm-i386.h 17 Jan 2004 21:56:12 -0000 1.5
+++ config/i386/nm-i386.h 5 Sep 2004 13:03:27 -0000
@@ -26,10 +26,6 @@
/* Targets should define this to use the generic x86 watchpoint support. */
#ifdef I386_USE_GENERIC_WATCHPOINTS

-#ifndef TARGET_HAS_HARDWARE_WATCHPOINTS
-#define TARGET_HAS_HARDWARE_WATCHPOINTS
-#endif
-
/* Clear the reference counts and forget everything we knew about DRi. */
extern void i386_cleanup_dregs (void);

Index: config/i386/nm-i386sco5.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-i386sco5.h,v
retrieving revision 1.6
diff -p -u -r1.6 nm-i386sco5.h
--- config/i386/nm-i386sco5.h 3 Sep 2004 17:13:47 -0000 1.6
+++ config/i386/nm-i386sco5.h 5 Sep 2004 13:03:27 -0000
@@ -52,8 +52,10 @@ extern int kernel_u_size (void);

/* Hardware-assisted breakpoints and watchpoints. */

+/* NOTE: cagney/2004-09-04: Replace macro with autoconf test. */
+#define DEPRECATED_I386V_USE_HARDWARE_WATCHPOINTS
+
/* We can also do hardware watchpoints. */
-#define TARGET_HAS_HARDWARE_WATCHPOINTS
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1

/* After a watchpoint trap, the PC points to the instruction which
Index: config/i386/nm-i386sol2.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-i386sol2.h,v
retrieving revision 1.9
diff -p -u -r1.9 nm-i386sol2.h
--- config/i386/nm-i386sol2.h 10 Aug 2003 13:49:33 -0000 1.9
+++ config/i386/nm-i386sol2.h 5 Sep 2004 13:03:27 -0000
@@ -22,7 +22,8 @@

#ifdef NEW_PROC_API /* Solaris 6 and above can do HW watchpoints */

-#define TARGET_HAS_HARDWARE_WATCHPOINTS
+/* NOTE: cagney/2004-09-04: Replace with autoconf test. */
+#define DEPRECATED_PROCFS_USE_HARDWARE_WATCHPOINTS

/* The man page for proc4 on solaris 6 and 7 says that the system
can support "thousands" of hardware watchpoints, but gives no
Index: config/ia64/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/nm-linux.h,v
retrieving revision 1.14
diff -p -u -r1.14 nm-linux.h
--- config/ia64/nm-linux.h 22 Aug 2004 16:32:35 -0000 1.14
+++ config/ia64/nm-linux.h 5 Sep 2004 13:03:28 -0000
@@ -45,8 +45,6 @@ extern int ia64_cannot_store_register (i

/* Hardware watchpoints */

-#define TARGET_HAS_HARDWARE_WATCHPOINTS
-
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1

/* The IA-64 architecture can step over a watch point (without triggering
Index: config/mips/nm-irix5.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/nm-irix5.h,v
retrieving revision 1.9
diff -p -u -r1.9 nm-irix5.h
--- config/mips/nm-irix5.h 29 Jul 2004 21:36:58 -0000 1.9
+++ config/mips/nm-irix5.h 5 Sep 2004 13:03:28 -0000
@@ -22,7 +22,8 @@
#include "config/nm-sysv4.h"
#undef IN_SOLIB_DYNSYM_RESOLVE_CODE

-#define TARGET_HAS_HARDWARE_WATCHPOINTS
+/* NOTE: cagney/2004-09-04: Replace macro with autoconf test. */
+#define DEPRECATED_PROCFS_USE_HARDWARE_WATCHPOINTS

/* TARGET_CAN_USE_HARDWARE_WATCHPOINT is now defined to go through
the target vector. For Irix5, procfs_can_use_hw_watchpoint()
Index: config/pa/nm-hppah.h
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/nm-hppah.h,v
retrieving revision 1.21
diff -p -u -r1.21 nm-hppah.h
--- config/pa/nm-hppah.h 11 Aug 2004 21:51:28 -0000 1.21
+++ config/pa/nm-hppah.h 5 Sep 2004 13:03:28 -0000
@@ -98,8 +98,6 @@ extern int hppa_require_detach (int, int
10.20 will at least link. However, the "can I use a fast watchpoint?"
query will always return "No" for 10.20. */

-#define TARGET_HAS_HARDWARE_WATCHPOINTS
-
/* The PA can watch any number of locations (generic routines already check
that all intermediates are in watchable memory locations). */
extern int hppa_can_use_hw_watchpoint (int type, int cnt, int ot);
Index: config/s390/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/s390/nm-linux.h,v
retrieving revision 1.10
diff -p -u -r1.10 nm-linux.h
--- config/s390/nm-linux.h 18 Feb 2004 20:09:48 -0000 1.10
+++ config/s390/nm-linux.h 5 Sep 2004 13:03:28 -0000
@@ -45,7 +45,6 @@ extern int s390_stopped_by_watchpoint (v
extern int s390_insert_watchpoint (CORE_ADDR addr, int len);
extern int s390_remove_watchpoint (CORE_ADDR addr, int len);

-#define TARGET_HAS_HARDWARE_WATCHPOINTS
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) 1
#define HAVE_CONTINUABLE_WATCHPOINT 1
Index: config/sparc/nm-sol2.h
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nm-sol2.h,v
retrieving revision 1.2
diff -p -u -r1.2 nm-sol2.h
--- config/sparc/nm-sol2.h 3 Jan 2004 10:08:45 -0000 1.2
+++ config/sparc/nm-sol2.h 5 Sep 2004 13:03:28 -0000
@@ -33,7 +33,8 @@
/* Solaris 2.6 and above can do HW watchpoints. */
#ifdef NEW_PROC_API

-#define TARGET_HAS_HARDWARE_WATCHPOINTS
+/* NOTE: cagney/2004-09-04: Replace macro with autoconf test. */
+#define DEPRECATED_PROCFS_USE_HARDWARE_WATCHPOINTS

/* The man page for proc(4) on Solaris 2.6 and up says that the system
can support "thousands" of hardware watchpoints, but gives no
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.222
diff -p -u -r1.222 gdbint.texinfo
--- doc/gdbint.texinfo 3 Sep 2004 17:13:48 -0000 1.222
+++ doc/gdbint.texinfo 5 Sep 2004 13:03:34 -0000
@@ -400,10 +400,6 @@ section is mostly irrelevant for softwar
watchpoints:

@table @code
-@findex TARGET_HAS_HARDWARE_WATCHPOINTS
-@item TARGET_HAS_HARDWARE_WATCHPOINTS
-If defined, the target supports hardware watchpoints.
-
@findex TARGET_CAN_USE_HARDWARE_WATCHPOINT
@item TARGET_CAN_USE_HARDWARE_WATCHPOINT (@var{type}, @var{count}, @var{other})
Return the number of hardware watchpoints of type @var{type} that are
@@ -3833,11 +3829,6 @@ pointer in use at the code address @var{
are not used, a default definition simply returns
@code{DEPRECATED_FP_REGNUM}, with an offset of zero.

-@item TARGET_HAS_HARDWARE_WATCHPOINTS
-If non-zero, the target has support for hardware-assisted
-watchpoints. @xref{Algorithms, watchpoints}, for more details and
-other related macros.
-
@item TARGET_PRINT_INSN (@var{addr}, @var{info})
@findex TARGET_PRINT_INSN
This is the function used by @value{GDBN} to print an assembly