[PATCH 1/3] Include asm/ptrace.h in mips-linux-nat.c

Yao Qi
2013-05-30T02:44:02Z

Hi,
This patch is to include asm/ptrace.h in mips-linux-nat.c and remove
some duplicated structs already defined in asm/ptrace.h.

The ptrace support for hardware support was added into kernel in Sep.
2008 and the mips hardware watchpoint for native GDB was committed
on April 2009. Considering the time order, GDB doesn't have to carry
these local definitions, and should include asm/ptrace.h instead.

gdb:

2013-05-30 Yao Qi <yao@codesourcery.com>

* mips-linux-nat.c: Include asm/ptrace.h.
(enum pt_watch_style): Remove.
(struct mips32_watch_regs): Remove.
(struct mips64_watch_regs): Remove.
(struct pt_watch_regs): Remove.
---
gdb/mips-linux-nat.c | 45 +--------------------------------------------
1 files changed, 1 insertions(+), 44 deletions(-)

diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index d323a82..d8b4d29 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -34,6 +34,7 @@

#include <sgidefs.h>
#include <sys/ptrace.h>
+#include <asm/ptrace.h>

#include "features/mips-linux.c"
#include "features/mips-dsp-linux.c"
@@ -478,52 +479,8 @@ mips_linux_read_description (struct target_ops *ops)

#define IRW_MASK (I_MASK | R_MASK | W_MASK)

-enum pt_watch_style {
- pt_watch_style_mips32,
- pt_watch_style_mips64
-};
-
#define MAX_DEBUG_REGISTER 8

-/* A value of zero in a watchlo indicates that it is available. */
-
-struct mips32_watch_regs
-{
- uint32_t watchlo[MAX_DEBUG_REGISTER];
- /* Lower 16 bits of watchhi. */
- uint16_t watchhi[MAX_DEBUG_REGISTER];
- /* Valid mask and I R W bits.
- * bit 0 -- 1 if W bit is usable.
- * bit 1 -- 1 if R bit is usable.
- * bit 2 -- 1 if I bit is usable.
- * bits 3 - 11 -- Valid watchhi mask bits.
- */
- uint16_t watch_masks[MAX_DEBUG_REGISTER];
- /* The number of valid watch register pairs. */
- uint32_t num_valid;
- /* There is confusion across gcc versions about structure alignment,
- so we force 8 byte alignment for these structures so they match
- the kernel even if it was build with a different gcc version. */
-} __attribute__ ((aligned (8)));
-
-struct mips64_watch_regs
-{
- uint64_t watchlo[MAX_DEBUG_REGISTER];
- uint16_t watchhi[MAX_DEBUG_REGISTER];
- uint16_t watch_masks[MAX_DEBUG_REGISTER];
- uint32_t num_valid;
-} __attribute__ ((aligned (8)));
-
-struct pt_watch_regs
-{
- enum pt_watch_style style;
- union
- {
- struct mips32_watch_regs mips32;
- struct mips64_watch_regs mips64;
- };
-};
-
/* -1 if the kernel and/or CPU do not support watch registers.
1 if watch_readback is valid and we can read style, num_valid
and the masks.
--
1.7.7.6