* procfs.c (procfs_can_use_hw_breakpoint): New function.
authorKevin Buettner <kevinb@redhat.com>
Tue, 13 Aug 2002 18:03:38 +0000 (18:03 +0000)
committerKevin Buettner <kevinb@redhat.com>
Tue, 13 Aug 2002 18:03:38 +0000 (18:03 +0000)
(init_procfs_ops): Define ``to_can_use_hw_breakpoint'' for procfs
target vector.
* config/mips/nm-irix5.h (TARGET_CAN_USE_HARDWARE_WATCHPOINT):
Delete.  Add comment regarding this now-deleted target method.

gdb/ChangeLog
gdb/config/mips/nm-irix5.h
gdb/procfs.c

index 1f70d123fa8ed5673048e0fff32c857861438a76..489279e5708678b545bc1fffe23af05dd0902c51 100644 (file)
@@ -1,3 +1,11 @@
+2002-08-13  Kevin Buettner  <kevinb@redhat.com>
+
+       * procfs.c (procfs_can_use_hw_breakpoint): New function.
+       (init_procfs_ops): Define ``to_can_use_hw_breakpoint'' for procfs
+       target vector.
+       * config/mips/nm-irix5.h (TARGET_CAN_USE_HARDWARE_WATCHPOINT):
+       Delete.  Add comment regarding this now-deleted target method.
+
 2002-08-13  Stephane Carrez  <stcarrez@nerim.fr>
 
        * m68hc11-tdep.c (M68HC12_NUM_PSEUDO_REGS): New define.
index 8e31b59281104799576704ca4e7318c90cbf97b7..59749f663356a5134c7844d353c2035bb606b696 100644 (file)
@@ -24,7 +24,9 @@
 
 #define TARGET_HAS_HARDWARE_WATCHPOINTS
 
-#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
+/* TARGET_CAN_USE_HARDWARE_WATCHPOINT is now defined to go through
+   the target vector.  For Irix5, procfs_can_use_hw_watchpoint()
+   should be invoked.  */
 
 /* When a hardware watchpoint fires off the PC will be left at the
    instruction which caused the watchpoint.  It will be necessary for
index 768889926469b22180d6a7a74b3706ab5ce40b6d..79f55758dfeed3a0f699c9726c2feeee4d8f50aa 100644 (file)
@@ -136,6 +136,8 @@ static int proc_find_memory_regions (int (*) (CORE_ADDR,
 
 static char * procfs_make_note_section (bfd *, int *);
 
+static int procfs_can_use_hw_breakpoint (int, int, int);
+
 struct target_ops procfs_ops;          /* the target vector */
 
 static void
@@ -183,6 +185,7 @@ init_procfs_ops (void)
   procfs_ops.to_has_thread_control  = tc_schedlock;
   procfs_ops.to_find_memory_regions = proc_find_memory_regions;
   procfs_ops.to_make_corefile_notes = procfs_make_note_section;
+  procfs_ops.to_can_use_hw_breakpoint = procfs_can_use_hw_breakpoint;
   procfs_ops.to_magic               = OPS_MAGIC;
 }
 
@@ -5138,6 +5141,37 @@ procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag,
   return 0;
 }
 
+/* Return non-zero if we can set a hardware watchpoint of type TYPE.  TYPE
+   is one of bp_hardware_watchpoint, bp_read_watchpoint, bp_write_watchpoint,
+   or bp_hardware_watchpoint.  CNT is the number of watchpoints used so
+   far.
+   
+   Note:  procfs_can_use_hw_breakpoint() is not yet used by all
+   procfs.c targets due to the fact that some of them still define
+   TARGET_CAN_USE_HARDWARE_WATCHPOINT.  */
+
+static int
+procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
+{
+#ifndef TARGET_HAS_HARDWARE_WATCHPOINTS
+  return 0;
+#else
+  /* Due to the way that proc_set_watchpoint() is implemented, host
+     and target pointers must be of the same size.  If they are not,
+     we can't use hardware watchpoints.  This limitation is due to the
+     fact that proc_set_watchpoint() calls address_to_host_pointer();
+     a close inspection of address_to_host_pointer will reveal that
+     an internal error will be generated when the host and target
+     pointer sizes are different.  */
+  if (sizeof (void *) != TYPE_LENGTH (builtin_type_void_data_ptr))
+    return 0;
+
+  /* Other tests here???  */
+
+  return 1;
+#endif
+}
+
 /*
  * Function: stopped_by_watchpoint
  *
This page took 0.037805 seconds and 4 git commands to generate.