This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC-v2] Remove i386 low level debug register function from nm- header file.


This is a new version of the patch.

I tried to take into account all remarks from Ulrich.

I also tested it on a amd64 linux machine,
and had to change two functions in amd64-linux-nat.c
to be able to compile it on that target.

  Testsuite showed no significant difference.


I tried to handle Eli's request by
moving the show-debug-regs command addition to i386_use_watchpoints
function with a safeguard to avoid multiple additions.

Comments?

Pierre

ChangeLog entry:
2009-05-08  Pierre Muller  <muller.u-strasbg.fr>

	Remove all i386 debug register low level macros in config nm files.
	(I386_DR_LOW_SET_ADDR, I386_DR_LOW_RESET_ADDR): Remove.
	(I386_DR_LOW_GET_STATUS, I386_DR_LOW_SET_CONTROL): Remove.
	(I386_USE_GENERIC_WATCHPOIINTS): Remove.

	* i386-nat.h: New file (adapted from config/i386/nm-i386.h).
	(struct i386_dr_low_type): New type.
	(i386_dr_low): New global variable.
	* i386-nat.c (TARGET_HAS_DR_LEN_8): Update macro.
	(i386_insert_aligned_watchpoint): Replace i386 dr low macros by
	i386_dr_low struct variable fields.
	(i386_remove_aligned_watchpoint): Likewise.
	(i386_stopped_data_address): Likewise.
	(i386_stopped_by_hwbp): Likewise.
	(show_debug_regs_command_added): New static variable.
	(add_show_debug_regs_command): New static function.
	(i386_use_watchpoints): Call add_show_debug_regs_command if not
done.
	(i386_set_debug_register_length): New function.
	(_initialize_i386_nat): Delete.
	
	* amd64-linux-nat.c: Include "i386-nat.h".
	(amd64_linux_dr_set_control):  Change arg type to unsigned.
	(amd64_linux_dr_get_status): Change return type to unsigned.
	(_initialize_amd64_linux_nat): Set i386_dr_low variable fields.
	* go32-nat.c (init_go32_ops): Likewise.
	* i386-linux-nat.c (_initialize_i386_linux_nat): Likewise.
	* i386fbsd-nat.c (_initialize_i386fbsd_nat): Likewise.
	* windows-nat.c: Include "i386-nat.h".
	(cygwin_set_dr, cygwin_get_dr6, cygwin_set_dr7): Add prototypes.
	(init_windows_ops): Set i386_dr_low function fields.

	* amd64-windows-nat.c (_initialize_amd64_windows_nat): Call 
	i386_set_debug_register_length.
	* i386-windows-nat.c (_initialize_i386_windows_nat): Likewise.

	* config/i386/nm-cygwin.h: Remove all I386_* macros.
	* config/i386/nm-cygwin64.h: Likewise.
	* config/i386/nm-fbsd.h: Likewise.
	* config/i386/nm-linux.h: Likewise.
	* config/i386/nm-i386.h: Remove completely.
	* config/i386/nm-go32.h: Remove completely.
	* config/i386/nm-linux64.h: Remove completely.
	* config/i386/go32.mh (NAT_FILE): Remove entry.
	* config/i386/linux64.h (NAT_FILE): Change to config/nm-linux.h.

Index: src/gdb/i386-nat.h
===================================================================
RCS file: i386-nat.h
diff -N i386-nat.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/gdb/i386-nat.h	12 May 2009 15:50:35 -0000
@@ -0,0 +1,125 @@
+/* Native-dependent code for the i386.
+
+   Low level functions to implement Oeprating System specific
+   code to manipulate I386 debug registers.
+
+   Copyright (C) 2009
+   Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
+
+#include "config.h"
+#include "defs.h"
+#include "breakpoint.h"
+#include "command.h"
+#include "gdbcmd.h"
+
+#ifndef I386_NAT_H
+#define I386_NAT_H 1
+
+/* Hardware-assisted breakpoints and watchpoints.  */
+
+/* Add watchpoint methods to the provided target_ops.  
+   Targets using i386 family debug registers for watchpoints should call
+   this.  */
+struct target_ops;
+extern void i386_use_watchpoints (struct target_ops *);
+
+/* Clear the reference counts and forget everything we knew about DRi.  */
+extern void i386_cleanup_dregs (void);
+
+/* Insert a watchpoint to watch a memory region which starts at
+   address ADDR and whose length is LEN bytes.  Watch memory accesses
+   of the type TYPE.  Return 0 on success, -1 on failure.  */
+extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Remove a watchpoint that watched the memory region which starts at
+   address ADDR, whose length is LEN bytes, and for accesses of the
+   type TYPE.  Return 0 on success, -1 on failure.  */
+extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Return non-zero if we can watch a memory region that starts at
+   address ADDR and whose length is LEN bytes.  */
+extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);
+
+/* Return non-zero if the inferior has some break/watchpoint that
+   triggered.  */
+extern int i386_stopped_by_hwbp (void);
+
+/* If the inferior has some break/watchpoint that triggered, set
+   the address associated with that break/watchpoint and return
+   true.  Otherwise, return false.  */
+extern int i386_stopped_data_address (struct target_ops *, CORE_ADDR *);
+
+/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
+   Return 0 on success, EBUSY on failure.  */
+struct bp_target_info;
+extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt);
+
+/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
+   Return 0 on success, -1 on failure.  */
+extern int i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt);
+
+extern int i386_stopped_by_watchpoint (void);
+
+/* Support for hardware watchpoints and breakpoints using the i386
+   debug registers.
+
+   This provides several functions for inserting and removing
+   hardware-assisted breakpoints and watchpoints, testing if one or
+   more of the watchpoints triggered and at what address, checking
+   whether a given region can be watched, etc.
+
+   In addition, each target should provide several low-level functions
+   regrouped into i386_dr_low_type struct below. These functions
+   that will be called to insert watchpoints and hardware breakpoints
+   into the inferior, remove them, and check their status.  These
+   functions are:
+
+      set_control              -- set the debug control (DR7)
+				  register to a given value
+
+      set_addr                 -- put an address into one debug
+				  register
+
+      reset_addr               -- reset the address stored in
+				  one debug register
+
+      get_status               -- return the value of the debug
+				  status (DR6) register.
+
+   Additionally, the native file should set the debug_register_length
+   field to 4 or 8 depending on the number of bytes used for
+   deubg registers.  */
+
+struct i386_dr_low_type 
+  {
+    void (*set_control) (unsigned);
+    void (*set_addr) (int, CORE_ADDR);
+    void (*reset_addr) (int);
+    unsigned (*get_status) (void);
+    int debug_register_length;
+  };
+
+struct i386_dr_low_type i386_dr_low;
+
+/* Use this function to set i386_dr_low debug_register_length field
+   rather than setting it directly to check that the length is only
+   set once.  */
+
+extern void i386_set_debug_register_length (int len);
+
+#endif /* I386_NAT_H */
Index: src/gdb/amd64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-linux-nat.c,v
retrieving revision 1.25
diff -u -p -r1.25 amd64-linux-nat.c
--- src/gdb/amd64-linux-nat.c	17 Mar 2009 18:39:08 -0000	1.25
+++ src/gdb/amd64-linux-nat.c	12 May 2009 14:07:00 -0000
@@ -50,6 +50,7 @@
 #include "amd64-tdep.h"
 #include "i386-linux-tdep.h"
 #include "amd64-nat.h"
+#include "i386-nat.h"
 
 /* Mapping between the general-purpose registers in GNU/Linux x86-64
    `struct user' format and GDB's register cache layout.  */
@@ -286,7 +287,7 @@ amd64_linux_dr_set (ptid_t ptid, int reg
 }
 
 void
-amd64_linux_dr_set_control (unsigned long control)
+amd64_linux_dr_set_control (unsigned control)
 {
   struct lwp_info *lp;
   ptid_t ptid;
@@ -315,10 +316,10 @@ amd64_linux_dr_reset_addr (int regnum)
   amd64_linux_dr_set_addr (regnum, 0);
 }
 
-unsigned long
+unsigned
 amd64_linux_dr_get_status (void)
 {
-  return amd64_linux_dr_get (inferior_ptid, DR_STATUS);
+  return (unsigned) amd64_linux_dr_get (inferior_ptid, DR_STATUS);
 }
 
 static void
@@ -667,6 +668,12 @@ _initialize_amd64_linux_nat (void)
 
   i386_use_watchpoints (t);
 
+  i386_dr_low.set_control = amd64_linux_dr_set_control;
+  i386_dr_low.set_addr = amd64_linux_dr_set_addr;
+  i386_dr_low.reset_addr = amd64_linux_dr_reset_addr;
+  i386_dr_low.get_status = amd64_linux_dr_get_status;
+  i386_set_debug_register_length (8);
+
   /* Override the GNU/Linux inferior startup hook.  */
   super_post_startup_inferior = t->to_post_startup_inferior;
   t->to_post_startup_inferior = amd64_linux_child_post_startup_inferior;
Index: src/gdb/amd64-windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-windows-nat.c,v
retrieving revision 1.3
diff -u -p -r1.3 amd64-windows-nat.c
--- src/gdb/amd64-windows-nat.c	13 Jan 2009 04:14:07 -0000	1.3
+++ src/gdb/amd64-windows-nat.c	12 May 2009 14:07:00 -0000
@@ -17,7 +17,7 @@
 
 #include "defs.h"
 #include "windows-nat.h"
-
+#include "i386-nat.h"
 #include <windows.h>
 
 #define context_offset(x) (offsetof (CONTEXT, x))
@@ -89,4 +89,5 @@ void
 _initialize_amd64_windows_nat (void)
 {
   windows_set_context_register_offsets (mappings);
+  i386_set_debug_register_length (8);
 }
Index: src/gdb/go32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/go32-nat.c,v
retrieving revision 1.74
diff -u -p -r1.74 go32-nat.c
--- src/gdb/go32-nat.c	4 May 2009 09:54:17 -0000	1.74
+++ src/gdb/go32-nat.c	12 May 2009 14:07:00 -0000
@@ -85,6 +85,7 @@
 #include <fcntl.h>
 
 #include "defs.h"
+#include "i386-nat.h"
 #include "inferior.h"
 #include "gdbthread.h"
 #include "gdb_wait.h"
@@ -975,6 +976,13 @@ init_go32_ops (void)
 
   i386_use_watchpoints (&go32_ops);
 
+
+  i386_dr_low.set_control = go32_set_dr7;
+  i386_dr_low.set_addr = go32_set_dr;
+  i386_dr_low.reset_addr = NULL;
+  i386_dr_low.get_status = go32_get_dr6;
+  i386_set_debug_register_length (4);
+
   go32_ops.to_magic = OPS_MAGIC;
 
   /* Initialize child's cwd as empty to be initialized when starting
Index: src/gdb/i386-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v
retrieving revision 1.90
diff -u -p -r1.90 i386-linux-nat.c
--- src/gdb/i386-linux-nat.c	23 Feb 2009 00:42:06 -0000	1.90
+++ src/gdb/i386-linux-nat.c	12 May 2009 14:07:01 -0000
@@ -19,6 +19,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
 
 #include "defs.h"
+#include "i386-nat.h"
 #include "inferior.h"
 #include "gdbcore.h"
 #include "regcache.h"
@@ -825,6 +826,12 @@ _initialize_i386_linux_nat (void)
 
   i386_use_watchpoints (t);
 
+  i386_dr_low.set_control = i386_linux_dr_set_control;
+  i386_dr_low.set_addr = i386_linux_dr_set_addr;
+  i386_dr_low.reset_addr = i386_linux_dr_reset_addr;
+  i386_dr_low.get_status = i386_linux_dr_get_status;
+  i386_set_debug_register_length (4);
+
   /* Override the default ptrace resume method.  */
   t->to_resume = i386_linux_resume;
 
Index: src/gdb/i386-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-nat.c,v
retrieving revision 1.20
diff -u -p -r1.20 i386-nat.c
--- src/gdb/i386-nat.c	12 May 2009 16:51:12 -0000	1.21
+++ src/gdb/i386-nat.c	12 May 2009 14:07:01 -0000
@@ -18,11 +18,13 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
 
+#include "i386-nat.h"
 #include "defs.h"
 #include "breakpoint.h"
 #include "command.h"
 #include "gdbcmd.h"
 #include "target.h"
+#include "gdb_assert.h"
 
 /* Support for hardware watchpoints and breakpoints using the i386
    debug registers.
@@ -32,38 +34,11 @@
    more of the watchpoints triggered and at what address, checking
    whether a given region can be watched, etc.
 
-   A target which wants to use these functions should define several
-   macros, such as `target_insert_watchpoint' and
-   `target_stopped_data_address', listed in target.h, to call the
-   appropriate functions below.  It should also define
-   I386_USE_GENERIC_WATCHPOINTS in its tm.h file.
-
-   In addition, each target should provide several low-level macros
-   that will be called to insert watchpoints and hardware breakpoints
-   into the inferior, remove them, and check their status.  These
-   macros are:
-
-      I386_DR_LOW_SET_CONTROL  -- set the debug control (DR7)
-				  register to a given value
-
-      I386_DR_LOW_SET_ADDR     -- put an address into one debug
-				  register
-
-      I386_DR_LOW_RESET_ADDR   -- reset the address stored in
-				  one debug register
-
-      I386_DR_LOW_GET_STATUS   -- return the value of the debug
-				  status (DR6) register.
-
    The functions below implement debug registers sharing by reference
    counts, and allow to watch regions up to 16 bytes long.  */
 
-#ifdef I386_USE_GENERIC_WATCHPOINTS
-
 /* Support for 8-byte wide hw watchpoints.  */
-#ifndef TARGET_HAS_DR_LEN_8
-#define TARGET_HAS_DR_LEN_8	0
-#endif
+#define TARGET_HAS_DR_LEN_8 (i386_dr_low.debug_register_length == 8)
 
 /* Debug registers' indices.  */
 #define DR_NADDR	4	/* The number of debug address registers.
*/
@@ -330,6 +305,9 @@ i386_insert_aligned_watchpoint (CORE_ADD
 {
   int i;
 
+  if (!i386_dr_low.set_addr || !i386_dr_low.set_control)
+    return -1;
+
   /* First, look for an occupied debug register with the same address
      and the same RW and LEN definitions.  If we find one, we can
      reuse it for this watchpoint as well (and save a register).  */
@@ -373,8 +351,8 @@ i386_insert_aligned_watchpoint (CORE_ADD
   dr_control_mirror &= I386_DR_CONTROL_MASK;
 
   /* Finally, actually pass the info to the inferior.  */
-  I386_DR_LOW_SET_ADDR (i, addr);
-  I386_DR_LOW_SET_CONTROL (dr_control_mirror);
+  i386_dr_low.set_addr (i, addr);
+  i386_dr_low.set_control (dr_control_mirror);
 
   return 0;
 }
@@ -402,8 +380,9 @@ i386_remove_aligned_watchpoint (CORE_ADD
 	      dr_mirror[i] = 0;
 	      I386_DR_DISABLE (i);
 	      /* Reset it in the inferior.  */
-	      I386_DR_LOW_SET_CONTROL (dr_control_mirror);
-	      I386_DR_LOW_RESET_ADDR (i);
+	      i386_dr_low.set_control (dr_control_mirror);
+	      if (i386_dr_low.reset_addr)
+		i386_dr_low.reset_addr (i);
 	    }
 	  retval = 0;
 	}
@@ -562,7 +541,7 @@ i386_stopped_data_address (struct target
   int i;
   int rc = 0;
 
-  dr_status_mirror = I386_DR_LOW_GET_STATUS ();
+  dr_status_mirror = i386_dr_low.get_status ();
 
   ALL_DEBUG_REGISTERS(i)
     {
@@ -603,7 +582,7 @@ i386_stopped_by_hwbp (void)
 {
   int i;
 
-  dr_status_mirror = I386_DR_LOW_GET_STATUS ();
+  dr_status_mirror = i386_dr_low.get_status ();
   if (maint_show_dr)
     i386_show_dr ("stopped_by_hwbp", 0, 0, hw_execute);
 
@@ -670,6 +649,29 @@ i386_can_use_hw_breakpoint (int type, in
   return 1;
 }
 
+static int
+show_debug_regs_command_added = 0;
+
+static void
+add_show_debug_regs_command (void)
+{
+  /* A maintenance command to enable printing the internal DRi mirror
+     variables.  */
+  add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
+			   &maint_show_dr, _("\
+Set whether to show variables that mirror the x86 debug registers."), _("\
+Show whether to show variables that mirror the x86 debug registers."), _("\
+Use \"on\" to enable, \"off\" to disable.\n\
+If enabled, the debug registers values are shown when GDB inserts\n\
+or removes a hardware breakpoint or watchpoint, and when the inferior\n\
+triggers a breakpoint or watchpoint."),
+			   NULL,
+			   NULL,
+			   &maintenance_set_cmdlist,
+			   &maintenance_show_cmdlist);
+  show_debug_regs_command_added = 1;
+}
+
 void
 i386_use_watchpoints (struct target_ops *t)
 {
@@ -686,31 +688,16 @@ i386_use_watchpoints (struct target_ops 
   t->to_remove_watchpoint = i386_remove_watchpoint;
   t->to_insert_hw_breakpoint = i386_insert_hw_breakpoint;
   t->to_remove_hw_breakpoint = i386_remove_hw_breakpoint;
+  if (!show_debug_regs_command_added)
+    add_show_debug_regs_command ();
 }
 
-#endif /* I386_USE_GENERIC_WATCHPOINTS */
-

-
-/* Provide a prototype to silence -Wmissing-prototypes.  */
-void _initialize_i386_nat (void);
-
 void
-_initialize_i386_nat (void)
+i386_set_debug_register_length (int len)
 {
-#ifdef I386_USE_GENERIC_WATCHPOINTS
-  /* A maintenance command to enable printing the internal DRi mirror
-     variables.  */
-  add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
-			   &maint_show_dr, _("\
-Set whether to show variables that mirror the x86 debug registers."), _("\
-Show whether to show variables that mirror the x86 debug registers."), _("\
-Use \"on\" to enable, \"off\" to disable.\n\
-If enabled, the debug registers values are shown when GDB inserts\n\
-or removes a hardware breakpoint or watchpoint, and when the inferior\n\
-triggers a breakpoint or watchpoint."),
-			   NULL,
-			   NULL,
-			   &maintenance_set_cmdlist,
-			   &maintenance_show_cmdlist);
-#endif
+  /* This function should be called only once for each native target.  */
+  gdb_assert (i386_dr_low.debug_register_length == 0);
+  i386_dr_low.debug_register_length = len;
 }
+
+
Index: src/gdb/i386-windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-windows-nat.c,v
retrieving revision 1.3
diff -u -p -r1.3 i386-windows-nat.c
--- src/gdb/i386-windows-nat.c	13 Jan 2009 04:14:07 -0000	1.3
+++ src/gdb/i386-windows-nat.c	12 May 2009 14:07:01 -0000
@@ -17,6 +17,7 @@
 
 #include "defs.h"
 #include "windows-nat.h"
+#include "i386-nat.h"
 
 #include <windows.h>
 
@@ -73,4 +74,5 @@ void
 _initialize_i386_windows_nat (void)
 {
   windows_set_context_register_offsets (mappings);
+  i386_set_debug_register_length (4);
 }
Index: src/gdb/i386fbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386fbsd-nat.c,v
retrieving revision 1.18
diff -u -p -r1.18 i386fbsd-nat.c
--- src/gdb/i386fbsd-nat.c	23 Feb 2009 00:03:49 -0000	1.18
+++ src/gdb/i386fbsd-nat.c	12 May 2009 14:07:01 -0000
@@ -29,6 +29,7 @@
 
 #include "fbsd-nat.h"
 #include "i386-tdep.h"
+#include "i386-nat.h"
 #include "i386bsd-nat.h"
 
 /* Resume execution of the inferior process.  If STEP is nonzero,
@@ -126,7 +127,20 @@ _initialize_i386fbsd_nat (void)
 
   /* Add some extra features to the common *BSD/i386 target.  */
   t = i386bsd_target ();
+
+#ifdef HAVE_PT_GETDBREGS
+
   i386_use_watchpoints (t);
+
+  i386_dr_low.set_control = i386bsd_dr_set_control;
+  i386_dr_low.set_addr = i386bsd_dr_set_addr;
+  i386_dr_low.reset_addr = i386bsd_dr_reset_addr;
+  i386_dr_low.get_status = i386bsd_dr_get_status;
+  i386_set_debug_register_length (4);
+
+#endif /* HAVE_PT_GETDBREGS */
+
+
   t->to_resume = i386fbsd_resume;
   t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
   t->to_find_memory_regions = fbsd_find_memory_regions;
Index: src/gdb/windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-nat.c,v
retrieving revision 1.189
diff -u -p -r1.189 windows-nat.c
--- src/gdb/windows-nat.c	17 Apr 2009 15:44:28 -0000	1.189
+++ src/gdb/windows-nat.c	12 May 2009 14:07:01 -0000
@@ -63,6 +63,7 @@
 
 #include "windows-tdep.h"
 #include "windows-nat.h"
+#include "i386-nat.h"
 
 #define AdjustTokenPrivileges		dyn_AdjustTokenPrivileges
 #define DebugActiveProcessStop		dyn_DebugActiveProcessStop
@@ -140,6 +141,10 @@ static void windows_stop (ptid_t);
 static int windows_thread_alive (struct target_ops *, ptid_t);
 static void windows_kill_inferior (struct target_ops *);
 
+void cygwin_set_dr (int i, CORE_ADDR addr);
+void cygwin_set_dr7 (unsigned val);
+unsigned cygwin_get_dr6 (void);
+
 static enum target_signal last_sig = TARGET_SIGNAL_0;
 /* Set if a signal was received from the debugged process */
 
@@ -2166,8 +2171,18 @@ init_windows_ops (void)
   windows_ops.to_has_execution = 1;
   windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file;
   windows_ops.to_get_ada_task_ptid = windows_get_ada_task_ptid;
+
   i386_use_watchpoints (&windows_ops);
 
+  i386_dr_low.set_control = cygwin_set_dr7;
+  i386_dr_low.set_addr = cygwin_set_dr;
+  i386_dr_low.reset_addr = NULL;
+  i386_dr_low.get_status = cygwin_get_dr6;
+
+  /* i386_dr_low.debug_register_length field is set by
+     calling i386_set_debug_register_length function
+     in processor windows specific native file.  */
+
   windows_ops.to_magic = OPS_MAGIC;
 }
 
Index: src/gdb/config/i386/go32.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/go32.mh,v
retrieving revision 1.10
diff -u -p -r1.10 go32.mh
--- src/gdb/config/i386/go32.mh	19 Apr 2009 18:29:34 -0000	1.10
+++ src/gdb/config/i386/go32.mh	12 May 2009 15:20:18 -0000
@@ -3,7 +3,6 @@
 # We include several header files from config/djgpp
 MH_CFLAGS= -I$(srcdir)/config/djgpp
 
-NAT_FILE= nm-go32.h
 NATDEPFILES= go32-nat.o i386-nat.o
 
 HOST_IPC=
Index: src/gdb/config/i386/linux64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux64.mh,v
retrieving revision 1.7
diff -u -p -r1.7 linux64.mh
--- src/gdb/config/i386/linux64.mh	4 Jan 2006 19:33:11 -0000	1.7
+++ src/gdb/config/i386/linux64.mh	12 May 2009 15:20:18 -0000
@@ -2,7 +2,7 @@
 NATDEPFILES= inf-ptrace.o fork-child.o \
 	i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
 	proc-service.o linux-thread-db.o gcore.o  linux-fork.o
-NAT_FILE= nm-linux64.h
+NAT_FILE= config/nm-linux.h
 
 # The dynamically loaded libthread_db needs access to symbols in the
 # gdb executable.
Index: src/gdb/config/i386/nm-cygwin.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin.h,v
retrieving revision 1.10
diff -u -p -r1.10 nm-cygwin.h
--- src/gdb/config/i386/nm-cygwin.h	26 Mar 2009 00:18:46 -0000	1.10
+++ src/gdb/config/i386/nm-cygwin.h	12 May 2009 15:20:18 -0000
@@ -18,20 +18,3 @@
 
 #define ADD_SHARED_SYMBOL_FILES dll_symbol_command
 void dll_symbol_command (char *, int);
-
-#define I386_USE_GENERIC_WATCHPOINTS
-
-#include "i386/nm-i386.h"
-
-/* Support for hardware-assisted breakpoints and watchpoints.  */
-
-#define I386_DR_LOW_SET_CONTROL(VAL)	cygwin_set_dr7 (VAL)
-extern void cygwin_set_dr7 (unsigned);
-
-#define I386_DR_LOW_SET_ADDR(N,ADDR)	cygwin_set_dr (N,ADDR)
-extern void cygwin_set_dr (int, CORE_ADDR);
-
-#define I386_DR_LOW_RESET_ADDR(N)
-
-#define I386_DR_LOW_GET_STATUS()	cygwin_get_dr6 ()
-extern unsigned cygwin_get_dr6 (void);
Index: src/gdb/config/i386/nm-cygwin64.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin64.h,v
retrieving revision 1.3
diff -u -p -r1.3 nm-cygwin64.h
--- src/gdb/config/i386/nm-cygwin64.h	26 Mar 2009 00:18:46 -0000	1.3
+++ src/gdb/config/i386/nm-cygwin64.h	12 May 2009 15:20:18 -0000
@@ -17,20 +17,3 @@
 
 #define ADD_SHARED_SYMBOL_FILES dll_symbol_command
 void dll_symbol_command (char *, int);
-
-#define I386_USE_GENERIC_WATCHPOINTS
-
-#include "i386/nm-i386.h"
-
-/* Support for hardware-assisted breakpoints and watchpoints.  */
-
-#define I386_DR_LOW_SET_CONTROL(VAL)	cygwin_set_dr7 (VAL)
-extern void cygwin_set_dr7 (unsigned);
-
-#define I386_DR_LOW_SET_ADDR(N,ADDR)	cygwin_set_dr (N,ADDR)
-extern void cygwin_set_dr (int, CORE_ADDR);
-
-#define I386_DR_LOW_RESET_ADDR(N)
-
-#define I386_DR_LOW_GET_STATUS()	cygwin_get_dr6 ()
-extern unsigned cygwin_get_dr6 (void);
Index: src/gdb/config/i386/nm-fbsd.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-fbsd.h,v
retrieving revision 1.20
diff -u -p -r1.20 nm-fbsd.h
--- src/gdb/config/i386/nm-fbsd.h	26 Mar 2009 00:18:46 -0000	1.20
+++ src/gdb/config/i386/nm-fbsd.h	12 May 2009 15:20:18 -0000
@@ -21,33 +21,8 @@
 #ifndef NM_FBSD_H
 #define NM_FBSD_H
 
-#ifdef HAVE_PT_GETDBREGS
-#define I386_USE_GENERIC_WATCHPOINTS
-#endif
-
-#include "i386/nm-i386.h"
-
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif
 
-/* Provide access to the i386 hardware debugging registers.  */
-
-#define I386_DR_LOW_SET_CONTROL(control) \
-  i386bsd_dr_set_control (control)
-extern void i386bsd_dr_set_control (unsigned long control);
-
-#define I386_DR_LOW_SET_ADDR(regnum, addr) \
-  i386bsd_dr_set_addr (regnum, addr)
-extern void i386bsd_dr_set_addr (int regnum, CORE_ADDR addr);
-
-#define I386_DR_LOW_RESET_ADDR(regnum) \
-  i386bsd_dr_reset_addr (regnum)
-extern void i386bsd_dr_reset_addr (int regnum);
-
-#define I386_DR_LOW_GET_STATUS() \
-  i386bsd_dr_get_status ()
-extern unsigned long i386bsd_dr_get_status (void);
-

-
 #endif /* nm-fbsd.h */
Index: src/gdb/config/i386/nm-go32.h
===================================================================
RCS file: config/i386/nm-go32.h
diff -N config/i386/nm-go32.h
--- src/gdb/config/i386/nm-go32.h	26 Mar 2009 00:18:46 -0000	1.10
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,35 +0,0 @@
-/* Native definitions for Intel x86 running DJGPP.
-   Copyright 1997, 1998, 1999, 2001, 2002, 2007, 2008, 2009
-   Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
-
-#define I386_USE_GENERIC_WATCHPOINTS
-
-#include "i386/nm-i386.h"
-
-/* Support for hardware-assisted breakpoints and watchpoints.  */
-
-#define I386_DR_LOW_SET_CONTROL(VAL)	go32_set_dr7 (VAL)
-extern void go32_set_dr7 (unsigned);
-
-#define I386_DR_LOW_SET_ADDR(N,ADDR)	go32_set_dr (N,ADDR)
-extern void go32_set_dr (int, CORE_ADDR);
-
-#define I386_DR_LOW_RESET_ADDR(N)
-
-#define I386_DR_LOW_GET_STATUS()	go32_get_dr6 ()
-extern unsigned go32_get_dr6 (void);
Index: src/gdb/config/i386/nm-i386.h
===================================================================
RCS file: config/i386/nm-i386.h
diff -N config/i386/nm-i386.h
--- src/gdb/config/i386/nm-i386.h	26 Mar 2009 00:18:46 -0000	1.15
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,72 +0,0 @@
-/* Native macro definitions for GDB on an Intel i[3456]86.
-   Copyright 2001, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
-
-#ifndef NM_I386_H
-#define NM_I386_H 1
-
-/* Hardware-assisted breakpoints and watchpoints.  */
-
-/* Targets should define this to use the generic x86 watchpoint support.
*/
-#ifdef I386_USE_GENERIC_WATCHPOINTS
-
-/* Add watchpoint methods to the provided target_ops.  
-   Targets which define I386_USE_GENERIC_WATCHPOINTS must
-   call this function.  */
-struct target_ops;
-void i386_use_watchpoints (struct target_ops *);
-
-/* Clear the reference counts and forget everything we knew about DRi.  */
-extern void i386_cleanup_dregs (void);
-
-/* Insert a watchpoint to watch a memory region which starts at
-   address ADDR and whose length is LEN bytes.  Watch memory accesses
-   of the type TYPE.  Return 0 on success, -1 on failure.  */
-extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type);
-
-/* Remove a watchpoint that watched the memory region which starts at
-   address ADDR, whose length is LEN bytes, and for accesses of the
-   type TYPE.  Return 0 on success, -1 on failure.  */
-extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type);
-
-/* Return non-zero if we can watch a memory region that starts at
-   address ADDR and whose length is LEN bytes.  */
-extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);
-
-/* Return non-zero if the inferior has some break/watchpoint that
-   triggered.  */
-extern int i386_stopped_by_hwbp (void);
-
-/* If the inferior has some break/watchpoint that triggered, set
-   the address associated with that break/watchpoint and return
-   true.  Otherwise, return false.  */
-extern int i386_stopped_data_address (struct target_ops *, CORE_ADDR *);
-
-/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
-   Return 0 on success, EBUSY on failure.  */
-struct bp_target_info;
-extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt);
-
-/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
-   Return 0 on success, -1 on failure.  */
-extern int  i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt);
-
-extern int i386_stopped_by_watchpoint (void);
-
-#endif /* I386_USE_GENERIC_WATCHPOINTS */
-
-#endif /* NM_I386_H */
Index: src/gdb/config/i386/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-linux.h,v
retrieving revision 1.30
diff -u -p -r1.30 nm-linux.h
--- src/gdb/config/i386/nm-linux.h	26 Mar 2009 00:18:46 -0000	1.30
+++ src/gdb/config/i386/nm-linux.h	12 May 2009 15:20:18 -0000
@@ -22,31 +22,8 @@
 #ifndef NM_LINUX_H
 #define NM_LINUX_H
 
-/* GNU/Linux supports the i386 hardware debugging registers.  */
-#define I386_USE_GENERIC_WATCHPOINTS
-
-#include "i386/nm-i386.h"
 #include "config/nm-linux.h"
 
-/* Provide access to the i386 hardware debugging registers.  */
-
-extern void i386_linux_dr_set_control (unsigned long control);
-#define I386_DR_LOW_SET_CONTROL(control) \
-  i386_linux_dr_set_control (control)
-
-extern void i386_linux_dr_set_addr (int regnum, CORE_ADDR addr);
-#define I386_DR_LOW_SET_ADDR(regnum, addr) \
-  i386_linux_dr_set_addr (regnum, addr)
-
-extern void i386_linux_dr_reset_addr (int regnum);
-#define I386_DR_LOW_RESET_ADDR(regnum) \
-  i386_linux_dr_reset_addr (regnum)
-
-extern unsigned long i386_linux_dr_get_status (void);
-#define I386_DR_LOW_GET_STATUS() \
-  i386_linux_dr_get_status ()
-

-
 #ifdef HAVE_PTRACE_GETFPXREGS
 /* Include register set support for the SSE registers.  */
 #define FILL_FPXREGSET
Index: src/gdb/config/i386/nm-linux64.h
===================================================================
RCS file: config/i386/nm-linux64.h
diff -N config/i386/nm-linux64.h
--- src/gdb/config/i386/nm-linux64.h	26 Mar 2009 00:18:46 -0000	1.10
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,53 +0,0 @@
-/* Native support for GNU/Linux x86-64.
-
-   Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
-   Free Software Foundation, Inc.
-
-   Contributed by Jiri Smid, SuSE Labs.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
-
-#ifndef NM_LINUX64_H
-#define NM_LINUX64_H
-
-/* GNU/Linux supports the i386 hardware debugging registers.  */
-#define I386_USE_GENERIC_WATCHPOINTS
-
-#include "i386/nm-i386.h"
-#include "config/nm-linux.h"
-
-/* Support for 8-byte wide hardware watchpoints.  */
-#define TARGET_HAS_DR_LEN_8 1
-
-/* Provide access to the i386 hardware debugging registers.  */
-
-extern void amd64_linux_dr_set_control (unsigned long control);
-#define I386_DR_LOW_SET_CONTROL(control) \
-  amd64_linux_dr_set_control (control)
-
-extern void amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr);
-#define I386_DR_LOW_SET_ADDR(regnum, addr) \
-  amd64_linux_dr_set_addr (regnum, addr)
-
-extern void amd64_linux_dr_reset_addr (int regnum);
-#define I386_DR_LOW_RESET_ADDR(regnum) \
-  amd64_linux_dr_reset_addr (regnum)
-
-extern unsigned long amd64_linux_dr_get_status (void);
-#define I386_DR_LOW_GET_STATUS() \
-  amd64_linux_dr_get_status ()
-
-#endif /* nm-linux64.h */




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]