[10/11,v5] Remove GDBSERVER uses from i386-dregs.c

Message ID 1406888377-25795-11-git-send-email-gbenson@redhat.com
State Superseded
Headers

Commit Message

Gary Benson Aug. 1, 2014, 10:19 a.m. UTC
  This commit makes nat/i386-dregs.c include common-defs.h rather than
defs.h or server.h.  A couple of minor changes were required in order
to support this change.

gdb/
2014-08-01  Gary Benson  <gbenson@redhat.com>

	* nat/i386-dregs.c: Include common-defs.h and break-common.h.
	Don't include defs.h or server.h.
	(debug_hw_points): Declare unconditionally.
---
 gdb/ChangeLog        |    6 ++++++
 gdb/nat/i386-dregs.c |   10 ++--------
 2 files changed, 8 insertions(+), 8 deletions(-)
  

Comments

Doug Evans Aug. 6, 2014, 6:32 p.m. UTC | #1
Gary Benson writes:
 > This commit makes nat/i386-dregs.c include common-defs.h rather than
 > defs.h or server.h.  A couple of minor changes were required in order
 > to support this change.
 > 
 > gdb/
 > 2014-08-01  Gary Benson  <gbenson@redhat.com>
 > 
 > 	* nat/i386-dregs.c: Include common-defs.h and break-common.h.
 > 	Don't include defs.h or server.h.
 > 	(debug_hw_points): Declare unconditionally.
 > ---
 >  gdb/ChangeLog        |    6 ++++++
 >  gdb/nat/i386-dregs.c |   10 ++--------
 >  2 files changed, 8 insertions(+), 8 deletions(-)
 > 
 > diff --git a/gdb/nat/i386-dregs.c b/gdb/nat/i386-dregs.c
 > index e3272cd..7905c44 100644
 > --- a/gdb/nat/i386-dregs.c
 > +++ b/gdb/nat/i386-dregs.c
 > @@ -17,13 +17,9 @@
 >     You should have received a copy of the GNU General Public License
 >     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 >  
 > -#ifdef GDBSERVER
 > -#include "server.h"
 > -#else
 > -#include "defs.h"
 > -#include "inferior.h"
 > -#endif
 > +#include "common-defs.h"
 >  #include "i386-dregs.h"
 > +#include "break-common.h"
 >  
 >  /* Support for hardware watchpoints and breakpoints using the i386
 >     debug registers.
 > @@ -175,10 +171,8 @@
 >  /* Types of operations supported by i386_handle_nonaligned_watchpoint.  */
 >  typedef enum { WP_INSERT, WP_REMOVE, WP_COUNT } i386_wp_op_t;
 >  
 > -#ifndef GDBSERVER
 >  /* Whether or not to print the mirrored debug registers.  */
 >  extern int debug_hw_points;
 > -#endif

Since externs should live in headers, and since this is a cleanup patch,
can I impose on you a request to move debug_hw_points to a header.
Seems like i386-dregs.h is the best place.

The variable could even arguably be defined in i386-dregs.c,
though I'm not sure if/how people would want i386-nat.c to change.
Plus add x86 or some such to the variable's name.
I'd leave this part to another pass.

 >  
 >  /* Print the values of the mirrored debug registers.  */
 >  
 > -- 
 > 1.7.1
 >
  
Gary Benson Aug. 7, 2014, 12:28 p.m. UTC | #2
Doug Evans wrote:
> Gary Benson writes:
> > -#ifndef GDBSERVER
> >  /* Whether or not to print the mirrored debug registers.  */
> >  extern int debug_hw_points;
> > -#endif
> 
> Since externs should live in headers, and since this is a cleanup
> patch, can I impose on you a request to move debug_hw_points to a
> header.  Seems like i386-dregs.h is the best place.
> 
> The variable could even arguably be defined in i386-dregs.c, though
> I'm not sure if/how people would want i386-nat.c to change.  Plus
> add x86 or some such to the variable's name.  I'd leave this part to
> another pass.

i386-dregs doesn't work for debug_hw_points, as it's also used by
the aarch64-linux code.  It's handled fairly messily at present
(it's global in gdbserver, in server.[ch], but local to some ports
in GDB) which I guess I why I left it why it was when I did the
i386-dregs work.

Since it's global in gdbserver it probably should just be global.
I'll move the extern to common-debug.h, and the definition to
common-debug.c.

Thanks,
Gary
  

Patch

diff --git a/gdb/nat/i386-dregs.c b/gdb/nat/i386-dregs.c
index e3272cd..7905c44 100644
--- a/gdb/nat/i386-dregs.c
+++ b/gdb/nat/i386-dregs.c
@@ -17,13 +17,9 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifdef GDBSERVER
-#include "server.h"
-#else
-#include "defs.h"
-#include "inferior.h"
-#endif
+#include "common-defs.h"
 #include "i386-dregs.h"
+#include "break-common.h"
 
 /* Support for hardware watchpoints and breakpoints using the i386
    debug registers.
@@ -175,10 +171,8 @@ 
 /* Types of operations supported by i386_handle_nonaligned_watchpoint.  */
 typedef enum { WP_INSERT, WP_REMOVE, WP_COUNT } i386_wp_op_t;
 
-#ifndef GDBSERVER
 /* Whether or not to print the mirrored debug registers.  */
 extern int debug_hw_points;
-#endif
 
 /* Print the values of the mirrored debug registers.  */