From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/6] Move PTRACE_GETREGSET and PTRACE_SETREGSET to nat/linux-ptrace.h
Date: Thu, 28 May 2015 14:20:00 -0000 [thread overview]
Message-ID: <1432822816-32327-2-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1432822816-32327-1-git-send-email-yao.qi@linaro.org>
Macros PTRACE_GETREGSET and PTRACE_SETREGSET are defined locally in
some places in GDB and GDBserver. This patch is to move them to
nat/linux-ptrace.h to avoid duplication.
gdb:
2015-05-28 Yao Qi <yao.qi@linaro.org>
* amd64-linux-nat.c: Include "nat/linux-ptrace.h".
* i386-linux-nat.c: Likewise.
* nat/linux-ptrace.h (PTRACE_GETREGSET, PTRACE_SETREGSET): Define.
* s390-linux-nat.c: Include "nat/linux-ptrace.h".
(PTRACE_GETREGSET, PTRACE_SETREGSET): Remove.
* x86-linux-nat.c: Include "nat/linux-ptrace.h".
* x86-linux-nat.h (PTRACE_GETREGSET, PTRACE_SETREGSET): Remove.
gdb/gdbserver:
2015-05-28 Yao Qi <yao.qi@linaro.org>
* linux-s390-low.c (PTRACE_GETREGSET, PTRACE_SETREGSET): Remove.
* linux-x86-low.c: Likewise.
---
gdb/amd64-linux-nat.c | 1 +
gdb/gdbserver/linux-s390-low.c | 8 --------
gdb/gdbserver/linux-x86-low.c | 9 ---------
gdb/i386-linux-nat.c | 1 +
gdb/nat/linux-ptrace.h | 8 ++++++++
gdb/s390-linux-nat.c | 9 +--------
gdb/x86-linux-nat.c | 1 +
gdb/x86-linux-nat.h | 8 --------
8 files changed, 12 insertions(+), 33 deletions(-)
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 22a1359..30892ca 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -37,6 +37,7 @@
#include "x86-xstate.h"
#include "x86-linux-nat.h"
+#include "nat/linux-ptrace.h"
/* Mapping between the general-purpose registers in GNU/Linux x86-64
`struct user' format and GDB's register cache layout for GNU/Linux
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c
index afee1ff..5d4ea1f 100644
--- a/gdb/gdbserver/linux-s390-low.c
+++ b/gdb/gdbserver/linux-s390-low.c
@@ -40,14 +40,6 @@
#define HWCAP_S390_VX 2048
#endif
-#ifndef PTRACE_GETREGSET
-#define PTRACE_GETREGSET 0x4204
-#endif
-
-#ifndef PTRACE_SETREGSET
-#define PTRACE_SETREGSET 0x4205
-#endif
-
/* Defined in auto-generated file s390-linux32.c. */
void init_registers_s390_linux32 (void);
extern const struct target_desc *tdesc_s390_linux32;
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 4aef7b7..484eadb 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -120,15 +120,6 @@ static const char *xmltarget_amd64_linux_no_xml = "@<target>\
#include <sys/ptrace.h>
#include <sys/uio.h>
-#ifndef PTRACE_GETREGSET
-#define PTRACE_GETREGSET 0x4204
-#endif
-
-#ifndef PTRACE_SETREGSET
-#define PTRACE_SETREGSET 0x4205
-#endif
-
-
#ifndef PTRACE_GET_THREAD_AREA
#define PTRACE_GET_THREAD_AREA 25
#endif
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 8cb8c66..5666361 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -34,6 +34,7 @@
#include "x86-xstate.h"
#include "x86-linux-nat.h"
+#include "nat/linux-ptrace.h"
/* The register sets used in GNU/Linux ELF core-dumps are identical to
the register sets in `struct user' that is used for a.out
diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
index 1db0cde..be6c395 100644
--- a/gdb/nat/linux-ptrace.h
+++ b/gdb/nat/linux-ptrace.h
@@ -43,6 +43,14 @@ struct buffer;
# define PTRACE_SETSIGINFO 0x4203
#endif /* PTRACE_GETSIGINF */
+#ifndef PTRACE_GETREGSET
+#define PTRACE_GETREGSET 0x4204
+#endif
+
+#ifndef PTRACE_SETREGSET
+#define PTRACE_SETREGSET 0x4205
+#endif
+
/* If the system headers did not provide the constants, hard-code the normal
values. */
#ifndef PTRACE_EVENT_FORK
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index 4cd3192..cedc505 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -27,6 +27,7 @@
#include "auxv.h"
#include "gregset.h"
#include "regset.h"
+#include "nat/linux-ptrace.h"
#include "s390-linux-tdep.h"
#include "elf/common.h"
@@ -38,14 +39,6 @@
#include <sys/ucontext.h>
#include <elf.h>
-#ifndef PTRACE_GETREGSET
-#define PTRACE_GETREGSET 0x4204
-#endif
-
-#ifndef PTRACE_SETREGSET
-#define PTRACE_SETREGSET 0x4205
-#endif
-
/* Per-thread arch-specific data. */
struct arch_lwp_info
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index f8eb236..0026d26 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -41,6 +41,7 @@
#include "nat/linux-nat.h"
#include "nat/x86-linux.h"
#include "nat/x86-linux-dregs.h"
+#include "nat/linux-ptrace.h"
/* Per-thread arch-specific data we want to keep. */
diff --git a/gdb/x86-linux-nat.h b/gdb/x86-linux-nat.h
index 7928aa0..7c4d87c 100644
--- a/gdb/x86-linux-nat.h
+++ b/gdb/x86-linux-nat.h
@@ -20,14 +20,6 @@
#ifndef X86_LINUX_NAT_H
#define X86_LINUX_NAT_H 1
-#ifndef PTRACE_GETREGSET
-#define PTRACE_GETREGSET 0x4204
-#endif
-
-#ifndef PTRACE_SETREGSET
-#define PTRACE_SETREGSET 0x4205
-#endif
-
/* Does the current host support PTRACE_GETREGSET? */
extern int have_ptrace_getregset;
\f
--
1.9.1
next prev parent reply other threads:[~2015-05-28 14:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 14:20 [PATCH 0/6] Use PTRACE_GETREGSET and PTRACE_SETREGSET in arm-linux-nat.c Yao Qi
2015-05-28 14:20 ` [PATCH 4/6] Fetch and store GP registers by PTRACE_{G,S}ETREGSET Yao Qi
2015-05-28 18:50 ` Doug Evans
2015-05-29 13:11 ` Yao Qi
2015-05-28 14:20 ` Yao Qi [this message]
2015-05-28 14:20 ` [PATCH 2/6] Move have_ptrace_getregset to linux-nat.c Yao Qi
2015-05-28 14:20 ` [PATCH 5/6] Fetch and store FP registers by PTRACE_{G,S}ETREGSET Yao Qi
2015-05-28 14:20 ` [PATCH 6/6] Fetch and store VFP " Yao Qi
2015-05-28 14:20 ` [PATCH 3/6] Check whether kernel supports PTRACE_GETREGSET Yao Qi
2015-05-29 8:10 ` [PATCH 0/6] Use PTRACE_GETREGSET and PTRACE_SETREGSET in arm-linux-nat.c Gary Benson
2015-06-01 11:17 ` Yao Qi
2015-06-02 7:57 ` Mark Wielaard
2015-06-02 9:30 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432822816-32327-2-git-send-email-yao.qi@linaro.org \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox