[07/15] Remove GDBSERVER use from nat/i386-dregs.c
Commit Message
This removes the use of GDBSERVER from nat/i386-dregs.c. Neither
defs.h or server.h are included: the specific files required are
listed instead. Also, a declaration previously made only outside
of gdbserver is made unconditional.
gdb/
2014-07-09 Gary Benson <gbenson@redhat.com>
* gdb/nat/i386-dregs.c: Don't include server.h or defs.h; update
includes.
(debug_hw_points): Declare regardless of GDBSERVER.
---
gdb/ChangeLog | 6 ++++++
gdb/nat/i386-dregs.c | 16 ++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
Comments
>>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:
Gary> This removes the use of GDBSERVER from nat/i386-dregs.c. Neither
Gary> defs.h or server.h are included: the specific files required are
Gary> listed instead. Also, a declaration previously made only outside
Gary> of gdbserver is made unconditional.
Gary> -#ifdef GDBSERVER
Gary> -#include "server.h"
Gary> -#else
Gary> -#include "defs.h"
Gary> -#include "inferior.h"
Gary> -#endif
Gary> +#include "common-utils.h"
I think this should include config.h first.
Tom
Tom Tromey wrote:
> >>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:
>
> Gary> This removes the use of GDBSERVER from nat/i386-dregs.c.
> Gary> Neither defs.h or server.h are included: the specific files
> Gary> required are listed instead. Also, a declaration previously
> Gary> made only outside of gdbserver is made unconditional.
>
> Gary> -#ifdef GDBSERVER
> Gary> -#include "server.h"
> Gary> -#else
> Gary> -#include "defs.h"
> Gary> -#include "inferior.h"
> Gary> -#endif
> Gary> +#include "common-utils.h"
>
> I think this should include config.h first.
common-utils.h includes it. Or did you mean the gnulib one?
Thanks,
Gary
>>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:
Gary> -#ifdef GDBSERVER
Gary> -#include "server.h"
Gary> -#else
Gary> -#include "defs.h"
Gary> -#include "inferior.h"
Gary> -#endif
Gary> +#include "common-utils.h"
>> I think this should include config.h first.
Gary> common-utils.h includes it. Or did you mean the gnulib one?
Nope, not the gnulib one. I didn't realize that common-utils.h includes
config.h. That seems weird to me.
I think it's generally better for "random" headers not to include
config.h and to either have a "standard" base header (like defs.h or
server.h) that includes config.h, or to just have explicit includes of
config.h as the first thing in each .c.
I realize it's not a problem arising from your series.
But would you mind just having the .c include config.h explicitly?
Then at some point I'll go through and fix up common-utils.h and its
users.
Tom
Tom Tromey wrote:
> >>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:
>
> Gary> -#ifdef GDBSERVER
> Gary> -#include "server.h"
> Gary> -#else
> Gary> -#include "defs.h"
> Gary> -#include "inferior.h"
> Gary> -#endif
> Gary> +#include "common-utils.h"
>
> >> I think this should include config.h first.
>
> Gary> common-utils.h includes it. Or did you mean the gnulib one?
>
> Nope, not the gnulib one. I didn't realize that common-utils.h
> includes config.h. That seems weird to me.
>
> I think it's generally better for "random" headers not to include
> config.h and to either have a "standard" base header (like defs.h or
> server.h) that includes config.h, or to just have explicit includes
> of config.h as the first thing in each .c.
>
> I realize it's not a problem arising from your series. But would
> you mind just having the .c include config.h explicitly? Then at
> some point I'll go through and fix up common-utils.h and its users.
Ok, I'll do that.
Cheers,
Gary
Gary Benson writes:
> This removes the use of GDBSERVER from nat/i386-dregs.c. Neither
> defs.h or server.h are included: the specific files required are
> listed instead. Also, a declaration previously made only outside
> of gdbserver is made unconditional.
>
> gdb/
> 2014-07-09 Gary Benson <gbenson@redhat.com>
>
> * gdb/nat/i386-dregs.c: Don't include server.h or defs.h; update
> includes.
> (debug_hw_points): Declare regardless of GDBSERVER.
LGTM
@@ -17,12 +17,14 @@
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-utils.h"
+#include "common-types.h"
+#include "break-common.h"
+#include "common-debug.h"
+#include "print-utils.h"
+#include "errors.h"
+#include "gdb_locale.h"
+#include "gdb_assert.h"
#include "i386-dregs.h"
/* Support for hardware watchpoints and breakpoints using the i386
@@ -175,10 +177,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. */