[11/15] Rename functions and make nonstatic as necessary

Message ID 1403014378-4349-12-git-send-email-gbenson@redhat.com
State Committed
Headers

Commit Message

Gary Benson June 17, 2014, 2:12 p.m. UTC
  This commit renames the functions that are to be shared.
Functions to be shared that were static are made nonstatic.

gdb/
2014-06-17  Gary Benson  <gbenson@redhat.com>

	* i386-nat.c (i386_show_dr): Renamed to
	i386_dr_show and made nonstatic.  All uses updated.
	(i386_length_and_rw_bits): Renamed to
	i386_dr_length_and_rw_bits and made nonstatic.
	All uses updated.
	(i386_insert_aligned_watchpoint): Renamed to
	i386_dr_insert_aligned_watchpoint and made nonstatic.
	All uses updated.
	(i386_remove_aligned_watchpoint): Renamed to
	i386_dr_remove_aligned_watchpoint and made nonstatic.
	All uses updated.
	(i386_update_inferior_debug_regs): Renamed to
	i386_dr_update_inferior_debug_regs and made nonstatic.
	All uses updated.

gdb/gdbserver/
2014-06-17  Gary Benson  <gbenson@redhat.com>

	* i386-low.h (i386_low_insert_watchpoint): Renamed to
	i386_dr_insert_watchpoint.
	(i386_low_remove_watchpoint): Renamed to
	i386_dr_remove_watchpoint.
	(i386_low_region_ok_for_watchpoint): Renamed to
	i386_dr_region_ok_for_watchpoint.
	(i386_low_stopped_data_address): Renamed to
	i386_dr_stopped_data_address.
	(i386_low_stopped_by_watchpoint): Renamed to
	i386_dr_stopped_by_watchpoint.
	* i386-low.c (i386_show_dr): Renamed to
	i386_dr_show and made nonstatic.  All uses updated.
	(i386_length_and_rw_bits): Renamed to
	i386_dr_length_and_rw_bits and made nonstatic.
	All uses updated.
	(i386_insert_aligned_watchpoint): Renamed to
	i386_dr_insert_aligned_watchpoint and made nonstatic.
	All uses updated.
	(i386_remove_aligned_watchpoint): Renamed to
	i386_dr_remove_aligned_watchpoint and made nonstatic.
	All uses updated.
	(i386_update_inferior_debug_regs): Renamed to
	i386_dr_update_inferior_debug_regs and made nonstatic.
	All uses updated.
	(i386_low_insert_watchpoint): Renamed to
	i386_dr_insert_watchpoint.  All uses updated.
	(i386_low_remove_watchpoint): Renamed to
	i386_dr_remove_watchpoint.  All uses updated.
	(i386_low_region_ok_for_watchpoint): Renamed to
	i386_dr_region_ok_for_watchpoint.  All uses updated.
	(i386_low_stopped_data_address): Renamed to
	i386_dr_stopped_data_address.  All uses updated.
	(i386_low_stopped_by_watchpoint): Renamed to
	i386_dr_stopped_by_watchpoint.  All uses updated.
---
 gdb/ChangeLog                  |   17 ++++++++
 gdb/gdbserver/ChangeLog        |   37 ++++++++++++++++++
 gdb/gdbserver/i386-low.c       |   82 ++++++++++++++++++++--------------------
 gdb/gdbserver/i386-low.h       |   26 ++++++------
 gdb/gdbserver/linux-x86-low.c  |   12 +++---
 gdb/gdbserver/win32-i386-low.c |   12 +++---
 gdb/i386-nat.c                 |   79 +++++++++++++++++++-------------------
 7 files changed, 160 insertions(+), 105 deletions(-)
  

Comments

Pedro Alves June 17, 2014, 4:13 p.m. UTC | #1
On 06/17/2014 03:12 PM, Gary Benson wrote:
> This commit renames the functions that are to be shared.
> Functions to be shared that were static are made nonstatic.
> 
> gdb/
> 2014-06-17  Gary Benson  <gbenson@redhat.com>
> 
> 	* i386-nat.c (i386_show_dr): Renamed to
> 	i386_dr_show and made nonstatic.  All uses updated.
> 	(i386_length_and_rw_bits): Renamed to
> 	i386_dr_length_and_rw_bits and made nonstatic.
> 	All uses updated.
> 	(i386_insert_aligned_watchpoint): Renamed to
> 	i386_dr_insert_aligned_watchpoint and made nonstatic.
> 	All uses updated.
> 	(i386_remove_aligned_watchpoint): Renamed to
> 	i386_dr_remove_aligned_watchpoint and made nonstatic.
> 	All uses updated.
> 	(i386_update_inferior_debug_regs): Renamed to
> 	i386_dr_update_inferior_debug_regs and made nonstatic.
> 	All uses updated.
> 
> gdb/gdbserver/
> 2014-06-17  Gary Benson  <gbenson@redhat.com>
> 
> 	* i386-low.h (i386_low_insert_watchpoint): Renamed to
> 	i386_dr_insert_watchpoint.
> 	(i386_low_remove_watchpoint): Renamed to
> 	i386_dr_remove_watchpoint.
> 	(i386_low_region_ok_for_watchpoint): Renamed to
> 	i386_dr_region_ok_for_watchpoint.
> 	(i386_low_stopped_data_address): Renamed to
> 	i386_dr_stopped_data_address.
> 	(i386_low_stopped_by_watchpoint): Renamed to
> 	i386_dr_stopped_by_watchpoint.
> 	* i386-low.c (i386_show_dr): Renamed to
> 	i386_dr_show and made nonstatic.  All uses updated.
> 	(i386_length_and_rw_bits): Renamed to
> 	i386_dr_length_and_rw_bits and made nonstatic.
> 	All uses updated.
> 	(i386_insert_aligned_watchpoint): Renamed to
> 	i386_dr_insert_aligned_watchpoint and made nonstatic.
> 	All uses updated.
> 	(i386_remove_aligned_watchpoint): Renamed to
> 	i386_dr_remove_aligned_watchpoint and made nonstatic.
> 	All uses updated.
> 	(i386_update_inferior_debug_regs): Renamed to
> 	i386_dr_update_inferior_debug_regs and made nonstatic.
> 	All uses updated.
> 	(i386_low_insert_watchpoint): Renamed to
> 	i386_dr_insert_watchpoint.  All uses updated.
> 	(i386_low_remove_watchpoint): Renamed to
> 	i386_dr_remove_watchpoint.  All uses updated.
> 	(i386_low_region_ok_for_watchpoint): Renamed to
> 	i386_dr_region_ok_for_watchpoint.  All uses updated.
> 	(i386_low_stopped_data_address): Renamed to
> 	i386_dr_stopped_data_address.  All uses updated.
> 	(i386_low_stopped_by_watchpoint): Renamed to
> 	i386_dr_stopped_by_watchpoint.  All uses updated.


Most excellent.  OK.

Thanks,
  
Siva Chandra Reddy June 18, 2014, 10:24 a.m. UTC | #2
On Tue, Jun 17, 2014 at 7:12 AM, Gary Benson <gbenson@redhat.com> wrote:
> This commit renames the functions that are to be shared.
> Functions to be shared that were static are made nonstatic.

I thinking making the functions nonstatic in this part was not
correct. The build currently fails when built with
"-Werror=missing-prototypes" as 14/15 has not yet been committed.
  
Gary Benson June 18, 2014, 1:28 p.m. UTC | #3
Siva Chandra wrote:
> On Tue, Jun 17, 2014 at 7:12 AM, Gary Benson <gbenson@redhat.com> wrote:
> > This commit renames the functions that are to be shared.
> > Functions to be shared that were static are made nonstatic.
> 
> I thinking making the functions nonstatic in this part was not
> correct. The build currently fails when built with
> "-Werror=missing-prototypes" as 14/15 has not yet been committed.

My apologies Siva.

Pedro, should I commit the remaining piece now, and work on the 
i386_insert_hw_breakpoint as a separate patch?

Thanks,
Gary
  
Pedro Alves June 18, 2014, 1:55 p.m. UTC | #4
On 06/18/2014 02:28 PM, Gary Benson wrote:
> Siva Chandra wrote:
>> On Tue, Jun 17, 2014 at 7:12 AM, Gary Benson <gbenson@redhat.com> wrote:
>>> This commit renames the functions that are to be shared.
>>> Functions to be shared that were static are made nonstatic.
>>
>> I thinking making the functions nonstatic in this part was not
>> correct. The build currently fails when built with
>> "-Werror=missing-prototypes" as 14/15 has not yet been committed.
> 
> My apologies Siva.
> 
> Pedro, should I commit the remaining piece now, and work on the 
> i386_insert_hw_breakpoint as a separate patch?

As you've committed the header patch already, I think the issue
is actually already fixed?
  
Siva Chandra Reddy June 18, 2014, 2:03 p.m. UTC | #5
On Wed, Jun 18, 2014 at 6:55 AM, Pedro Alves <palves@redhat.com> wrote:
> On 06/18/2014 02:28 PM, Gary Benson wrote:
>> Siva Chandra wrote:
>>> On Tue, Jun 17, 2014 at 7:12 AM, Gary Benson <gbenson@redhat.com> wrote:
>>>> This commit renames the functions that are to be shared.
>>>> Functions to be shared that were static are made nonstatic.
>>>
>>> I thinking making the functions nonstatic in this part was not
>>> correct. The build currently fails when built with
>>> "-Werror=missing-prototypes" as 14/15 has not yet been committed.
>>
>> My apologies Siva.
>>
>> Pedro, should I commit the remaining piece now, and work on the
>> i386_insert_hw_breakpoint as a separate patch?
>
> As you've committed the header patch already, I think the issue
> is actually already fixed?

Yes, I just checked; the issue is already fixed.
  
Gary Benson June 18, 2014, 2:09 p.m. UTC | #6
Pedro Alves wrote:
> On 06/18/2014 02:28 PM, Gary Benson wrote:
> > Siva Chandra wrote:
> > > On Tue, Jun 17, 2014 at 7:12 AM, Gary Benson <gbenson@redhat.com> wrote:
> > > > This commit renames the functions that are to be shared.
> > > > Functions to be shared that were static are made nonstatic.
> > >

> > > I thinking making the functions nonstatic in this part was
> > > not correct. The build currently fails when built with
> > > "-Werror=missing-prototypes" as 14/15 has not yet been
> > > committed.
> > 
> > My apologies Siva.
> > 
> > Pedro, should I commit the remaining piece now, and work on the
> > i386_insert_hw_breakpoint as a separate patch?
> 
> As you've committed the header patch already, I think the issue
> is actually already fixed?

Ah, ok, I misunderstood.  I can stop rushing!

I actually wish I hadn't committed the header patch now, the
i386_{insert,remove}_hw_breakpoint refactoring you spotted
means those functions didn't need exposing at all.

I'm working on a patch to revert part of that change: remove the
prototypes, make them static again, *and* rename the now static
functions them back to their original names.  The last point isn't
strictly necessary, but I don't like that the refactoring would
have renamed some functions it didn't need to.  I want to put the
old names back so that people familiar with that code don't see
more disruption than strictly necessary.

I was going to mail it alone (I thought Siva was stuck) but since
he's not I'll mail it as part of a three-patch series to complete
the refactoring.

Thanks,
Gary
  
Pedro Alves June 18, 2014, 2:18 p.m. UTC | #7
On 06/18/2014 03:09 PM, Gary Benson wrote:
> Pedro Alves wrote:
>> On 06/18/2014 02:28 PM, Gary Benson wrote:
>>> Siva Chandra wrote:
>>>> On Tue, Jun 17, 2014 at 7:12 AM, Gary Benson <gbenson@redhat.com> wrote:
>>>>> This commit renames the functions that are to be shared.
>>>>> Functions to be shared that were static are made nonstatic.
>>>>
> 
>>>> I thinking making the functions nonstatic in this part was
>>>> not correct. The build currently fails when built with
>>>> "-Werror=missing-prototypes" as 14/15 has not yet been
>>>> committed.
>>>
>>> My apologies Siva.
>>>
>>> Pedro, should I commit the remaining piece now, and work on the
>>> i386_insert_hw_breakpoint as a separate patch?
>>
>> As you've committed the header patch already, I think the issue
>> is actually already fixed?
> 
> Ah, ok, I misunderstood.  I can stop rushing!
> 
> I actually wish I hadn't committed the header patch now, the
> i386_{insert,remove}_hw_breakpoint refactoring you spotted
> means those functions didn't need exposing at all.
> 
> I'm working on a patch to revert part of that change: remove the
> prototypes, make them static again, *and* rename the now static
> functions them back to their original names.  The last point isn't
> strictly necessary, but I don't like that the refactoring would
> have renamed some functions it didn't need to.  I want to put the
> old names back so that people familiar with that code don't see
> more disruption than strictly necessary.
> 
> I was going to mail it alone (I thought Siva was stuck) but since
> he's not I'll mail it as part of a three-patch series to complete
> the refactoring.

Sounds excellent.

Thanks,
  

Patch

diff --git a/gdb/gdbserver/i386-low.c b/gdb/gdbserver/i386-low.c
index 8d6f26c..1c9d7aa 100644
--- a/gdb/gdbserver/i386-low.c
+++ b/gdb/gdbserver/i386-low.c
@@ -78,7 +78,7 @@ 
 
    Currently, all watchpoint are locally enabled.  If you need to
    enable them globally, read the comment which pertains to this in
-   i386_insert_aligned_watchpoint below.  */
+   i386_dr_insert_aligned_watchpoint below.  */
 #define DR_LOCAL_ENABLE_SHIFT	0 /* Extra shift to the local enable bit.  */
 #define DR_GLOBAL_ENABLE_SHIFT	1 /* Extra shift to the global enable bit.  */
 #define DR_ENABLE_SIZE		2 /* Two enable bits per debug register.  */
@@ -173,8 +173,8 @@  i386_low_init_dregs (struct i386_debug_reg_state *state)
 
 /* Print the values of the mirrored debug registers.  */
 
-static void
-i386_show_dr (struct i386_debug_reg_state *state,
+void
+i386_dr_show (struct i386_debug_reg_state *state,
 	      const char *func, CORE_ADDR addr,
 	      int len, enum target_hw_bp_type type)
 {
@@ -214,8 +214,8 @@  i386_show_dr (struct i386_debug_reg_state *state,
    region of LEN bytes for accesses of type TYPE.  LEN is assumed to
    have the value of 1, 2, or 4.  */
 
-static unsigned
-i386_length_and_rw_bits (int len, enum target_hw_bp_type type)
+unsigned
+i386_dr_length_and_rw_bits (int len, enum target_hw_bp_type type)
 {
   unsigned rw;
 
@@ -242,7 +242,7 @@  i386_length_and_rw_bits (int len, enum target_hw_bp_type type)
 #endif
       default:
 	internal_error (__FILE__, __LINE__, _("\
-Invalid hardware breakpoint type %d in i386_length_and_rw_bits.\n"),
+Invalid hardware breakpoint type %d in i386_dr_length_and_rw_bits.\n"),
 			(int) type);
     }
 
@@ -260,7 +260,7 @@  Invalid hardware breakpoint type %d in i386_length_and_rw_bits.\n"),
 	/* ELSE FALL THROUGH */
       default:
 	internal_error (__FILE__, __LINE__, _("\
-Invalid hardware breakpoint length %d in i386_length_and_rw_bits.\n"), len);
+Invalid hardware breakpoint length %d in i386_dr_length_and_rw_bits.\n"), len);
     }
 }
 
@@ -270,9 +270,9 @@  Invalid hardware breakpoint length %d in i386_length_and_rw_bits.\n"), len);
    type of the region to be watched by this watchpoint.  Return 0 on
    success, -1 on failure.  */
 
-static int
-i386_insert_aligned_watchpoint (struct i386_debug_reg_state *state,
-				CORE_ADDR addr, unsigned len_rw_bits)
+int
+i386_dr_insert_aligned_watchpoint (struct i386_debug_reg_state *state,
+				   CORE_ADDR addr, unsigned len_rw_bits)
 {
   int i;
 
@@ -330,9 +330,9 @@  i386_insert_aligned_watchpoint (struct i386_debug_reg_state *state,
    type of the region watched by this watchpoint.  Return 0 on
    success, -1 on failure.  */
 
-static int
-i386_remove_aligned_watchpoint (struct i386_debug_reg_state *state,
-				CORE_ADDR addr, unsigned len_rw_bits)
+int
+i386_dr_remove_aligned_watchpoint (struct i386_debug_reg_state *state,
+				   CORE_ADDR addr, unsigned len_rw_bits)
 {
   int i, retval = -1;
 
@@ -402,12 +402,12 @@  i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state,
 	}
       else
 	{
-	  unsigned len_rw = i386_length_and_rw_bits (size, type);
+	  unsigned len_rw = i386_dr_length_and_rw_bits (size, type);
 
 	  if (what == WP_INSERT)
-	    retval = i386_insert_aligned_watchpoint (state, addr, len_rw);
+	    retval = i386_dr_insert_aligned_watchpoint (state, addr, len_rw);
 	  else if (what == WP_REMOVE)
-	    retval = i386_remove_aligned_watchpoint (state, addr, len_rw);
+	    retval = i386_dr_remove_aligned_watchpoint (state, addr, len_rw);
 	  else
 	    internal_error (__FILE__, __LINE__, _("\
 Invalid value %d of operation in i386_handle_nonaligned_watchpoint.\n"),
@@ -426,9 +426,9 @@  Invalid value %d of operation in i386_handle_nonaligned_watchpoint.\n"),
 /* Update the inferior debug registers state, in STATE, with the
    new debug registers state, in NEW_STATE.  */
 
-static void
-i386_update_inferior_debug_regs (struct i386_debug_reg_state *state,
-				 struct i386_debug_reg_state *new_state)
+void
+i386_dr_update_inferior_debug_regs (struct i386_debug_reg_state *state,
+				    struct i386_debug_reg_state *new_state)
 {
   int i;
 
@@ -451,9 +451,9 @@  i386_update_inferior_debug_regs (struct i386_debug_reg_state *state,
    of the type TYPE.  Return 0 on success, -1 on failure.  */
 
 int
-i386_low_insert_watchpoint (struct i386_debug_reg_state *state,
-			    enum target_hw_bp_type type,
-			    CORE_ADDR addr, int len)
+i386_dr_insert_watchpoint (struct i386_debug_reg_state *state,
+			   enum target_hw_bp_type type,
+			   CORE_ADDR addr, int len)
 {
   int retval;
   /* Work on a local copy of the debug registers, and on success,
@@ -473,17 +473,17 @@  i386_low_insert_watchpoint (struct i386_debug_reg_state *state,
     }
   else
     {
-      unsigned len_rw = i386_length_and_rw_bits (len, type);
+      unsigned len_rw = i386_dr_length_and_rw_bits (len, type);
 
-      retval = i386_insert_aligned_watchpoint (&local_state,
+      retval = i386_dr_insert_aligned_watchpoint (&local_state,
 					       addr, len_rw);
     }
 
   if (retval == 0)
-    i386_update_inferior_debug_regs (state, &local_state);
+    i386_dr_update_inferior_debug_regs (state, &local_state);
 
   if (debug_hw_points)
-    i386_show_dr (state, "insert_watchpoint", addr, len, type);
+    i386_dr_show (state, "insert_watchpoint", addr, len, type);
 
   return retval;
 }
@@ -493,9 +493,9 @@  i386_low_insert_watchpoint (struct i386_debug_reg_state *state,
    type TYPE.  Return 0 on success, -1 on failure.  */
 
 int
-i386_low_remove_watchpoint (struct i386_debug_reg_state *state,
-			    enum target_hw_bp_type type,
-			    CORE_ADDR addr, int len)
+i386_dr_remove_watchpoint (struct i386_debug_reg_state *state,
+			   enum target_hw_bp_type type,
+			   CORE_ADDR addr, int len)
 {
   int retval;
   /* Work on a local copy of the debug registers, and on success,
@@ -512,17 +512,17 @@  i386_low_remove_watchpoint (struct i386_debug_reg_state *state,
     }
   else
     {
-      unsigned len_rw = i386_length_and_rw_bits (len, type);
+      unsigned len_rw = i386_dr_length_and_rw_bits (len, type);
 
-      retval = i386_remove_aligned_watchpoint (&local_state,
+      retval = i386_dr_remove_aligned_watchpoint (&local_state,
 					       addr, len_rw);
     }
 
   if (retval == 0)
-    i386_update_inferior_debug_regs (state, &local_state);
+    i386_dr_update_inferior_debug_regs (state, &local_state);
 
   if (debug_hw_points)
-    i386_show_dr (state, "remove_watchpoint", addr, len, type);
+    i386_dr_show (state, "remove_watchpoint", addr, len, type);
 
   return retval;
 }
@@ -531,8 +531,8 @@  i386_low_remove_watchpoint (struct i386_debug_reg_state *state,
    address ADDR and whose length is LEN bytes.  */
 
 int
-i386_low_region_ok_for_watchpoint (struct i386_debug_reg_state *state,
-				   CORE_ADDR addr, int len)
+i386_dr_region_ok_for_watchpoint (struct i386_debug_reg_state *state,
+				  CORE_ADDR addr, int len)
 {
   int nregs;
 
@@ -548,8 +548,8 @@  i386_low_region_ok_for_watchpoint (struct i386_debug_reg_state *state,
    Otherwise, return zero.  */
 
 int
-i386_low_stopped_data_address (struct i386_debug_reg_state *state,
-			       CORE_ADDR *addr_p)
+i386_dr_stopped_data_address (struct i386_debug_reg_state *state,
+			      CORE_ADDR *addr_p)
 {
   CORE_ADDR addr = 0;
   int i;
@@ -612,12 +612,12 @@  i386_low_stopped_data_address (struct i386_debug_reg_state *state,
 	  addr = i386_dr_low_get_addr (i);
 	  rc = 1;
 	  if (debug_hw_points)
-	    i386_show_dr (state, "watchpoint_hit", addr, -1, hw_write);
+	    i386_dr_show (state, "watchpoint_hit", addr, -1, hw_write);
 	}
     }
 
   if (debug_hw_points && addr == 0)
-    i386_show_dr (state, "stopped_data_addr", 0, 0, hw_write);
+    i386_dr_show (state, "stopped_data_addr", 0, 0, hw_write);
 
   if (rc)
     *addr_p = addr;
@@ -628,8 +628,8 @@  i386_low_stopped_data_address (struct i386_debug_reg_state *state,
    Otherwise return zero.  */
 
 int
-i386_low_stopped_by_watchpoint (struct i386_debug_reg_state *state)
+i386_dr_stopped_by_watchpoint (struct i386_debug_reg_state *state)
 {
   CORE_ADDR addr = 0;
-  return i386_low_stopped_data_address (state, &addr);
+  return i386_dr_stopped_data_address (state, &addr);
 }
diff --git a/gdb/gdbserver/i386-low.h b/gdb/gdbserver/i386-low.h
index 681ade0..3d3feb3 100644
--- a/gdb/gdbserver/i386-low.h
+++ b/gdb/gdbserver/i386-low.h
@@ -58,33 +58,33 @@  extern void i386_low_init_dregs (struct i386_debug_reg_state *state);
 /* 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_low_insert_watchpoint (struct i386_debug_reg_state *state,
-				       enum target_hw_bp_type type,
-				       CORE_ADDR addr,
-				       int len);
+extern int i386_dr_insert_watchpoint (struct i386_debug_reg_state *state,
+				      enum target_hw_bp_type type,
+				      CORE_ADDR addr,
+				      int len);
 
 /* 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_low_remove_watchpoint (struct i386_debug_reg_state *state,
-				       enum target_hw_bp_type type,
-				       CORE_ADDR addr,
-				       int len);
+extern int i386_dr_remove_watchpoint (struct i386_debug_reg_state *state,
+				      enum target_hw_bp_type type,
+				      CORE_ADDR addr,
+				      int len);
 
 /* Return non-zero if we can watch a memory region that starts at
    address ADDR and whose length is LEN bytes.  */
-extern int i386_low_region_ok_for_watchpoint (struct i386_debug_reg_state *state,
-					      CORE_ADDR addr, int len);
+extern int i386_dr_region_ok_for_watchpoint (struct i386_debug_reg_state *state,
+					     CORE_ADDR addr, int len);
 
 /* 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_low_stopped_data_address (struct i386_debug_reg_state *state,
-					  CORE_ADDR *addr_p);
+extern int i386_dr_stopped_data_address (struct i386_debug_reg_state *state,
+					 CORE_ADDR *addr_p);
 
 /* Return true if the inferior has some watchpoint that triggered.
    Otherwise return false.  */
-extern int i386_low_stopped_by_watchpoint (struct i386_debug_reg_state *state);
+extern int i386_dr_stopped_by_watchpoint (struct i386_debug_reg_state *state);
 
 /* Each target needs to provide several low-level functions
    that will be called to insert watchpoints and hardware breakpoints
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index e478394..b8a0006 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -681,7 +681,7 @@  x86_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
 	struct i386_debug_reg_state *state
 	  = &proc->private->arch_private->debug_reg_state;
 
-	return i386_low_insert_watchpoint (state, hw_type, addr, size);
+	return i386_dr_insert_watchpoint (state, hw_type, addr, size);
       }
 
     default:
@@ -710,7 +710,7 @@  x86_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 	struct i386_debug_reg_state *state
 	  = &proc->private->arch_private->debug_reg_state;
 
-	return i386_low_remove_watchpoint (state, hw_type, addr, size);
+	return i386_dr_remove_watchpoint (state, hw_type, addr, size);
       }
     default:
       /* Unsupported.  */
@@ -722,7 +722,7 @@  static int
 x86_stopped_by_watchpoint (void)
 {
   struct process_info *proc = current_process ();
-  return i386_low_stopped_by_watchpoint (&proc->private->arch_private->debug_reg_state);
+  return i386_dr_stopped_by_watchpoint (&proc->private->arch_private->debug_reg_state);
 }
 
 static CORE_ADDR
@@ -730,8 +730,8 @@  x86_stopped_data_address (void)
 {
   struct process_info *proc = current_process ();
   CORE_ADDR addr;
-  if (i386_low_stopped_data_address (&proc->private->arch_private->debug_reg_state,
-				     &addr))
+  if (i386_dr_stopped_data_address (&proc->private->arch_private->debug_reg_state,
+				    &addr))
     return addr;
   return 0;
 }
@@ -784,7 +784,7 @@  x86_linux_prepare_to_resume (struct lwp_info *lwp)
 
 	    /* If we're setting a watchpoint, any change the inferior
 	       had done itself to the debug registers needs to be
-	       discarded, otherwise, i386_low_stopped_data_address can
+	       discarded, otherwise, i386_dr_stopped_data_address can
 	       get confused.  */
 	    clear_status = 1;
 	  }
diff --git a/gdb/gdbserver/win32-i386-low.c b/gdb/gdbserver/win32-i386-low.c
index 08242aa..09160dd 100644
--- a/gdb/gdbserver/win32-i386-low.c
+++ b/gdb/gdbserver/win32-i386-low.c
@@ -122,8 +122,8 @@  i386_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
 	enum target_hw_bp_type hw_type
 	  = raw_bkpt_type_to_target_hw_bp_type (type);
 
-	return i386_low_insert_watchpoint (&debug_reg_state,
-					   hw_type, addr, size);
+	return i386_dr_insert_watchpoint (&debug_reg_state,
+					  hw_type, addr, size);
       }
     default:
       /* Unsupported.  */
@@ -143,8 +143,8 @@  i386_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 	enum target_hw_bp_type hw_type
 	  = raw_bkpt_type_to_target_hw_bp_type (type);
 
-	return i386_low_remove_watchpoint (&debug_reg_state,
-					   hw_type, addr, size);
+	return i386_dr_remove_watchpoint (&debug_reg_state,
+					  hw_type, addr, size);
       }
     default:
       /* Unsupported.  */
@@ -155,14 +155,14 @@  i386_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 static int
 i386_stopped_by_watchpoint (void)
 {
-  return i386_low_stopped_by_watchpoint (&debug_reg_state);
+  return i386_dr_stopped_by_watchpoint (&debug_reg_state);
 }
 
 static CORE_ADDR
 i386_stopped_data_address (void)
 {
   CORE_ADDR addr;
-  if (i386_low_stopped_data_address (&debug_reg_state, &addr))
+  if (i386_dr_stopped_data_address (&debug_reg_state, &addr))
     return addr;
   return 0;
 }
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index 4282535..86e655f 100644
--- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c
@@ -103,7 +103,7 @@  struct i386_dr_low_type i386_dr_low;
 
    Currently, all watchpoint are locally enabled.  If you need to
    enable them globally, read the comment which pertains to this in
-   i386_insert_aligned_watchpoint below.  */
+   i386_dr_insert_aligned_watchpoint below.  */
 #define DR_LOCAL_ENABLE_SHIFT	0 /* Extra shift to the local enable bit.  */
 #define DR_GLOBAL_ENABLE_SHIFT	1 /* Extra shift to the global enable bit.  */
 #define DR_ENABLE_SIZE		2 /* Two enable bits per debug register.  */
@@ -289,8 +289,8 @@  i386_cleanup_dregs (void)
 
 /* Print the values of the mirrored debug registers.  */
 
-static void
-i386_show_dr (struct i386_debug_reg_state *state,
+void
+i386_dr_show (struct i386_debug_reg_state *state,
 	      const char *func, CORE_ADDR addr,
 	      int len, enum target_hw_bp_type type)
 {
@@ -330,8 +330,8 @@  i386_show_dr (struct i386_debug_reg_state *state,
    region of LEN bytes for accesses of type TYPE.  LEN is assumed to
    have the value of 1, 2, or 4.  */
 
-static unsigned
-i386_length_and_rw_bits (int len, enum target_hw_bp_type type)
+unsigned
+i386_dr_length_and_rw_bits (int len, enum target_hw_bp_type type)
 {
   unsigned rw;
 
@@ -358,7 +358,7 @@  i386_length_and_rw_bits (int len, enum target_hw_bp_type type)
 #endif
       default:
 	internal_error (__FILE__, __LINE__, _("\
-Invalid hardware breakpoint type %d in i386_length_and_rw_bits.\n"),
+Invalid hardware breakpoint type %d in i386_dr_length_and_rw_bits.\n"),
 			(int) type);
     }
 
@@ -376,7 +376,7 @@  Invalid hardware breakpoint type %d in i386_length_and_rw_bits.\n"),
 	/* ELSE FALL THROUGH */
       default:
 	internal_error (__FILE__, __LINE__, _("\
-Invalid hardware breakpoint length %d in i386_length_and_rw_bits.\n"), len);
+Invalid hardware breakpoint length %d in i386_dr_length_and_rw_bits.\n"), len);
     }
 }
 
@@ -386,9 +386,9 @@  Invalid hardware breakpoint length %d in i386_length_and_rw_bits.\n"), len);
    type of the region to be watched by this watchpoint.  Return 0 on
    success, -1 on failure.  */
 
-static int
-i386_insert_aligned_watchpoint (struct i386_debug_reg_state *state,
-				CORE_ADDR addr, unsigned len_rw_bits)
+int
+i386_dr_insert_aligned_watchpoint (struct i386_debug_reg_state *state,
+				   CORE_ADDR addr, unsigned len_rw_bits)
 {
   int i;
 
@@ -446,9 +446,9 @@  i386_insert_aligned_watchpoint (struct i386_debug_reg_state *state,
    type of the region watched by this watchpoint.  Return 0 on
    success, -1 on failure.  */
 
-static int
-i386_remove_aligned_watchpoint (struct i386_debug_reg_state *state,
-				CORE_ADDR addr, unsigned len_rw_bits)
+int
+i386_dr_remove_aligned_watchpoint (struct i386_debug_reg_state *state,
+				   CORE_ADDR addr, unsigned len_rw_bits)
 {
   int i, retval = -1;
 
@@ -518,12 +518,12 @@  i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state,
 	}
       else
 	{
-	  unsigned len_rw = i386_length_and_rw_bits (size, type);
+	  unsigned len_rw = i386_dr_length_and_rw_bits (size, type);
 
 	  if (what == WP_INSERT)
-	    retval = i386_insert_aligned_watchpoint (state, addr, len_rw);
+	    retval = i386_dr_insert_aligned_watchpoint (state, addr, len_rw);
 	  else if (what == WP_REMOVE)
-	    retval = i386_remove_aligned_watchpoint (state, addr, len_rw);
+	    retval = i386_dr_remove_aligned_watchpoint (state, addr, len_rw);
 	  else
 	    internal_error (__FILE__, __LINE__, _("\
 Invalid value %d of operation in i386_handle_nonaligned_watchpoint.\n"),
@@ -542,9 +542,9 @@  Invalid value %d of operation in i386_handle_nonaligned_watchpoint.\n"),
 /* Update the inferior debug registers state, in STATE, with the
    new debug registers state, in NEW_STATE.  */
 
-static void
-i386_update_inferior_debug_regs (struct i386_debug_reg_state *state,
-				 struct i386_debug_reg_state *new_state)
+void
+i386_dr_update_inferior_debug_regs (struct i386_debug_reg_state *state,
+				    struct i386_debug_reg_state *new_state)
 {
   int i;
 
@@ -591,17 +591,17 @@  i386_insert_watchpoint (struct target_ops *self,
     }
   else
     {
-      unsigned len_rw = i386_length_and_rw_bits (len, type);
+      unsigned len_rw = i386_dr_length_and_rw_bits (len, type);
 
-      retval = i386_insert_aligned_watchpoint (&local_state,
+      retval = i386_dr_insert_aligned_watchpoint (&local_state,
 					       addr, len_rw);
     }
 
   if (retval == 0)
-    i386_update_inferior_debug_regs (state, &local_state);
+    i386_dr_update_inferior_debug_regs (state, &local_state);
 
   if (debug_hw_points)
-    i386_show_dr (state, "insert_watchpoint", addr, len, type);
+    i386_dr_show (state, "insert_watchpoint", addr, len, type);
 
   return retval;
 }
@@ -631,17 +631,17 @@  i386_remove_watchpoint (struct target_ops *self,
     }
   else
     {
-      unsigned len_rw = i386_length_and_rw_bits (len, type);
+      unsigned len_rw = i386_dr_length_and_rw_bits (len, type);
 
-      retval = i386_remove_aligned_watchpoint (&local_state,
+      retval = i386_dr_remove_aligned_watchpoint (&local_state,
 					       addr, len_rw);
     }
 
   if (retval == 0)
-    i386_update_inferior_debug_regs (state, &local_state);
+    i386_dr_update_inferior_debug_regs (state, &local_state);
 
   if (debug_hw_points)
-    i386_show_dr (state, "remove_watchpoint", addr, len, type);
+    i386_dr_show (state, "remove_watchpoint", addr, len, type);
 
   return retval;
 }
@@ -734,12 +734,12 @@  i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
 	  addr = i386_dr_low_get_addr (i);
 	  rc = 1;
 	  if (debug_hw_points)
-	    i386_show_dr (state, "watchpoint_hit", addr, -1, hw_write);
+	    i386_dr_show (state, "watchpoint_hit", addr, -1, hw_write);
 	}
     }
 
   if (debug_hw_points && addr == 0)
-    i386_show_dr (state, "stopped_data_addr", 0, 0, hw_write);
+    i386_dr_show (state, "stopped_data_addr", 0, 0, hw_write);
 
   if (rc)
     *addr_p = addr;
@@ -764,19 +764,20 @@  i386_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
 {
   struct i386_debug_reg_state *state
     = i386_debug_reg_state (ptid_get_pid (inferior_ptid));
-  unsigned len_rw = i386_length_and_rw_bits (1, hw_execute);
+  unsigned len_rw = i386_dr_length_and_rw_bits (1, hw_execute);
   CORE_ADDR addr = bp_tgt->placed_address;
   /* Work on a local copy of the debug registers, and on success,
      commit the change back to the inferior.  */
   struct i386_debug_reg_state local_state = *state;
-  int retval = i386_insert_aligned_watchpoint (&local_state,
-					       addr, len_rw) ? EBUSY : 0;
+  int retval = i386_dr_insert_aligned_watchpoint (&local_state,
+						  addr,
+						  len_rw) ? EBUSY : 0;
 
   if (retval == 0)
-    i386_update_inferior_debug_regs (state, &local_state);
+    i386_dr_update_inferior_debug_regs (state, &local_state);
 
   if (debug_hw_points)
-    i386_show_dr (state, "insert_hwbp", addr, 1, hw_execute);
+    i386_dr_show (state, "insert_hwbp", addr, 1, hw_execute);
 
   return retval;
 }
@@ -790,19 +791,19 @@  i386_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
 {
   struct i386_debug_reg_state *state
     = i386_debug_reg_state (ptid_get_pid (inferior_ptid));
-  unsigned len_rw = i386_length_and_rw_bits (1, hw_execute);
+  unsigned len_rw = i386_dr_length_and_rw_bits (1, hw_execute);
   CORE_ADDR addr = bp_tgt->placed_address;
   /* Work on a local copy of the debug registers, and on success,
      commit the change back to the inferior.  */
   struct i386_debug_reg_state local_state = *state;
-  int retval = i386_remove_aligned_watchpoint (&local_state,
-					       addr, len_rw);
+  int retval = i386_dr_remove_aligned_watchpoint (&local_state,
+						  addr, len_rw);
 
   if (retval == 0)
-    i386_update_inferior_debug_regs (state, &local_state);
+    i386_dr_update_inferior_debug_regs (state, &local_state);
 
   if (debug_hw_points)
-    i386_show_dr (state, "remove_hwbp", addr, 1, hw_execute);
+    i386_dr_show (state, "remove_hwbp", addr, 1, hw_execute);
 
   return retval;
 }