public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] gdb: xtensa: fix linux ptrace includes
@ 2014-01-19  7:53 Baruch Siach
  2014-01-20 12:20 ` Pedro Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Baruch Siach @ 2014-01-19  7:53 UTC (permalink / raw)
  To: gdb-patches
  Cc: Pedro Alves, Maxim Grigoriev, Marc Gauthier, Dror Maydan,
	Woody LaRue, Chris Zankel, Baruch Siach

Currently, xtensa code using the Linux ptrace interface only include
sys/ptrace.h. This file comes from the C library (glibc and uClibc, at least),
and includes a declaration of the ptrace() functions, along with some cross
architecture constants that are mostly copied from the file located at
include/uapi/linux/ptrace.h in recent Linux kernels.

For xtensa specific constants like PTRACE_GETXTREGS and PTRACE_SETXTREGS the
asm/ptrace.h include from the Linux kernel UAPI is needed. The code in
gdbserver xtensa specific part doesn't call ptrace() directly, so we can
remove the unneeded sys/ptrace.h include. The gdb xtensa specific code needs
both headers, since it calls ptrace().

gdb/
	* xtensa-linux-nat.c: add #include asm/ptrace.h.

gdb/gdbserver/
	* linux-xtensa-low.c: #include asm/ptrace.h instead of sys/ptrace.h.
---
 gdb/gdbserver/linux-xtensa-low.c | 2 +-
 gdb/xtensa-linux-nat.c           | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c
index 7db97a9..479b65b 100644
--- a/gdb/gdbserver/linux-xtensa-low.c
+++ b/gdb/gdbserver/linux-xtensa-low.c
@@ -24,7 +24,7 @@
 void init_registers_xtensa (void);
 extern const struct target_desc *tdesc_xtensa;
 
-#include <sys/ptrace.h>
+#include <asm/ptrace.h>
 #include <xtensa-config.h>
 
 #include "xtensa-xtregs.c"
diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index 2372e79..9340c62 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -36,6 +36,7 @@
 #include <fcntl.h>
 #include <sys/procfs.h>
 #include <sys/ptrace.h>
+#include <asm/ptrace.h>
 
 #include "gregset.h"
 #include "xtensa-tdep.h"
-- 
1.8.5.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-22 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-19  7:53 [PATCH v2] gdb: xtensa: fix linux ptrace includes Baruch Siach
2014-01-20 12:20 ` Pedro Alves
2014-01-22  4:52   ` Baruch Siach
2014-01-22 12:36     ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).